"""simple docstring"""




import sys

__lowerCamelCase							 =     (
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)






def      UpperCAmelCase    (		UpperCamelCase__ ):






							"""simple docstring"""





							A__		   =							1
							for digit in s:
														product *= int(UpperCamelCase__ )
							return product






def      UpperCAmelCase    (		UpperCamelCase__ = N ):






							"""simple docstring"""





							A__		   =							-sys.maxsize - 1
							A__		   =							n[:13]
							A__		   =							13
							while cur_index < len(UpperCamelCase__ ) - 13:
														if int(n[cur_index] ) >= int(substr[0] ):
																					A__		   =							substr[1:] + n[cur_index]
																					cur_index += 1
														else:
																					A__		   =							max(UpperCamelCase__				,			str_eval(UpperCamelCase__ ) )
																					A__		   =							n[cur_index : cur_index + 13]
																					cur_index += 13
							return largest_product


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






"""simple docstring"""




import unittest
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory

from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline
from transformers.convert_graph_to_onnx import (
    convert,
    ensure_valid_input,
    generate_identified_filename,
    infer_shapes,
    quantize,
)
from transformers.testing_utils import require_tf, require_tokenizers, require_torch, slow
class 			UpperCamelCase__:





						def  snake_case__		(				self						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase   )    -> int:
													return None






class 			UpperCamelCase__:





						def  snake_case__		(				self						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase   )    -> Tuple:
													return None






