

'''simple docstring'''

from __future__ import annotations

from typing import Any






class    snake_case     :






				"""simple docstring"""



				def __init__(    self,     _lowercase,     _lowercase,     _lowercase = 0       )     ->							None:
											SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				row, column
											SCREAMING_SNAKE_CASE_				=				[[default_value for c in range(_lowercase       )] for r in range(_lowercase       )]



				def __str__(    self       )     ->							str:
											SCREAMING_SNAKE_CASE_				=				f"""Matrix consist of {self.row} rows and {self.column} columns\n"""

											# Make string identifier
											SCREAMING_SNAKE_CASE_				=				0
											for row_vector in self.array:
																		for obj in row_vector:
																									SCREAMING_SNAKE_CASE_				=				max(_lowercase,     len(str(_lowercase       )       )       )
											SCREAMING_SNAKE_CASE_				=				f"""%{max_element_length}s"""

											# Make string and return
											def single_line(_lowercase       ) -> str:
																		nonlocal string_format_identifier
																		SCREAMING_SNAKE_CASE_				=				'['
																		line += ", ".join(string_format_identifier % (obj,) for obj in row_vector       )
																		line += "]"
																		return line

											s += "\n".join(single_line(_lowercase       ) for row_vector in self.array       )
											return s



				def __repr__(    self       )     ->							str:
											return str(self       )



				def   a__					(    self,     _lowercase       )     ->							bool:
											if not (isinstance(_lowercase,     (list, tuple)       ) and len(_lowercase       ) == 2):
																		return False
											elif not (0 <= loc[0] < self.row and 0 <= loc[1] < self.column):
																		return False
											else:
																		return True



				def __getitem__(    self,     _lowercase       )     ->							Any:
											assert self.validate_indicies(_lowercase       )
											return self.array[loc[0]][loc[1]]



				def __setitem__(    self,     _lowercase,     _lowercase       )     ->							None:
											assert self.validate_indicies(_lowercase       )
											SCREAMING_SNAKE_CASE_				=				value



				def __add__(    self,     _lowercase       )     ->							Matrix:
											assert isinstance(_lowercase,     _lowercase       )
											assert self.row == another.row and self.column == another.column

											# Add
											SCREAMING_SNAKE_CASE_				=				Matrix(self.row,     self.column       )
											for r in range(self.row       ):
																		for c in range(self.column       ):
																									SCREAMING_SNAKE_CASE_				=				self[r, c] + another[r, c]
											return result



				def __neg__(    self       )     ->							Matrix:
											SCREAMING_SNAKE_CASE_				=				Matrix(self.row,     self.column       )
											for r in range(self.row       ):
																		for c in range(self.column       ):
																									SCREAMING_SNAKE_CASE_				=				-self[r, c]
											return result



				def __sub__(    self,     _lowercase       )     ->							Matrix:
											return self + (-another)



				def __mul__(    self,     _lowercase       )     ->							Matrix:

											if isinstance(_lowercase,     (int, float)       ):  # Scalar multiplication
																		SCREAMING_SNAKE_CASE_				=				Matrix(self.row,     self.column       )
																		for r in range(self.row       ):
																									for c in range(self.column       ):
																																SCREAMING_SNAKE_CASE_				=				self[r, c] * another
																		return result
											elif isinstance(_lowercase,     _lowercase       ):  # Matrix multiplication
																		assert self.column == another.row
																		SCREAMING_SNAKE_CASE_				=				Matrix(self.row,     another.column       )
																		for r in range(self.row       ):
																									for c in range(another.column       ):
																																for i in range(self.column       ):
																																							result[r, c] += self[r, i] * another[i, c]
																		return result
											else:
																		SCREAMING_SNAKE_CASE_				=				f"""Unsupported type given for another ({type(_lowercase       )})"""
																		raise TypeError(_lowercase       )



				def   a__					(    self       )     ->							Matrix:
											SCREAMING_SNAKE_CASE_				=				Matrix(self.column,     self.row       )
											for r in range(self.row       ):
																		for c in range(self.column       ):
																									SCREAMING_SNAKE_CASE_				=				self[r, c]
											return result





				def   a__					(    self,     _lowercase,     _lowercase       )     ->							Any:
											assert isinstance(_lowercase,     _lowercase       ) and isinstance(_lowercase,     _lowercase       )
											assert self.row == self.column == u.row == v.row  # u, v should be column vector
											assert u.column == v.column == 1  # u, v should be column vector

											# Calculate
											SCREAMING_SNAKE_CASE_				=				v.transpose()
											SCREAMING_SNAKE_CASE_				=				(v_t * self * u)[0, 0] + 1
											if numerator_factor == 0:
																		return None  # It's not invertable
											return self - ((self * u) * (v_t * self) * (1.0 / numerator_factor))


# Testing
if __name__ == "__main__":




							def 							_UpperCamelCase				(   )      -> None:
														# a^(-1)
														SCREAMING_SNAKE_CASE_				=				Matrix(3		,3		,0   )
														for i in range(3   ):
																					SCREAMING_SNAKE_CASE_				=				1
														print(F"""a^(-1) is {ainv}"""   )
														# u, v
														SCREAMING_SNAKE_CASE_				=				Matrix(3		,1		,0   )
														SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				1, 2, -3
														SCREAMING_SNAKE_CASE_				=				Matrix(3		,1		,0   )
														SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				,    SCREAMING_SNAKE_CASE_				=				4, -2, 5
														print(F"""u is {u}"""   )
														print(F"""v is {v}"""   )
														print(F"""uv^T is {u * v.transpose()}"""   )
														# Sherman Morrison
														print(F"""(a + uv^T)^(-1) is {ainv.sherman_morrison(lowerCAmelCase__		,lowerCAmelCase__   )}"""   )




							def 							_UpperCamelCase				(   )      -> None:
														import doctest

														doctest.testmod()




							testa()








'''simple docstring'''

from math import factorial




def 							_UpperCamelCase				(   lowerCAmelCase__:					int = 100   )      -> int:
							return sum(map(lowerCAmelCase__		,str(factorial(lowerCAmelCase__   )   )   )   )


if __name__ == "__main__":
							print(solution(int(input("Enter the Number: ").strip())))





