

'''simple docstring'''






class     lowercase_			:




  """simple docstring"""




  def __init__(   self     :  Union[str, Any]      ,lowercase__     :  int      ,lowercase__     :  Union[str, Any]      ,lowercase__     :  Any    ):
   __lowercase													=				None
   __lowercase													=				None
   __lowercase													=				graph

   self._normalize_graph(lowercase__      ,lowercase__    )
   __lowercase													=				len(lowercase__    )
   __lowercase													=				None






  def       SCREAMING_SNAKE_CASE   (   self     :  Tuple      ,lowercase__     :  Optional[int]      ,lowercase__     :  List[Any]    ):
   if sources is int:
    __lowercase													=				[sources]
   if sinks is int:
    __lowercase													=				[sinks]

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

   __lowercase													=				sources[0]
   __lowercase													=				sinks[0]

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

    __lowercase													=				len(self.graph    ) + 1
    for room in self.graph:
     room.insert(0      ,0    )
    self.graph.insert(0      ,[0] * size    )
    for i in sources:
     __lowercase													=				max_input_flow
    __lowercase													=				0

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






  def       SCREAMING_SNAKE_CASE   (   self     :  Optional[int]    ):
   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       SCREAMING_SNAKE_CASE   (   self     :  Optional[int]      ,lowercase__     :  Tuple    ):
   __lowercase													=				algorithm(self    )






class     lowercase_			:




  """simple docstring"""




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






  def       SCREAMING_SNAKE_CASE   (   self     :  str    ):
   if not self.executed:
    self._algorithm()
    __lowercase													=				True






  def       SCREAMING_SNAKE_CASE   (   self     :  Dict    ):
   pass






class     lowercase_			(lowerCamelCase__   ):




  """simple docstring"""




  def __init__(   self     :  List[str]      ,lowercase__     :  Optional[Any]    ):
   super().__init__(lowercase__    )
   # use this to save your result
   __lowercase													=				-1






  def       SCREAMING_SNAKE_CASE   (   self     :  Union[str, Any]    ):
   if not self.executed:
    raise Exception('''You should execute algorithm before using its result!'''    )

   return self.maximum_flow






class     lowercase_			(lowerCamelCase__   ):




  """simple docstring"""




  def __init__(   self     :  List[str]      ,lowercase__     :  Optional[int]    ):
   super().__init__(lowercase__    )

   __lowercase													=				[[0] * self.verticies_count for i in range(self.verticies_count    )]

   __lowercase													=				[0] * self.verticies_count
   __lowercase													=				[0] * self.verticies_count






  def       SCREAMING_SNAKE_CASE   (   self     :  Optional[Any]    ):
   __lowercase													=				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
   __lowercase													=				[
       i
       for i in range(self.verticies_count    )
       if i != self.source_index and i != self.sink_index
   ]

   # move through list
   __lowercase													=				0
   while i < len(lowercase__    ):
    __lowercase													=				vertices_list[i]
    __lowercase													=				self.heights[vertex_index]
    self.process_vertex(lowercase__    )
    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(lowercase__    )    )
     __lowercase													=				0
    else:
     i += 1

   __lowercase													=				sum(self.preflow[self.source_index]    )






  def       SCREAMING_SNAKE_CASE   (   self     :  str      ,lowercase__     :  Any    ):
   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(lowercase__      ,lowercase__    )

    self.relabel(lowercase__    )






  def       SCREAMING_SNAKE_CASE   (   self     :  Tuple      ,lowercase__     :  List[str]      ,lowercase__     :  Any    ):
   __lowercase													=				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       SCREAMING_SNAKE_CASE   (   self     :  List[str]      ,lowercase__     :  List[str]    ):
   __lowercase													=				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):
     __lowercase													=				self.heights[to_index]

   if min_height is not None:
    __lowercase													=				min_height + 1


if __name__ == "__main__":
 lowerCAmelCase__      		=			[0]
 lowerCAmelCase__      		=			[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],
 # ]
 lowerCAmelCase__      		=			[[0, 7, 0, 0], [0, 0, 6, 0], [0, 0, 0, 8], [9, 0, 0, 0]]

 # prepare our network
 lowerCAmelCase__      		=			FlowNetwork(graph, entrances, exits)
 # set algorithm
 flow_network.set_maximum_flow_algorithm(PushRelabelExecutor)
 # and calculate
 lowerCAmelCase__      		=			flow_network.find_maximum_flow()

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




'''simple docstring'''






import re


def 	_A  (					A__   ):






 """simple docstring"""



 __lowercase													=				re.compile(
     R'''^(?:0|94|\+94|0{2}94)''' R'''7(0|1|2|4|5|6|7|8)''' R'''(-| |)''' R'''\d{7}$'''   )

 return bool(re.search(A__  ,       A__   )   )


if __name__ == "__main__":
 lowerCAmelCase__      		=			'''0094702343221'''

 print(is_sri_lankan_phone_number(phone))

