"""simple docstring"""







import json
import os
import unittest

from transformers import MgpstrTokenizer
from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin

@require_tokenizers
class 		UpperCamelCase      (   lowercase				,     unittest.TestCase						):
				UpperCAmelCase    :				List[Any]   =		MgpstrTokenizer
				UpperCAmelCase    :				int   =		False
				UpperCAmelCase    :				int   =		{}
				UpperCAmelCase    :				List[str]   =		False



				def  _lowercase					(self    :				Optional[int])   ->     int:
					super().setUp()

					# fmt: off
					__snake_case      :							Any						=			['[GO]', '[s]', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
					# fmt: on
					__snake_case      :							int						=			dict(zip(_A     ,  range(len(_A))))

					__snake_case      :							int						=			os.path.join(self.tmpdirname     ,  VOCAB_FILES_NAMES['vocab_file'])
					with open(self.vocab_file     ,  'w'     ,  encoding='utf-8') as fp:
						fp.write(json.dumps(_A) + '\n')



				def  _lowercase					(self    :				Union[str, Any]     ,  **_A    :				str)   ->     Optional[int]:
					return MgpstrTokenizer.from_pretrained(self.tmpdirname     ,  **_A)



				def  _lowercase					(self    :				Tuple     ,  _A    :				Optional[int])   ->     Optional[int]:
					__snake_case      :							Optional[Any]						=			'tester'
					__snake_case      :							Dict						=			'tester'
					return input_text, output_text



				@unittest.skip('MGP-STR always lower cases letters.')
				def  _lowercase					(self    :				Union[str, Any])   ->     List[Any]:
					pass



				def  _lowercase					(self    :				str)   ->     Any:
					__snake_case      :							Optional[Any]						=			self.get_tokenizers(do_lower_case=_A)
					for tokenizer in tokenizers:
						with self.subTest(f"{tokenizer.__class__.__name__}"):
							__snake_case      :							int						=			'[SPECIAL_TOKEN]'

							tokenizer.add_special_tokens({'cls_token': special_token})
							__snake_case      :							Optional[Any]						=			tokenizer.encode([special_token]     ,  add_special_tokens=_A)
							self.assertEqual(len(_A)     ,  1)

							__snake_case      :							Optional[Any]						=			tokenizer.decode(_A     ,  skip_special_tokens=_A)
							self.assertTrue(special_token not in decoded)



				def  _lowercase					(self    :				Optional[Any])   ->     List[str]:
					__snake_case      :							Any						=			self.get_tokenizers()
					for tokenizer in tokenizers:
						with self.subTest(f"{tokenizer.__class__.__name__}"):
							__snake_case		,    __snake_case      :							Optional[Any]						=			self.get_input_output_texts(_A)

							__snake_case      :							List[Any]						=			tokenizer.tokenize(_A)
							__snake_case      :							str						=			tokenizer.convert_tokens_to_ids(_A)
							__snake_case      :							Any						=			tokenizer.encode(_A     ,  add_special_tokens=_A)
							self.assertListEqual(_A     ,  _A)

							__snake_case      :							Tuple						=			tokenizer.convert_ids_to_tokens(_A)
							self.assertNotEqual(len(_A)     ,  0)
							__snake_case      :							List[str]						=			tokenizer.decode(_A)
							self.assertIsInstance(_A     ,  _A)

							self.assertEqual(text_a.replace(' '     ,  '')     ,  _A)



				@unittest.skip('MGP-STR tokenizer only handles one sequence.')
				def  _lowercase					(self    :				List[str])   ->     Union[str, Any]:
					pass






				@unittest.skip('inputs cannot be pretokenized in MgpstrTokenizer')
				def  _lowercase					(self    :				Any)   ->     Optional[int]:
					pass






"""simple docstring"""







from decimal import Decimal, getcontext
from math import ceil, factorial
def   __UpperCAmelCase    (   UpperCAmelCase_   :    int  )							->      str:

	'''simple docstring'''





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

	__snake_case      :							Any						=			precision
	__snake_case      :							Optional[int]						=			ceil(precision / 14  )
	__snake_case      :							List[Any]						=			42_68_80 * Decimal(1_00_05  ).sqrt()
	__snake_case      :							Optional[Any]						=			1
	__snake_case      :							Union[str, Any]						=			13_59_14_09
	__snake_case      :							int						=			Decimal(UpperCAmelCase_  )
	for k in range(1      ,							UpperCAmelCase_  ):
		__snake_case      :							Union[str, Any]						=			factorial(6 * k  ) // (factorial(3 * k  ) * factorial(UpperCAmelCase_  ) ** 3)
		linear_term += 5_45_14_01_34
		exponential_term *= -26_25_37_41_26_40_76_80_00
		partial_sum += Decimal(multinomial_term * linear_term  ) / exponential_term
	return str(constant_term / partial_sum  )[:-1]


if __name__ == "__main__":
	_a					:					List[Any]=			50
	print(f'''The first {n} digits of pi is: {pi(n)}''')





