




'''simple docstring'''



def    lowercase__(       __UpperCamelCase: List[str]  ):

      """simple docstring"""






      SCREAMING_SNAKE_CASE					:	Any   =		1
      for i in range(1	,num + 1  ):
            fact *= i
      return fact




def    lowercase__(       __UpperCamelCase: int  ):

      """simple docstring"""






      SCREAMING_SNAKE_CASE					:	Optional[Any]   =		0
      while number > 0:
            SCREAMING_SNAKE_CASE					:	Optional[Any]   =		number % 10
            sum_of_digits += last_digit
            SCREAMING_SNAKE_CASE					:	str   =		number // 10  # Removing the last_digit from the given number
      return sum_of_digits




def    lowercase__(       __UpperCamelCase: str = 1_00  ):

      """simple docstring"""






      SCREAMING_SNAKE_CASE					:	Dict   =		factorial(__UpperCamelCase  )
      SCREAMING_SNAKE_CASE					:	Dict   =		split_and_add(__UpperCamelCase  )
      return result


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



import numpy as np



def lowerCamelCase  (   SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE = 1e-12  ,			SCREAMING_SNAKE_CASE = 100  ,			):
    '''simple docstring'''







    assert np.shape(SCREAMING_SNAKE_CASE	)[0] == np.shape(SCREAMING_SNAKE_CASE	)[1]
    # Ensure proper dimensionality.
    assert np.shape(SCREAMING_SNAKE_CASE	)[0] == np.shape(SCREAMING_SNAKE_CASE	)[0]
    # Ensure inputs are either both complex or both real
    assert np.iscomplexobj(SCREAMING_SNAKE_CASE	) == np.iscomplexobj(SCREAMING_SNAKE_CASE	)
    __UpperCamelCase     :List[Any]			  =		np.iscomplexobj(SCREAMING_SNAKE_CASE	)
    if is_complex:
        # Ensure complex input_matrix is Hermitian
        assert np.array_equal(SCREAMING_SNAKE_CASE  ,			input_matrix.conj().T	)

    # Set convergence to False. Will define convergence when we exceed max_iterations
    # or when we have small changes from one iteration to next.

    __UpperCamelCase     :str			  =		False
    __UpperCamelCase     :int			  =		0
    __UpperCamelCase     :Optional[Any]			  =		0
    __UpperCamelCase     :Union[str, Any]			  =		1e12

    while not convergence:
        # Multiple matrix by the vector.
        __UpperCamelCase     :List[str]			  =		np.dot(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)
        # Normalize the resulting output vector.
        __UpperCamelCase     :Tuple			  =		w / np.linalg.norm(SCREAMING_SNAKE_CASE	)
        # Find rayleigh quotient
        # (faster than usual b/c we know vector is normalized already)
        __UpperCamelCase     :int			  =		vector.conj().T if is_complex else vector.T
        __UpperCamelCase     :Optional[int]			  =		np.dot(SCREAMING_SNAKE_CASE  ,			np.dot(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)	)

        # Check convergence.
        __UpperCamelCase     :Optional[Any]			  =		np.abs(lambda_ - lambda_previous	) / lambda_
        iterations += 1

        if error <= error_tol or iterations >= max_iterations:
            __UpperCamelCase     :Dict			  =		True

        __UpperCamelCase     :List[Any]			  =		lambda_

    if is_complex:
        __UpperCamelCase     :Tuple			  =		np.real(lambda_	)

    return lambda_, vector



def lowerCamelCase  (   ):
    '''simple docstring'''







    __UpperCamelCase     :int			  =		np.array([[41, 4, 20], [4, 26, 30], [20, 30, 50]]	)
    __UpperCamelCase     :Optional[Any]			  =		np.array([41, 4, 20]	)
    __UpperCamelCase     :Any			  =		real_input_matrix.astype(np.complexaaa	)
    __UpperCamelCase     :Dict			  =		np.triu(1j * complex_input_matrix  ,			1	)
    complex_input_matrix += imag_matrix
    complex_input_matrix += -1 * imag_matrix.T
    __UpperCamelCase     :Optional[int]			  =		np.array([41, 4, 20]	).astype(np.complexaaa	)

    for problem_type in ["real", "complex"]:
        if problem_type == "real":
            __UpperCamelCase     :Any			  =		real_input_matrix
            __UpperCamelCase     :int			  =		real_vector
        elif problem_type == "complex":
            __UpperCamelCase     :Tuple			  =		complex_input_matrix
            __UpperCamelCase     :Optional[Any]			  =		complex_vector

        # Our implementation.
        __UpperCamelCase  ,       __UpperCamelCase     :Dict			  =		power_iteration(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)

        # Numpy implementation.

        # Get eigenvalues and eigenvectors using built-in numpy
        # eigh (eigh used for symmetric or hermetian matrices).
        __UpperCamelCase  ,       __UpperCamelCase     :List[Any]			  =		np.linalg.eigh(SCREAMING_SNAKE_CASE	)
        # Last eigenvalue is the maximum one.
        __UpperCamelCase     :List[Any]			  =		eigen_values[-1]
        # Last column in this matrix is eigenvector corresponding to largest eigenvalue.
        __UpperCamelCase     :str			  =		eigen_vectors[:, -1]

        # Check our implementation and numpy gives close answers.
        assert np.abs(eigen_value - eigen_value_max	) <= 1e-6
        # Take absolute values element wise of each eigenvector.
        # as they are only unique to a minus sign.
        assert np.linalg.norm(np.abs(SCREAMING_SNAKE_CASE	) - np.abs(SCREAMING_SNAKE_CASE	)	) <= 1e-6


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    test_power_iteration()





