
'''simple docstring'''



import os


def A				(__lowerCamelCase				:str = "matrix.txt"		):
						with open(os.path.join(os.path.dirname(__lowerCamelCase		)			,     __lowerCamelCase		)		) as in_file:
												_lowerCAmelCase  						=			in_file.read()

						_lowerCAmelCase  						=			[[int(__lowerCamelCase		) for cell in row.split(""","""		)] for row in data.strip().splitlines()]
						_lowerCAmelCase  						=			[[0 for cell in row] for row in grid]
						_lowerCAmelCase  						=			len(grid[0]		)

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

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

						return dp[-1][-1]


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


'''simple docstring'''



def A				(__lowerCamelCase				:list[int]			,     __lowerCamelCase				:list[int]		):

						# Check if the input is valid
						if not len(__lowerCamelCase		) == len(__lowerCamelCase		) == 3:
												raise ValueError("""Please enter a valid equation."""		)
						if equationa[0] == equationa[1] == equationa[0] == equationa[1] == 0:
												raise ValueError("""Both a & b of two equations can't be zero."""		)

						# Extract the coefficients
						_lowerCAmelCase						,   _lowerCAmelCase						,   _lowerCAmelCase  						=			equationa
						_lowerCAmelCase						,   _lowerCAmelCase						,   _lowerCAmelCase  						=			equationa

						# Calculate the determinants of the matrices
						_lowerCAmelCase  						=			aa * ba - aa * ba
						_lowerCAmelCase  						=			ca * ba - ca * ba
						_lowerCAmelCase  						=			aa * ca - aa * ca

						# Check if the system of linear equations has a solution (using Cramer's rule)
						if determinant == 0:
												if determinant_x == determinant_y == 0:
																		raise ValueError("""Infinite solutions. (Consistent system)"""		)
												else:
																		raise ValueError("""No solution. (Inconsistent system)"""		)
						else:
												if determinant_x == determinant_y == 0:
																		# Trivial solution (Inconsistent system)
																		return (0.0, 0.0)
												else:
																		_lowerCAmelCase  						=			determinant_x / determinant
																		_lowerCAmelCase  						=			determinant_y / determinant
																		# Non-Trivial Solution (Consistent system)
																		return (x, y)
