



"""simple docstring"""





from __future__ import annotations


class       __lowerCamelCase	:







   def __init__(self       ,	lowerCamelCase				):




      '''simple docstring'''




      _lowerCAmelCase					     =		vertices
      _lowerCAmelCase					     =		[[0] * vertices for _ in range(lowerCamelCase				)]







   def 							A__						(self       ,	lowerCamelCase				):




      '''simple docstring'''




      print("""Vertex \t Distance from Source"""				)
      for vertex in range(self.vertices				):
         print(lowerCamelCase       ,	"""\t\t"""       ,	distances_from_source[vertex]				)







   def 							A__						(self       ,	lowerCamelCase       ,	lowerCamelCase				):




      '''simple docstring'''




      _lowerCAmelCase					     =		1e7
      _lowerCAmelCase					     =		0

      # Search not nearest vertex not in the shortest path tree
      for vertex in range(self.vertices				):
         if distances_from_source[vertex] < minimum and visited[vertex] is False:
            _lowerCAmelCase					     =		distances_from_source[vertex]
            _lowerCAmelCase					     =		vertex
      return min_index







   def 							A__						(self       ,	lowerCamelCase				):




      '''simple docstring'''




      _lowerCAmelCase					     =		[int(1e7				)] * self.vertices  # distances from the source
      _lowerCAmelCase					     =		0
      _lowerCAmelCase					     =		[False] * self.vertices

      for _ in range(self.vertices				):
         _lowerCAmelCase					     =		self.minimum_distance(lowerCamelCase       ,	lowerCamelCase				)
         _lowerCAmelCase					     =		True

         # Update dist value of the adjacent vertices
         # of the picked vertex only if the current
         # distance is greater than new distance and
         # the vertex in not in the shortest path tree
         for v in range(self.vertices				):
            if (
                self.graph[u][v] > 0
                and visited[v] is False
                and distances[v] > distances[u] + self.graph[u][v]
            ):
               _lowerCAmelCase					     =		distances[u] + self.graph[u][v]

      self.print_solution(lowerCamelCase				)


if __name__ == "__main__":
  SCREAMING_SNAKE_CASE				:     Optional[int]          =	Graph(9)
  SCREAMING_SNAKE_CASE				:     Optional[Any]          =	[
      [0, 4, 0, 0, 0, 0, 0, 8, 0],
      [4, 0, 8, 0, 0, 0, 0, 1_1, 0],
      [0, 8, 0, 7, 0, 4, 0, 0, 2],
      [0, 0, 7, 0, 9, 1_4, 0, 0, 0],
      [0, 0, 0, 9, 0, 1_0, 0, 0, 0],
      [0, 0, 4, 1_4, 1_0, 0, 2, 0, 0],
      [0, 0, 0, 0, 0, 2, 0, 1, 6],
      [8, 1_1, 0, 0, 0, 0, 1, 0, 7],
      [0, 0, 2, 0, 0, 0, 6, 7, 0],
  ]
  graph.dijkstra(0)




"""simple docstring"""





def 	__UpperCAmelCase					(       snake_case_  :  Optional[int]   ,	snake_case_  :  List[str]   )							->	Optional[int]:






   """simple docstring"""


   if n < 0:
      return 0
   # table[i] represents the number of ways to get to amount i
   _lowerCAmelCase					     =		[0] * (n + 1)

   # There is exactly 1 way to get to zero(You pick no coins).
   _lowerCAmelCase					     =		1

   # Pick all coins one by one and update table[] values
   # after the index greater than or equal to the value of the
   # picked coin
   for coin_val in s:
      for j in range(snake_case_   ,	n + 1   ):
         table[j] += table[j - coin_val]

   return table[n]


if __name__ == "__main__":
  import doctest

  doctest.testmod()