"""simple docstring"""




import os





def 							SCREAMING_SNAKE_CASE  (    _lowerCamelCase		: str = "input.txt"			) ->   int:

  with open(os.path.join(os.path.dirname(_lowerCamelCase			)    ,_lowerCamelCase			)			) as input_file:
    _lowerCAmelCase		: Dict						    =  [
        [int(_lowerCamelCase			) for element in line.split(""","""			)]
        for line in input_file.readlines()
    ]

  _lowerCAmelCase		: str						    =  len(_lowerCamelCase			)
  _lowerCAmelCase		: Tuple						    =  len(matrix[0]			)

  _lowerCAmelCase		: Dict						    =  [[-1 for _ in range(_lowerCamelCase			)] for _ in range(_lowerCamelCase			)]
  for i in range(_lowerCamelCase			):
    _lowerCAmelCase		: List[Any]						    =  matrix[i][0]

  for j in range(1    ,_lowerCamelCase			):
    for i in range(_lowerCamelCase			):
      _lowerCAmelCase		: int						    =  minimal_path_sums[i][j - 1] + matrix[i][j]

    for i in range(1    ,_lowerCamelCase			):
      _lowerCAmelCase		: Optional[Any]						    =  min(
          minimal_path_sums[i][j]    ,minimal_path_sums[i - 1][j] + matrix[i][j]			)

    for i in range(rows - 2    ,-1    ,-1			):
      _lowerCAmelCase		: List[Any]						    =  min(
          minimal_path_sums[i][j]    ,minimal_path_sums[i + 1][j] + matrix[i][j]			)

  return min(minimal_path_sums_row[-1] for minimal_path_sums_row in minimal_path_sums			)


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





"""simple docstring"""




def 							SCREAMING_SNAKE_CASE  (    _lowerCamelCase		: int = 1000000			) ->   int:
  _lowerCAmelCase		: List[str]						    =  [i - 1 for i in range(limit + 1			)]

  for i in range(2    ,limit + 1			):
    if phi[i] == i - 1:
      for j in range(2 * i    ,limit + 1    ,_lowerCamelCase			):
        phi[j] -= phi[j] // i

  return sum(phi[2 : limit + 1]			)


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




