
'''simple docstring'''



def A				(__lowerCamelCase				:List[str]			,     __lowerCamelCase				:Dict			,     __lowerCamelCase				:Any			,     __lowerCamelCase				:List[str]		):
						# Return True if there is node that has not iterated.
						_lowerCAmelCase  						=			[False] * len(__lowerCamelCase		)
						_lowerCAmelCase  						=			[]
						queue.append(__lowerCamelCase		)
						_lowerCAmelCase  						=			True

						while queue:
												_lowerCAmelCase  						=			queue.pop(0		)
												for ind in range(len(graph[u]		)		):
																		if visited[ind] is False and graph[u][ind] > 0:
																								queue.append(__lowerCamelCase		)
																								_lowerCAmelCase  						=			True
																								_lowerCAmelCase  						=			u

						return visited[t]


def A				(__lowerCamelCase				:Tuple			,     __lowerCamelCase				:Dict			,     __lowerCamelCase				:Union[str, Any]		):
						# This array is filled by BFS and to store path
						_lowerCAmelCase  						=			[-1] * (len(__lowerCamelCase		))
						_lowerCAmelCase  						=			0
						while bfs(__lowerCamelCase			,     __lowerCamelCase			,     __lowerCamelCase			,     __lowerCamelCase		):
												_lowerCAmelCase  						=			float("""Inf"""		)
												_lowerCAmelCase  						=			sink

												while s != source:
																		# Find the minimum value in select path
																		_lowerCAmelCase  						=			min(__lowerCamelCase			,     graph[parent[s]][s]		)
																		_lowerCAmelCase  						=			parent[s]

												max_flow += path_flow
												_lowerCAmelCase  						=			sink

												while v != source:
																		_lowerCAmelCase  						=			parent[v]
																		graph[u][v] -= path_flow
																		graph[v][u] += path_flow
																		_lowerCAmelCase  						=			parent[v]
						return max_flow


_lowercase    =		[
    [0, 16, 13, 0, 0, 0],
    [0, 0, 10, 12, 0, 0],
    [0, 4, 0, 0, 14, 0],
    [0, 0, 9, 0, 0, 20],
    [0, 0, 0, 7, 0, 4],
    [0, 0, 0, 0, 0, 0],
]

_lowercase   ,						_lowercase    =		0, 5





print(ford_fulkerson(graph, source, sink))


'''simple docstring'''



import os


def A				():
						with open(os.path.dirname(__lowerCamelCase		) + """/grid.txt"""		) as f:
												_lowerCAmelCase  						=			[]  # noqa: E741
												for _ in range(20		):
																		l.append([int(__lowerCamelCase		) for x in f.readline().split()]		)

												_lowerCAmelCase  						=			0

												# right
												for i in range(20		):
																		for j in range(17		):
																								_lowerCAmelCase  						=			l[i][j] * l[i][j + 1] * l[i][j + 2] * l[i][j + 3]
																								if temp > maximum:
																														_lowerCAmelCase  						=			temp

        # down
												for i in range(17		):
																		for j in range(20		):
																								_lowerCAmelCase  						=			l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
																								if temp > maximum:
																														_lowerCAmelCase  						=			temp

        # diagonal 1
												for i in range(17		):
																		for j in range(17		):
																								_lowerCAmelCase  						=			l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
																								if temp > maximum:
																														_lowerCAmelCase  						=			temp

        # diagonal 2
												for i in range(17		):
																		for j in range(3			,     20		):
																								_lowerCAmelCase  						=			l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
																								if temp > maximum:
																														_lowerCAmelCase  						=			temp
												return maximum


if __name__ == "__main__":
						print(solution())
