

from __future__ import annotations

from collections.abc import Callable


def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__ = 100  ,		):
						snake_case_   =	x_start
						snake_case_   =	fnc(SCREAMING_SNAKE_CASE__       )
						snake_case_   =	0.0
						for _ in range(SCREAMING_SNAKE_CASE__       ):
												# Approximates small segments of curve as linear and solve
												# for trapezoidal area
												snake_case_   =	(x_end - x_start) / steps + xa
												snake_case_   =	fnc(SCREAMING_SNAKE_CASE__       )
												area += abs(fxa + fxa       ) * (xa - xa) / 2
												# Increment step
												snake_case_   =	xa
												snake_case_   =	fxa
						return area


if __name__ == "__main__":


					def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__       ):
											return x**3 + x**2

					print('''f(x) = x^3 + x^2''')
					print('''The area between the curve, x = -5, x = 5 and the x axis is:''')
					lowerCAmelCase_       	=	10
					while i <= 10_00_00:
										print(f"""with {i} steps: {trapezoidal_area(f, -5, 5, i)}""")
										i *= 10


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


def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__       ):

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

						snake_case_   =	precision
						snake_case_   =	ceil(precision / 14       )
						snake_case_   =	426880 * Decimal(10005       ).sqrt()
						snake_case_   =	1
						snake_case_   =	13591409
						snake_case_   =	Decimal(SCREAMING_SNAKE_CASE__       )
						for k in range(1  ,		SCREAMING_SNAKE_CASE__       ):
												snake_case_   =	factorial(6 * k       ) // (factorial(3 * k       ) * factorial(SCREAMING_SNAKE_CASE__       ) ** 3)
												linear_term += 545140134
												exponential_term *= -262537412640768000
												partial_sum += Decimal(multinomial_term * linear_term       ) / exponential_term
						return str(constant_term / partial_sum       )[:-1]


if __name__ == "__main__":
					lowerCAmelCase_       	=	50
					print(f"""The first {n} digits of pi is: {pi(n)}""")