import os
def 					_snake_case	(  __snake_case = "input.txt"						):

					with open(os.path.join(os.path.dirname(__snake_case						)  ,     __snake_case						)						) as input_file:
										_UpperCamelCase			     =     [
										    [int(__snake_case						) for element in line.split(''','''						)]
										    for line in input_file.readlines()
										]

					_UpperCamelCase			     =     len(__snake_case						)
					_UpperCamelCase			     =     len(matrix[0]						)

					_UpperCamelCase			     =     [[-1 for _ in range(__snake_case						)] for _ in range(__snake_case						)]
					for i in range(__snake_case						):
										_UpperCamelCase			     =     matrix[i][0]

					for j in range(1  ,     __snake_case						):
										for i in range(__snake_case						):
															_UpperCamelCase			     =     minimal_path_sums[i][j - 1] + matrix[i][j]

										for i in range(1  ,     __snake_case						):
															_UpperCamelCase			     =     min(
															    minimal_path_sums[i][j]  ,     minimal_path_sums[i - 1][j] + matrix[i][j]						)

										for i in range(rows - 2  ,     -1  ,     -1						):
															_UpperCamelCase			     =     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'''


from __future__ import annotations


def 						__a(SCREAMING_SNAKE_CASE_	:       int | float | str		,							SCREAMING_SNAKE_CASE_	:       int | float | str     ):



    '''simple docstring'''





    if nth_term == "":
        return [""]
    _lowerCAmelCase						      =   int(SCREAMING_SNAKE_CASE_     )
    _lowerCAmelCase						      =   int(SCREAMING_SNAKE_CASE_     )
    _lowerCAmelCase						      =   []
    for temp in range(int(SCREAMING_SNAKE_CASE_     )     ):
        series.append(F'''1 / {pow(temp + 1		,							int(SCREAMING_SNAKE_CASE_     )     )}''' if series else "1"     )
    return series


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       _SCREAMING_SNAKE_CASE									=				int(input("Enter the last number (nth term) of the P-Series"))
       _SCREAMING_SNAKE_CASE									=				int(input("Enter the power for  P-Series"))
       print("Formula of P-Series => 1+1/2^p+1/3^p ..... 1/n^p")
       print(p_series(nth_term, power))


