
def 				A	( lowercase			)       ->  int:
		'''simple docstring'''

		if not grid or not grid[0]:
				raise TypeError('The grid does not contain the appropriate information'			)

		for cell_n in range(1   ,	len(grid[0]			)			):
				grid[0][cell_n] += grid[0][cell_n - 1]
		UpperCamelCase          =					grid[0]

		for row_n in range(1   ,	len(lowercase			)			):
				UpperCamelCase          =					grid[row_n]
				UpperCamelCase          =					fill_row(lowercase   ,	lowercase			)
				UpperCamelCase          =					grid[row_n]

		return grid[-1][-1]


def 				A	( lowercase   ,	lowercase			)       ->  list:
		'''simple docstring'''

		current_row[0] += row_above[0]
		for cell_n in range(1   ,	len(lowercase			)			):
				current_row[cell_n] += min(current_row[cell_n - 1]   ,	row_above[cell_n]			)

		return current_row


if __name__ == "__main__":
					import doctest

					doctest.testmod()


from __future__ import annotations


def 				A	( lowercase   ,	lowercase			)       ->  tuple[int, int]:
		'''simple docstring'''

		if b == 0:
				return (1, 0)
		((UpperCamelCase)     ,  (UpperCamelCase))          =					extended_euclid(lowercase   ,	a % b			)
		UpperCamelCase          =					a // b
		return (y, x - k * y)


def 				A	( lowercase   ,	lowercase   ,	lowercase   ,	lowercase			)       ->  int:
		'''simple docstring'''

		((UpperCamelCase)     ,  (UpperCamelCase))          =					extended_euclid(lowercase   ,	lowercase			)
		UpperCamelCase          =					na * na
		UpperCamelCase          =					ra * x * na + ra * y * na
		return (n % m + m) % m


def 				A	( lowercase   ,	lowercase			)       ->  int:
		'''simple docstring'''

		((UpperCamelCase)     ,  (UpperCamelCase))          =					extended_euclid(lowercase   ,	lowercase			)
		if b < 0:
				UpperCamelCase          =					(b % n + n) % n
		return b


def 				A	( lowercase   ,	lowercase   ,	lowercase   ,	lowercase			)       ->  int:
		'''simple docstring'''

		UpperCamelCase     ,  UpperCamelCase          =					invert_modulo(lowercase   ,	lowercase			), invert_modulo(lowercase   ,	lowercase			)
		UpperCamelCase          =					na * na
		UpperCamelCase          =					ra * x * na + ra * y * na
		return (n % m + m) % m


if __name__ == "__main__":
					from doctest import testmod

					testmod(name="chinese_remainder_theorem", verbose=True)
					testmod(name="chinese_remainder_theorem2", verbose=True)
					testmod(name="invert_modulo", verbose=True)
					testmod(name="extended_euclid", verbose=True)
