"""simple docstring"""






def 			UpperCAmelCase__       (				lowerCAmelCase__     :int		) ->    int:
      '''simple docstring'''


      lowercase														=	0
      while num > 0:
            digit_sum += num % 1_0
            num //= 1_0
      return digit_sum


def 			UpperCAmelCase__       (				lowerCAmelCase__     :int = 1_0_0		) ->    int:
      '''simple docstring'''


      lowercase														=	1
      lowercase														=	2

      for i in range(2					,		max_n + 1		):
            lowercase														=	pre_numerator
            lowercase														=	2 * i // 3 if i % 3 == 0 else 1
            lowercase														=	cur_numerator
            lowercase														=	e_cont * pre_numerator + temp

      return sum_digits(lowerCAmelCase__		)


if __name__ == "__main__":
       print(F"""{solution() = }""")




"""simple docstring"""






from decimal import Decimal, getcontext
from math import ceil, factorial


def 			UpperCAmelCase__       (				lowerCAmelCase__     :int		) ->    str:
      '''simple docstring'''


      if not isinstance(lowerCAmelCase__					,		lowerCAmelCase__		):
            raise TypeError("""Undefined for non-integers"""		)
      elif precision < 1:
            raise ValueError("""Undefined for non-natural numbers"""		)

      lowercase														=	precision
      lowercase														=	ceil(precision / 1_4		)
      lowercase														=	4_2_6_8_8_0 * Decimal(1_0_0_0_5		).sqrt()
      lowercase														=	1
      lowercase														=	1_3_5_9_1_4_0_9
      lowercase														=	Decimal(lowerCAmelCase__		)
      for k in range(1					,		lowerCAmelCase__		):
            lowercase														=	factorial(6 * k		) // (factorial(3 * k		) * factorial(lowerCAmelCase__		) ** 3)
            linear_term += 5_4_5_1_4_0_1_3_4
            exponential_term *= -2_6_2_5_3_7_4_1_2_6_4_0_7_6_8_0_0_0
            partial_sum += Decimal(multinomial_term * linear_term		) / exponential_term
      return str(constant_term / partial_sum		)[:-1]


if __name__ == "__main__":
       __lowerCAmelCase    :       List[Any]					     =5_0
       print(F"""The first {n} digits of pi is: {pi(n)}""")



