




from __future__ import annotations

from typing import Any







def       _a (		*SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					if all(_check_not_integer(SCREAMING_SNAKE_CASE_	) for m in matrix_s	):
										for i in matrix_s[1:]:
															_verify_matrix_sizes(matrix_s[0] , SCREAMING_SNAKE_CASE_	)
										return [[sum(SCREAMING_SNAKE_CASE_	) for t in zip(*SCREAMING_SNAKE_CASE_	)] for m in zip(*SCREAMING_SNAKE_CASE_	)]
					raise TypeError("Expected a matrix, got int/list instead"	)







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]] , SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					if (
					    _check_not_integer(SCREAMING_SNAKE_CASE_	)
					    and _check_not_integer(SCREAMING_SNAKE_CASE_	)
					    and _verify_matrix_sizes(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	)
					):
										return [[i - j for i, j in zip(*SCREAMING_SNAKE_CASE_	)] for m in zip(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	)]
					raise TypeError("Expected a matrix, got int/list instead"	)







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]] , SCREAMING_SNAKE_CASE_				:							int | float	):
					return [[x * n for x in row] for row in matrix]







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]] , SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					if _check_not_integer(SCREAMING_SNAKE_CASE_	) and _check_not_integer(SCREAMING_SNAKE_CASE_	):
										__lowerCAmelCase  ,				__lowerCAmelCase							  =			_verify_matrix_sizes(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	)

					if cols[0] != rows[1]:
										__lowerCAmelCase							  =			(
										    "Cannot multiply matrix of dimensions "
										    F"""({rows[0]},{cols[0]}) and ({rows[1]},{cols[1]})"""
										)
										raise ValueError(SCREAMING_SNAKE_CASE_	)
					return [
					    [sum(m * n for m, n in zip(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	)	) for j in zip(*SCREAMING_SNAKE_CASE_	)] for i in matrix_a
					]







def       _a (		SCREAMING_SNAKE_CASE_				:							int	):
					__lowerCAmelCase							  =			int(SCREAMING_SNAKE_CASE_	)
					return [[int(row == column	) for column in range(SCREAMING_SNAKE_CASE_	)] for row in range(SCREAMING_SNAKE_CASE_	)]







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]] , SCREAMING_SNAKE_CASE_				:							bool = True	):
					if _check_not_integer(SCREAMING_SNAKE_CASE_	):
										if return_map:
															return map(SCREAMING_SNAKE_CASE_ , zip(*SCREAMING_SNAKE_CASE_	)	)
										else:
															return list(map(SCREAMING_SNAKE_CASE_ , zip(*SCREAMING_SNAKE_CASE_	)	)	)
					raise TypeError("Expected a matrix, got int/list instead"	)







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]] , SCREAMING_SNAKE_CASE_				:							int , SCREAMING_SNAKE_CASE_				:							int	):
					__lowerCAmelCase							  =			matrix[:row] + matrix[row + 1 :]
					return [row[:column] + row[column + 1 :] for row in minor]







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					if len(SCREAMING_SNAKE_CASE_	) == 1:
										return matrix[0][0]

					return sum(
					    x * determinant(minor(SCREAMING_SNAKE_CASE_ , 0 , SCREAMING_SNAKE_CASE_	)	) * (-1) ** i
					    for i, x in enumerate(matrix[0]	)	)







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					__lowerCAmelCase							  =			determinant(SCREAMING_SNAKE_CASE_	)
					if det == 0:
										return None

					__lowerCAmelCase							  =			[
					    [determinant(minor(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	)	) for j in range(len(SCREAMING_SNAKE_CASE_	)	)]
					    for i in range(len(SCREAMING_SNAKE_CASE_	)	)
					]

					__lowerCAmelCase							  =			[
					    [x * (-1) ** (row + col) for col, x in enumerate(matrix_minor[row]	)]
					    for row in range(len(SCREAMING_SNAKE_CASE_	)	)
					]
					__lowerCAmelCase							  =			list(transpose(SCREAMING_SNAKE_CASE_	)	)
					return scalar_multiply(SCREAMING_SNAKE_CASE_ , 1 / det	)







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					return not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	) and not isinstance(matrix[0] , SCREAMING_SNAKE_CASE_	)







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					return len(SCREAMING_SNAKE_CASE_	), len(matrix[0]	)







def       _a (		SCREAMING_SNAKE_CASE_				:							list[list[int]] , SCREAMING_SNAKE_CASE_				:							list[list[int]]	):
					__lowerCAmelCase							  =			_shape(SCREAMING_SNAKE_CASE_	) + _shape(SCREAMING_SNAKE_CASE_	)
					if shape[0] != shape[3] or shape[1] != shape[2]:
										__lowerCAmelCase							  =			(
										    "operands could not be broadcast together with shape "
										    F"""({shape[0], shape[1]}), ({shape[2], shape[3]})"""
										)
										raise ValueError(SCREAMING_SNAKE_CASE_	)
					return (shape[0], shape[2]), (shape[1], shape[3])







def       _a (		):
					__lowerCAmelCase							  =			[[12, 10], [3, 9]]
					__lowerCAmelCase							  =			[[3, 4], [7, 4]]
					__lowerCAmelCase							  =			[[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34], [41, 42, 43, 44]]
					__lowerCAmelCase							  =			[[3, 0, 2], [2, 0, -2], [0, 1, 1]]
					print(F"""Add Operation, {add(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	) = } \n"""	)
					print(
					    F"""Multiply Operation, {multiply(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_	) = } \n""" , )
					print(F"""Identity: {identity(5	)}\n"""	)
					print(F"""Minor of {matrix_c} = {minor(SCREAMING_SNAKE_CASE_ , 1 , 2	)} \n"""	)
					print(F"""Determinant of {matrix_b} = {determinant(SCREAMING_SNAKE_CASE_	)} \n"""	)
					print(F"""Inverse of {matrix_d} = {inverse(SCREAMING_SNAKE_CASE_	)}\n"""	)


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					main()










import decimal







def       _a (		):
					__lowerCAmelCase							  =			0
					__lowerCAmelCase							  =			decimal.Context(prec=1_05	)
					for i in range(2 , 1_00	):
										__lowerCAmelCase							  =			decimal.Decimal(SCREAMING_SNAKE_CASE_	)
										__lowerCAmelCase							  =			number.sqrt(SCREAMING_SNAKE_CASE_	)
										if len(str(SCREAMING_SNAKE_CASE_	)	) > 1:
															answer += int(str(SCREAMING_SNAKE_CASE_	)[0]	)
															__lowerCAmelCase							  =			str(SCREAMING_SNAKE_CASE_	)[2:1_01]
															answer += sum(int(SCREAMING_SNAKE_CASE_	) for x in sqrt_number_str	)
					return answer


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					print(f'''{solution() = }''')




