



"""simple docstring"""





import os




def 	UpperCAmelCase     (		A	:						str = "matrix.txt"       ):

		'''simple docstring'''


		with open(os.path.join(os.path.dirname(A       )     ,				A       )       ) as in_file:
				_UpperCAmelCase							 =		in_file.read()

		_UpperCAmelCase							 =		[[int(A       ) for cell in row.split(','       )] for row in data.strip().splitlines()]
		_UpperCAmelCase							 =		[[0 for cell in row] for row in grid]
		_UpperCAmelCase							 =		len(grid[0]       )

		_UpperCAmelCase							 =		[[0 for i in range(A       )] for j in range(A       )]
		_UpperCAmelCase							 =		grid[0][0]
		for i in range(1     ,				A       ):
				_UpperCAmelCase							 =		grid[0][i] + dp[0][i - 1]
		for i in range(1     ,				A       ):
				_UpperCAmelCase							 =		grid[i][0] + dp[i - 1][0]

		for i in range(1     ,				A       ):
				for j in range(1     ,				A       ):
						_UpperCAmelCase							 =		grid[i][j] + min(dp[i - 1][j]     ,				dp[i][j - 1]       )

		return dp[-1][-1]


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







"""simple docstring"""





from itertools import permutations




def 	UpperCAmelCase     (		A	:						tuple       ):

		'''simple docstring'''


		if num[3] % 2 != 0:
				return False

		if (num[2] + num[3] + num[4]) % 3 != 0:
				return False

		if num[5] % 5 != 0:
				return False

		_UpperCAmelCase							 =		[7, 11, 13, 17]
		for i, test in enumerate(A       ):
				if (num[i + 4] * 100 + num[i + 5] * 10 + num[i + 6]) % test != 0:
						return False
		return True




def 	UpperCAmelCase     (		A	:						int = 10       ):

		'''simple docstring'''


		return sum(
		    int(''.join(map(A     ,				A       )       )       )
		    for num in permutations(range(A       )       )
		    if is_substring_divisible(A       )       )


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


