






'''simple docstring'''
import sys





def 	_a(					UpperCamelCase__			:  Optional[int]							):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__       :			Dict													=len(UpperCamelCase__							)
      SCREAMING_SNAKE_CASE__       :			Tuple													=[[0 for x in range(UpperCamelCase__							)] for x in range(UpperCamelCase__							)]
      SCREAMING_SNAKE_CASE__       :			Tuple													=[[0 for x in range(UpperCamelCase__							)] for x in range(UpperCamelCase__							)]

      for chain_length in range(2,		UpperCamelCase__							):
            for a in range(1,		n - chain_length + 1							):
                  SCREAMING_SNAKE_CASE__       :			str													=a + chain_length - 1

                  SCREAMING_SNAKE_CASE__       :			List[str]													=sys.maxsize
                  for c in range(UpperCamelCase__,		UpperCamelCase__							):
                        SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=(
                            matrix[a][c] + matrix[c + 1][b] + array[a - 1] * array[c] * array[b]
                        )
                        if cost < matrix[a][b]:
                              SCREAMING_SNAKE_CASE__       :			Optional[Any]													=cost
                              SCREAMING_SNAKE_CASE__       :			Any													=c
      return matrix, sol





def 	_a(					UpperCamelCase__			:  Any,		UpperCamelCase__			:  Optional[int],		UpperCamelCase__			:  Union[str, Any]							):




      '''simple docstring'''






      if i == j:
            print('''A''' + str(UpperCamelCase__							),		end=''' '''							)
      else:
            print('''(''',		end=''' '''							)
            print_optiomal_solution(UpperCamelCase__,		UpperCamelCase__,		optimal_solution[i][j]							)
            print_optiomal_solution(UpperCamelCase__,		optimal_solution[i][j] + 1,		UpperCamelCase__							)
            print(''')''',		end=''' '''							)





def 	_a(					):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__       :			int													=[3_0, 3_5, 1_5, 5, 1_0, 2_0, 2_5]
      SCREAMING_SNAKE_CASE__       :			Tuple													=len(UpperCamelCase__							)
      # Size of matrix created from above array will be
      # 30*35 35*15 15*5 5*10 10*20 20*25
      SCREAMING_SNAKE_CASE__						,		SCREAMING_SNAKE_CASE__       :			List[str]													=matrix_chain_order(UpperCamelCase__							)

      print('''No. of Operation required: ''' + str(matrix[1][n - 1]							)							)
      print_optiomal_solution(UpperCamelCase__,		1,		n - 1							)


if __name__ == "__main__":
  main()







'''simple docstring'''
from decimal import Decimal, getcontext
from math import ceil, factorial





def 	_a(					UpperCamelCase__			:  int							):




      '''simple docstring'''






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

      SCREAMING_SNAKE_CASE__       :			Optional[Any]													=precision
      SCREAMING_SNAKE_CASE__       :			int													=ceil(precision / 1_4							)
      SCREAMING_SNAKE_CASE__       :			int													=4_2_6_8_8_0 * Decimal(1_0_0_0_5							).sqrt()
      SCREAMING_SNAKE_CASE__       :			Tuple													=1
      SCREAMING_SNAKE_CASE__       :			Any													=1_3_5_9_1_4_0_9
      SCREAMING_SNAKE_CASE__       :			List[Any]													=Decimal(UpperCamelCase__							)
      for k in range(1,		UpperCamelCase__							):
            SCREAMING_SNAKE_CASE__       :			str													=factorial(6 * k							) // (factorial(3 * k							) * factorial(UpperCamelCase__							) ** 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__":
  a_					=	5_0
  print(F'''The first {n} digits of pi is: {pi(n)}''')