


from heapq import heappop, heappush

import numpy as np






def 	__lowerCAmelCase   (SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , )->  tuple[float | int, list[tuple[int, int]]]:




      """simple docstring"""

      snake_case_	,   snake_case_	=				grid.shape
      snake_case_	=				[-1, 1, 0, 0]
      snake_case_	=				[0, 0, -1, 1]
      if allow_diagonal:
            dx += [-1, -1, 1, 1]
            dy += [-1, 1, -1, 1]

      snake_case_	,   snake_case_	=				[(0, source)], set()
      snake_case_	=				np.full((rows, cols) , np.inf )
      snake_case_	=				0
      snake_case_	=				np.empty((rows, cols) , dtype=SCREAMING_SNAKE_CASE )
      snake_case_	=				None

      while queue:
            ((snake_case_)	,   (snake_case_))	=				heappop(SCREAMING_SNAKE_CASE )
            if (x, y) in visited:
                  continue
            visited.add((x, y) )

            if (x, y) == destination:
                  snake_case_	=				[]
                  while (x, y) != source:
                        path.append((x, y) )
                        snake_case_	,   snake_case_	=				predecessors[x, y]
                  path.append(SCREAMING_SNAKE_CASE )  # add the source manually
                  path.reverse()
                  return matrix[destination], path

            for i in range(len(SCREAMING_SNAKE_CASE ) ):
                  snake_case_	,   snake_case_	=				x + dx[i], y + dy[i]
                  if 0 <= nx < rows and 0 <= ny < cols:
                        snake_case_	=				grid[nx][ny]
                        if next_node == 1 and matrix[nx, ny] > dist + 1:
                              heappush(SCREAMING_SNAKE_CASE , (dist + 1, (nx, ny)) )
                              snake_case_	=				dist + 1
                              snake_case_	=				(x, y)

      return np.inf, []


if __name__ == "__main__":
   import doctest

   doctest.testmod()



def 	__lowerCAmelCase   (SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE )->  list[int]:




      """simple docstring"""

      snake_case_	=				int(SCREAMING_SNAKE_CASE )

      # Initialize Result
      snake_case_	=				[]

      # Traverse through all denomination
      for denomination in reversed(SCREAMING_SNAKE_CASE ):
            # Find denominations
            while int(SCREAMING_SNAKE_CASE ) >= int(SCREAMING_SNAKE_CASE ):
                  total_value -= int(SCREAMING_SNAKE_CASE )
                  answer.append(SCREAMING_SNAKE_CASE )  # Append the "answers" array

      return answer


# Driver Code
if __name__ == "__main__":
   UpperCAmelCase      =   []
   UpperCAmelCase      =   """0"""

   if (
       input("""Do you want to enter your denominations ? (yY/n): """).strip().lower()
       == "y"
   ):
      UpperCAmelCase      =   int(input("""Enter the number of denominations you want to add: """).strip())

      for i in range(0, n):
         denominations.append(int(input(f'''Denomination {i}: ''').strip()))
      UpperCAmelCase      =   input("""Enter the change you want to make in Indian Currency: """).strip()
   else:
      # All denominations of Indian Currency if user does not enter
      UpperCAmelCase      =   [1, 2, 5, 10, 20, 50, 100, 500, 2000]
      UpperCAmelCase      =   input("""Enter the change you want to make: """).strip()

   if int(value) == 0 or int(value) < 0:
      print("""The total value cannot be zero or negative.""")

   else:
      print(f'''Following is minimal change for {value}: ''')
      UpperCAmelCase      =   find_minimum_change(denominations, value)
      # Print result
      for i in range(len(answer)):
         print(answer[i], end=""" """)