



class 							lowerCAmelCase__  :







     def __init__(       self      :     int			,		_A      :     List[Any]			,		_A      :     int			,		_A      :     Union[str, Any]):
           A__	:							Tuple						    = None
           A__	:							Union[str, Any]						    = None
           A__	:							int						    = graph

           self._normalize_graph(__lowerCamelCase			,		__lowerCamelCase)
           A__	:							Optional[Any]						    = len(__lowerCamelCase)
           A__	:							Any						    = None







     def  _lowercase			(       self      :     Any			,		_A      :     Optional[int]			,		_A      :     Union[str, Any]):
           if sources is int:
                 A__	:							str						    = [sources]
           if sinks is int:
                 A__	:							int						    = [sinks]

           if len(__lowerCamelCase) == 0 or len(__lowerCamelCase) == 0:
                 return

           A__	:							Tuple						    = sources[0]
           A__	:							List[str]						    = sinks[0]

           # make fake vertex if there are more
           # than one source or sink
           if len(__lowerCamelCase) > 1 or len(__lowerCamelCase) > 1:
                 A__	:							Optional[Any]						    = 0
                 for i in sources:
                       max_input_flow += sum(self.graph[i])

                 A__	:							Optional[int]						    = len(self.graph) + 1
                 for room in self.graph:
                       room.insert(0			,		0)
                 self.graph.insert(0			,		[0] * size)
                 for i in sources:
                       A__	:							str						    = max_input_flow
                 A__	:							List[str]						    = 0

                 A__	:							Any						    = len(self.graph) + 1
                 for room in self.graph:
                       room.append(0)
                 self.graph.append([0] * size)
                 for i in sinks:
                       A__	:							List[str]						    = max_input_flow
                 A__	:							str						    = size - 1







     def  _lowercase			(       self      :     Dict):
           if self.maximum_flow_algorithm is None:
                 raise Exception("You need to set maximum flow algorithm before.")
           if self.source_index is None or self.sink_index is None:
                 return 0

           self.maximum_flow_algorithm.execute()
           return self.maximum_flow_algorithm.getMaximumFlow()







     def  _lowercase			(       self      :     Union[str, Any]			,		_A      :     List[Any]):
           A__	:							Any						    = algorithm(self)




class 							lowerCAmelCase__  :







     def __init__(       self      :     Optional[int]			,		_A      :     int):
           A__	:							Optional[int]						    = flow_network
           A__	:							List[Any]						    = flow_network.verticesCount
           A__	:							Tuple						    = flow_network.sourceIndex
           A__	:							Any						    = flow_network.sinkIndex
           # it's just a reference, so you shouldn't change
           # it in your algorithms, use deep copy before doing that
           A__	:							int						    = flow_network.graph
           A__	:							int						    = False







     def  _lowercase			(       self      :     Optional[int]):
           if not self.executed:
                 self._algorithm()
                 A__	:							Optional[Any]						    = True







     def  _lowercase			(       self      :     Any):
           pass




class 							lowerCAmelCase__  (	_A						):







     def __init__(       self      :     int			,		_A      :     Tuple):
           super().__init__(__lowerCamelCase)
           # use this to save your result
           A__	:							List[Any]						    = -1







     def  _lowercase			(       self      :     Optional[Any]):
           if not self.executed:
                 raise Exception("You should execute algorithm before using its result!")

           return self.maximum_flow




