from __future__ import annotations

lowercase_     :   Optional[int] 				=				1_0







def 			A__      (	snake_case_ :		Dict      ):
 SCREAMING_SNAKE_CASE__:   Tuple=      1
 SCREAMING_SNAKE_CASE__:   str=      max(lowerCamelCase_      )
 while placement <= max_digit:
  # declare and initialize empty buckets
  SCREAMING_SNAKE_CASE__:   list[list]=      [[] for _ in range(lowerCamelCase_      )]
  # split list_of_ints between the buckets
  for i in list_of_ints:
   SCREAMING_SNAKE_CASE__:   List[str]=      int((i / placement) % RADIX      )
   buckets[tmp].append(lowerCamelCase_      )
  # put each buckets' contents into list_of_ints
  SCREAMING_SNAKE_CASE__:   Dict=      0
  for b in range(lowerCamelCase_      ):
   for i in buckets[b]:
    SCREAMING_SNAKE_CASE__:   List[str]=      i
    a += 1
        # move to next
  placement *= RADIX
 return list_of_ints


if __name__ == "__main__":
    import doctest

    doctest.testmod()


import os







def 			A__      (	snake_case_ :		str = "matrix.txt"      ):
 with open(os.path.join(os.path.dirname(snake_case_      )       ,				snake_case_      )      ) as in_file:
  SCREAMING_SNAKE_CASE__:   Dict=      in_file.read()

 SCREAMING_SNAKE_CASE__:   Optional[int]=      [[int(snake_case_      ) for cell in row.split(''','''      )] for row in data.strip().splitlines()]
 SCREAMING_SNAKE_CASE__:   int=      [[0 for cell in row] for row in grid]
 SCREAMING_SNAKE_CASE__:   Dict=      len(grid[0]      )

 SCREAMING_SNAKE_CASE__:   Dict=      [[0 for i in range(snake_case_      )] for j in range(snake_case_      )]
 SCREAMING_SNAKE_CASE__:   Optional[int]=      grid[0][0]
 for i in range(1       ,				snake_case_      ):
  SCREAMING_SNAKE_CASE__:   Optional[int]=      grid[0][i] + dp[0][i - 1]
 for i in range(1       ,				snake_case_      ):
  SCREAMING_SNAKE_CASE__:   List[Any]=      grid[i][0] + dp[i - 1][0]

 for i in range(1       ,				snake_case_      ):
  for j in range(1       ,				snake_case_      ):
   SCREAMING_SNAKE_CASE__:   Dict=      grid[i][j] + min(dp[i - 1][j]       ,				dp[i][j - 1]      )

 return dp[-1][-1]


if __name__ == "__main__":
      print(f'''{solution() = }''')