class 			UpperCamelCase__(	unittest.TestCase       ):
						lowerCAmelCase__     :  Tuple  							=						[
						    # (model_name, model_kwargs)
						    ('bert-base-cased', {}),
						    ('gpt2', {'use_cache': False}),  # We don't support exporting GPT2 past keys anymore
						]





						@require_tf
						@slow
						def  snake_case__		(				self   )    -> int:
													for model, model_kwargs in OnnxExportTestCase.MODEL_TO_TEST:
																				self._test_export(__UpperCAmelCase						,'tf'						,12						,**__UpperCAmelCase   )





						@require_torch
						@slow
						def  snake_case__		(				self   )    -> int:
													for model, model_kwargs in OnnxExportTestCase.MODEL_TO_TEST:
																				self._test_export(__UpperCAmelCase						,'pt'						,12						,**__UpperCAmelCase   )





						@require_torch
						@slow
						def  snake_case__		(				self   )    -> Optional[Any]:
													from transformers import BertModel

													A__		   =							['[UNK]', '[SEP]', '[CLS]', '[PAD]', '[MASK]', 'some', 'other', 'words']
													with NamedTemporaryFile(mode='w+t'   ) as vocab_file:
																				vocab_file.write('\n'.join(__UpperCAmelCase   )   )
																				vocab_file.flush()
																				A__		   =							BertTokenizerFast(vocab_file.name   )

													with TemporaryDirectory() as bert_save_dir:
																				A__		   =							BertModel(BertConfig(vocab_size=len(__UpperCAmelCase   )   )   )
																				model.save_pretrained(__UpperCAmelCase   )
																				self._test_export(__UpperCAmelCase						,'pt'						,12						,__UpperCAmelCase   )





						@require_tf
						@slow
						def  snake_case__		(				self   )    -> Optional[Any]:
													for model, model_kwargs in OnnxExportTestCase.MODEL_TO_TEST:
																				A__		   =							self._test_export(__UpperCAmelCase						,'tf'						,12						,**__UpperCAmelCase   )
																				A__		   =							quantize(Path(__UpperCAmelCase   )   )

																				# Ensure the actual quantized model is not bigger than the original one
																				if quantized_path.stat().st_size >= Path(__UpperCAmelCase   ).stat().st_size:
																											self.fail('Quantized model is bigger than initial ONNX model'   )





						@require_torch
						@slow
						def  snake_case__		(				self   )    -> str:
													for model, model_kwargs in OnnxExportTestCase.MODEL_TO_TEST:
																				A__		   =							self._test_export(__UpperCAmelCase						,'pt'						,12						,**__UpperCAmelCase   )
																				A__		   =							quantize(__UpperCAmelCase   )

																				# Ensure the actual quantized model is not bigger than the original one
																				if quantized_path.stat().st_size >= Path(__UpperCAmelCase   ).stat().st_size:
																											self.fail('Quantized model is bigger than initial ONNX model'   )





						def  snake_case__		(				self						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase=None						,**__UpperCAmelCase   )    -> Union[str, Any]:
													try:
																				# Compute path
																				with TemporaryDirectory() as tempdir:
																											A__		   =							Path(__UpperCAmelCase   ).joinpath('model.onnx'   )

																				# Remove folder if exists
																				if path.parent.exists():
																											path.parent.rmdir()

																				# Export
																				convert(__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase						,**__UpperCAmelCase   )

																				return path
													except Exception as e:
																				self.fail(__UpperCAmelCase   )





						@require_torch
						@require_tokenizers
						@slow
						def  snake_case__		(				self   )    -> Optional[Any]:
													from transformers import BertModel

													A__		   =							BertModel(BertConfig.from_pretrained('lysandre/tiny-bert-random'   )   )
													A__		   =							BertTokenizerFast.from_pretrained('lysandre/tiny-bert-random'   )
													self._test_infer_dynamic_axis(__UpperCAmelCase						,__UpperCAmelCase						,'pt'   )





						@require_tf
						@require_tokenizers
						@slow
						def  snake_case__		(				self   )    -> Optional[Any]:
													from transformers import TFBertModel

													A__		   =							TFBertModel(BertConfig.from_pretrained('lysandre/tiny-bert-random'   )   )
													A__		   =							BertTokenizerFast.from_pretrained('lysandre/tiny-bert-random'   )
													self._test_infer_dynamic_axis(__UpperCAmelCase						,__UpperCAmelCase						,'tf'   )





						def  snake_case__		(				self						,__UpperCAmelCase						,__UpperCAmelCase						,__UpperCAmelCase   )    -> str:
													A__		   =							FeatureExtractionPipeline(__UpperCAmelCase						,__UpperCAmelCase   )

													A__		   =							['input_ids', 'token_type_ids', 'attention_mask', 'output_0', 'output_1']
													A__   ,     A__   ,     A__   ,     A__		   =							infer_shapes(__UpperCAmelCase						,__UpperCAmelCase   )

													# Assert all variables are present
													self.assertEqual(len(__UpperCAmelCase   )						,len(__UpperCAmelCase   )   )
													self.assertTrue(all(var_name in shapes for var_name in variable_names   )   )
													self.assertSequenceEqual(variable_names[:3]						,__UpperCAmelCase   )
													self.assertSequenceEqual(variable_names[3:]						,__UpperCAmelCase   )

													# Assert inputs are {0: batch, 1: sequence}
													for var_name in ["input_ids", "token_type_ids", "attention_mask"]:
																				self.assertDictEqual(shapes[var_name]						,{0: 'batch', 1: 'sequence'}   )

													# Assert outputs are {0: batch, 1: sequence} and {0: batch}
													self.assertDictEqual(shapes['output_0']						,{0: 'batch', 1: 'sequence'}   )
													self.assertDictEqual(shapes['output_1']						,{0: 'batch'}   )





						def  snake_case__		(				self   )    -> Union[str, Any]:
													A__		   =							['input_ids', 'attention_mask', 'token_type_ids']
													A__		   =							{'input_ids': [1, 2, 3, 4], 'attention_mask': [0, 0, 0, 0], 'token_type_ids': [1, 1, 1, 1]}
													A__   ,     A__		   =							ensure_valid_input(FuncContiguousArgs()						,__UpperCAmelCase						,__UpperCAmelCase   )

													# Should have exactly the same number of args (all are valid)
													self.assertEqual(len(__UpperCAmelCase   )						,3   )

													# Should have exactly the same input names
													self.assertEqual(set(__UpperCAmelCase   )						,set(__UpperCAmelCase   )   )

													# Parameter should be reordered according to their respective place in the function:
													# (input_ids, token_type_ids, attention_mask)
													self.assertEqual(__UpperCAmelCase						,(tokens['input_ids'], tokens['token_type_ids'], tokens['attention_mask'])   )

													# Generated args are interleaved with another args (for instance parameter "past" in GPT2)
													A__   ,     A__		   =							ensure_valid_input(FuncNonContiguousArgs()						,__UpperCAmelCase						,__UpperCAmelCase   )

													# Should have exactly the one arg (all before the one not provided "some_other_args")
													self.assertEqual(len(__UpperCAmelCase   )						,1   )
													self.assertEqual(len(__UpperCAmelCase   )						,1   )

													# Should have only "input_ids"
													self.assertEqual(inputs_args[0]						,tokens['input_ids']   )
													self.assertEqual(ordered_input_names[0]						,'input_ids'   )





						def  snake_case__		(				self   )    -> Union[str, Any]:
													A__		   =							generate_identified_filename(Path('/home/something/my_fake_model.onnx'   )						,'-test'   )
													self.assertEqual('/home/something/my_fake_model-test.onnx'						,generated.as_posix()   )