class 							lowerCAmelCase__  (	_A						):







     def __init__(       self      :     Dict			,		_A      :     Any):
           super().__init__(__lowerCamelCase)

           A__	:							Optional[int]						    = [[0] * self.verticies_count for i in range(self.verticies_count)]

           A__	:							Optional[int]						    = [0] * self.verticies_count
           A__	:							Dict						    = [0] * self.verticies_count







     def  _lowercase			(       self      :     str):
           A__	:							Tuple						    = self.verticies_count

           # push some substance to graph
           for nextvertex_index, bandwidth in enumerate(self.graph[self.source_index]):
                 self.preflow[self.source_index][nextvertex_index] += bandwidth
                 self.preflow[nextvertex_index][self.source_index] -= bandwidth
                 self.excesses[nextvertex_index] += bandwidth

           # Relabel-to-front selection rule
           A__	:							List[Any]						    = [
               i
               for i in range(self.verticies_count)
               if i != self.source_index and i != self.sink_index
           ]

           # move through list
           A__	:							List[Any]						    = 0
           while i < len(__lowerCamelCase):
                 A__	:							int						    = vertices_list[i]
                 A__	:							Optional[int]						    = self.heights[vertex_index]
                 self.process_vertex(__lowerCamelCase)
                 if self.heights[vertex_index] > previous_height:
                       # if it was relabeled, swap elements
                       # and start from 0 index
                       vertices_list.insert(0			,		vertices_list.pop(__lowerCamelCase))
                       A__	:							Any						    = 0
                 else:
                       i += 1

           A__	:							List[Any]						    = sum(self.preflow[self.source_index])







     def  _lowercase			(       self      :     str			,		_A      :     str):
           while self.excesses[vertex_index] > 0:
                 for neighbour_index in range(self.verticies_count):
                       # if it's neighbour and current vertex is higher
                       if (
                           self.graph[vertex_index][neighbour_index]
                           - self.preflow[vertex_index][neighbour_index]
                           > 0
                           and self.heights[vertex_index] > self.heights[neighbour_index]
                       ):
                             self.push(__lowerCamelCase			,		__lowerCamelCase)

                 self.relabel(__lowerCamelCase)







     def  _lowercase			(       self      :     Dict			,		_A      :     List[str]			,		_A      :     Tuple):
           A__	:							List[str]						    = min(
               self.excesses[from_index]			,		self.graph[from_index][to_index] - self.preflow[from_index][to_index]			,		)
           self.preflow[from_index][to_index] += preflow_delta
           self.preflow[to_index][from_index] -= preflow_delta
           self.excesses[from_index] -= preflow_delta
           self.excesses[to_index] += preflow_delta







     def  _lowercase			(       self      :     Optional[Any]			,		_A      :     Dict):
           A__	:							int						    = None
           for to_index in range(self.verticies_count):
                 if (
                     self.graph[vertex_index][to_index]
                     - self.preflow[vertex_index][to_index]
                     > 0
                 ) and (min_height is None or self.heights[to_index] < min_height):
                       A__	:							Dict						    = self.heights[to_index]

           if min_height is not None:
                 A__	:							List[str]						    = min_height + 1


if __name__ == "__main__":
  snake_case    :						Optional[Any]  =						[0]
  snake_case    :						int  =						[3]
  # graph = [
  #     [0, 0, 4, 6, 0, 0],
  #     [0, 0, 5, 2, 0, 0],
  #     [0, 0, 0, 0, 4, 4],
  #     [0, 0, 0, 0, 6, 6],
  #     [0, 0, 0, 0, 0, 0],
  #     [0, 0, 0, 0, 0, 0],
  # ]
  snake_case    :						Optional[Any]  =						[[0, 7, 0, 0], [0, 0, 6, 0], [0, 0, 0, 8], [9, 0, 0, 0]]

  # prepare our network
  snake_case    :						Union[str, Any]  =						FlowNetwork(graph, entrances, exits)
  # set algorithm
  flow_network.set_maximum_flow_algorithm(PushRelabelExecutor)
  # and calculate
  snake_case    :						Dict  =						flow_network.find_maximum_flow()

  print(f"""maximum flow is {maximum_flow}""")




def 	snake_case__       (					)		->		Union[str, Any]:







						"""simple docstring"""

						A__	:							Tuple						    = []
						A__	:							Optional[int]						    = 1

						while len(__lowercase       ) < 1E6:
												constant.append(str(__lowercase       )       )
												i += 1

						A__	:							Any						    = "".join(__lowercase       )

						return (
						    int(constant[0]       )
						    * int(constant[9]       )
						    * int(constant[9_9]       )
						    * int(constant[9_9_9]       )
						    * int(constant[9_9_9_9]       )
						    * int(constant[9_9_9_9_9]       )
						    * int(constant[9_9_9_9_9_9]       )
						)


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