
'''simple docstring'''
from __future__ import annotations

from collections.abc import Iterable
from dataclasses import dataclass
from typing import Any






class  UpperCAmelCase_					:
 UpperCAmelCase_		     =    ("""_front""", """_back""", """_len""")






 @dataclass
 class  UpperCAmelCase_					:
  UpperCAmelCase_		     =    None
  UpperCAmelCase_		     =    None
  UpperCAmelCase_		     =    None






 class  UpperCAmelCase_					:
  UpperCAmelCase_		     =    ("""_cur""",)





  def __init__(     self			,							lowercase_):
      snake_case_			:     int        =    cur





  def __iter__(     self):
      return self





  def 							snake_case__		(     self):
      if self._cur is None:
          # finished iterating
          raise StopIteration
      snake_case_			:     List[Any]        =    self._cur.val
      snake_case_			:     Optional[Any]        =    self._cur.next_node

      return val





 def __init__(     self			,							lowercase_ = None):
     snake_case_			:     Any        =    None
     snake_case_			:     Any        =    None
     snake_case_			:     int        =    0

     if iterable is not None:
         # append every value to the deque
         for val in iterable:
             self.append(lowercase_)





 def 							snake_case__		(     self			,							lowercase_):
     snake_case_			:     str        =    self._Node(lowercase_			,							lowercase_			,							lowercase_)
     if self.is_empty():
         # front = back
         snake_case_			:     Dict        =    node
         snake_case_			:     Optional[Any]        =    1
     else:
         # connect nodes
         snake_case_			:     int        =    node
         snake_case_			:     List[str]        =    self._back
         snake_case_			:     int        =    node  # assign new back to the new node

         self._len += 1

         # make sure there were no errors
         assert not self.is_empty(), "Error on appending value."





 def 							snake_case__		(     self			,							lowercase_):
     snake_case_			:     Union[str, Any]        =    self._Node(lowercase_			,							lowercase_			,							lowercase_)
     if self.is_empty():
         # front = back
         snake_case_			:     List[Any]        =    node
         snake_case_			:     Tuple        =    1
     else:
         # connect nodes
         snake_case_			:     str        =    self._front
         snake_case_			:     str        =    node
         snake_case_			:     Optional[Any]        =    node  # assign new front to the new node

         self._len += 1

         # make sure there were no errors
         assert not self.is_empty(), "Error on appending value."





 def 							snake_case__		(     self			,							lowercase_):
     for val in iterable:
         self.append(lowercase_)





 def 							snake_case__		(     self			,							lowercase_):
     for val in iterable:
         self.appendleft(lowercase_)





 def 							snake_case__		(     self):
     assert not self.is_empty(), "Deque is empty."

     snake_case_			:     Tuple        =    self._back
     snake_case_			:     str        =    self._back.prev_node  # set new back
     # drop the last node - python will deallocate memory automatically
     snake_case_			:     List[Any]        =    None

     self._len -= 1

     return topop.val





 def 							snake_case__		(     self):
     assert not self.is_empty(), "Deque is empty."

     snake_case_			:     Tuple        =    self._front
     snake_case_			:     int        =    self._front.next_node  # set new front and drop the first node
     snake_case_			:     List[Any]        =    None

     self._len -= 1

     return topop.val





 def 							snake_case__		(     self):
     return self._front is None





 def __len__(     self):
     return self._len





 def __eq__(     self			,							lowercase_):

     if not isinstance(lowercase_			,							lowercase_):
         return NotImplemented

     snake_case_			:     List[Any]        =    self._front
     snake_case_			:     List[Any]        =    other._front

     # if the length of the dequeues are not the same, they are not equal
     if len(self) != len(lowercase_):
         return False

     while me is not None and oth is not None:
         # compare every value
         if me.val != oth.val:
             return False
         snake_case_			:     List[Any]        =    me.next_node
         snake_case_			:     List[str]        =    oth.next_node

     return True





 def __iter__(     self):
     return Deque._Iterator(self._front)





 def __repr__(     self):
     snake_case_			:     Optional[int]        =    []
     snake_case_			:     Union[str, Any]        =    self._front
     while aux is not None:
         # append the values in a list to display
         values_list.append(aux.val)
         snake_case_			:     Union[str, Any]        =    aux.next_node

     return F'[{", ".join(repr(lowercase_) for val in values_list)}]'


if __name__ == "__main__":
  import doctest

  doctest.testmod()






'''simple docstring'''
def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if number != int(__SCREAMING_SNAKE_CASE							):
        raise ValueError("factorial() only accepts integral values"							)
    if number < 0:
        raise ValueError("factorial() not defined for negative values"							)
    snake_case_			:     int        =    1
    for i in range(1,		number + 1							):
        value *= i
    return value

def     UpperCamelCase_  (						__SCREAMING_SNAKE_CASE							):
    """simple docstring"""






    if not isinstance(__SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							):
        raise ValueError("factorial() only accepts integral values"							)
    if n < 0:
        raise ValueError("factorial() not defined for negative values"							)
    return 1 if n == 0 or n == 1 else n * factorial(n - 1							)


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  a_           =    int(input("Enter a positive integer: ").strip() or 0)
  print(f"""factorial{n} is {factorial(n)}""")




