





'''simple docstring'''


import json
import os
import shutil
import tempfile
import unittest

import numpy as np

from transformers import BertTokenizerFast
from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer
from transformers.testing_utils import require_tokenizers, require_vision
from transformers.utils import IMAGE_PROCESSOR_NAME, is_vision_available


if is_vision_available():
 from PIL import Image

 from transformers import VisionTextDualEncoderProcessor, ViTImageProcessor
@require_tokenizers
@require_vision
class 				a_       (    unittest.TestCase							):





     def 							lowercase__				(			self		: Optional[int]						):





        """simple docstring"""




        lowercase_      :List[str]         =			tempfile.mkdtemp()

        # fmt: off
        lowercase_      :List[Any]         =			["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]", "want", "##want", "##ed", "wa", "un", "runn", "##ing", ",", "low", "lowest"]
        # fmt: on
        lowercase_      :Union[str, Any]         =			os.path.join(self.tmpdirname     ,				VOCAB_FILES_NAMES["vocab_file"]						)
        with open(self.vocab_file     ,				"w"     ,				encoding="utf-8"						) as vocab_writer:
           vocab_writer.write("".join([x + "\n" for x in vocab_tokens]						)						)

        lowercase_      :Optional[int]         =			{
            "do_resize": True,
            "size": {"height": 18, "width": 18},
            "do_normalize": True,
            "image_mean": [0.5, 0.5, 0.5],
            "image_std": [0.5, 0.5, 0.5],
        }
        lowercase_      :List[str]         =			os.path.join(self.tmpdirname     ,				lowercase						)
        with open(self.image_processor_file     ,				"w"     ,				encoding="utf-8"						) as fp:
           json.dump(lowercase     ,				lowercase						)





     def 							lowercase__				(			self		: str     ,				**lowercase		: List[Any]						):





        """simple docstring"""




        return BertTokenizer.from_pretrained(self.tmpdirname     ,				**lowercase						)





     def 							lowercase__				(			self		: int     ,				**lowercase		: Tuple						):





        """simple docstring"""




        return ViTImageProcessor.from_pretrained(self.tmpdirname     ,				**lowercase						)





     def 							lowercase__				(			self		: List[str]						):





        """simple docstring"""




        shutil.rmtree(self.tmpdirname						)





     def 							lowercase__				(			self		: str						):





        """simple docstring"""




        lowercase_      :Tuple         =			[np.random.randint(255     ,				size=(3, 30, 400)     ,				dtype=np.uinta						)]

        lowercase_      :List[Any]         =			[Image.fromarray(np.moveaxis(lowercase     ,				0     ,				-1						)						) for x in image_inputs]

        return image_inputs





     def 							lowercase__				(			self		: Optional[Any]						):





        """simple docstring"""




        lowercase_      :str         =			self.get_tokenizer()
        lowercase_      :Union[str, Any]         =			self.get_image_processor()

        lowercase_      :str         =			VisionTextDualEncoderProcessor(tokenizer=lowercase     ,				image_processor=lowercase						)

        processor.save_pretrained(self.tmpdirname						)
        lowercase_      :str         =			VisionTextDualEncoderProcessor.from_pretrained(self.tmpdirname						)

        self.assertEqual(processor.tokenizer.get_vocab()     ,				tokenizer.get_vocab()						)
        self.assertIsInstance(processor.tokenizer     ,				(BertTokenizer, BertTokenizerFast)						)

        self.assertEqual(processor.image_processor.to_json_string()     ,				image_processor.to_json_string()						)
        self.assertIsInstance(processor.image_processor     ,				lowercase						)





     def 							lowercase__				(			self		: Union[str, Any]						):





        """simple docstring"""




        lowercase_      :List[str]         =			VisionTextDualEncoderProcessor(
            tokenizer=self.get_tokenizer()     ,				image_processor=self.get_image_processor()						)
        processor.save_pretrained(self.tmpdirname						)

        lowercase_      :Dict         =			self.get_tokenizer(bos_token="(BOS)"     ,				eos_token="(EOS)"						)
        lowercase_      :List[str]         =			self.get_image_processor(do_normalize=lowercase     ,				padding_value=1.0						)

        lowercase_      :Any         =			VisionTextDualEncoderProcessor.from_pretrained(
            self.tmpdirname     ,				bos_token="(BOS)"     ,				eos_token="(EOS)"     ,				do_normalize=lowercase     ,				padding_value=1.0						)

        self.assertEqual(processor.tokenizer.get_vocab()     ,				tokenizer_add_kwargs.get_vocab()						)
        self.assertIsInstance(processor.tokenizer     ,				(BertTokenizer, BertTokenizerFast)						)

        self.assertEqual(processor.image_processor.to_json_string()     ,				image_processor_add_kwargs.to_json_string()						)
        self.assertIsInstance(processor.image_processor     ,				lowercase						)





     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        lowercase_      :List[str]         =			self.get_image_processor()
        lowercase_      :List[str]         =			self.get_tokenizer()

        lowercase_      :Any         =			VisionTextDualEncoderProcessor(tokenizer=lowercase     ,				image_processor=lowercase						)

        lowercase_      :List[Any]         =			self.prepare_image_inputs()

        lowercase_      :str         =			image_processor(lowercase     ,				return_tensors="np"						)
        lowercase_      :List[str]         =			processor(images=lowercase     ,				return_tensors="np"						)

        for key in input_feat_extract.keys():
           self.assertAlmostEqual(input_feat_extract[key].sum()     ,				input_processor[key].sum()     ,				delta=1e-2						)





     def 							lowercase__				(			self		: Dict						):





        """simple docstring"""




        lowercase_      :Dict         =			self.get_image_processor()
        lowercase_      :List[Any]         =			self.get_tokenizer()

        lowercase_      :Dict         =			VisionTextDualEncoderProcessor(tokenizer=lowercase     ,				image_processor=lowercase						)

        lowercase_      :List[Any]         =			"lower newer"

        lowercase_      :Optional[int]         =			processor(text=lowercase						)

        lowercase_      :List[str]         =			tokenizer(lowercase						)

        for key in encoded_tok.keys():
           self.assertListEqual(encoded_tok[key]     ,				encoded_processor[key]						)





     def 							lowercase__				(			self		: Optional[int]						):





        """simple docstring"""




        lowercase_      :str         =			self.get_image_processor()
        lowercase_      :Optional[Any]         =			self.get_tokenizer()

        lowercase_      :Tuple         =			VisionTextDualEncoderProcessor(tokenizer=lowercase     ,				image_processor=lowercase						)

        lowercase_      :Tuple         =			"lower newer"
        lowercase_      :Optional[int]         =			self.prepare_image_inputs()

        lowercase_      :Tuple         =			processor(text=lowercase     ,				images=lowercase						)

        self.assertListEqual(list(inputs.keys()						)     ,				["input_ids", "token_type_ids", "attention_mask", "pixel_values"]						)

        # test if it raises when no input is passed
        with self.assertRaises(lowercase						):
           processor()





     def 							lowercase__				(			self		: List[str]						):





        """simple docstring"""




        lowercase_      :Optional[int]         =			self.get_image_processor()
        lowercase_      :Any         =			self.get_tokenizer()

        lowercase_      :Dict         =			VisionTextDualEncoderProcessor(tokenizer=lowercase     ,				image_processor=lowercase						)

        lowercase_      :List[Any]         =			[[1, 4, 5, 8, 1, 0, 8], [3, 4, 3, 1, 1, 8, 9]]

        lowercase_      :Dict         =			processor.batch_decode(lowercase						)
        lowercase_      :Optional[int]         =			tokenizer.batch_decode(lowercase						)

        self.assertListEqual(lowercase     ,				lowercase						)







     def 							lowercase__				(			self		: Union[str, Any]						):





        """simple docstring"""




        lowercase_      :Union[str, Any]         =			self.get_image_processor()
        lowercase_      :List[str]         =			self.get_tokenizer()

        lowercase_      :Any         =			VisionTextDualEncoderProcessor(tokenizer=lowercase     ,				image_processor=lowercase						)

        lowercase_      :Dict         =			"lower newer"
        lowercase_      :Union[str, Any]         =			self.prepare_image_inputs()

        lowercase_      :List[Any]         =			processor(text=lowercase     ,				images=lowercase						)

        self.assertListEqual(list(inputs.keys()						)     ,				processor.model_input_names						)









'''simple docstring'''


import sys

lowerCAmelCase :					List[Any] 							=(
    '''73167176531330624919225119674426574742355349194934'''
    '''96983520312774506326239578318016984801869478851843'''
    '''85861560789112949495459501737958331952853208805511'''
    '''12540698747158523863050715693290963295227443043557'''
    '''66896648950445244523161731856403098711121722383113'''
    '''62229893423380308135336276614282806444486645238749'''
    '''30358907296290491560440772390713810515859307960866'''
    '''70172427121883998797908792274921901699720888093776'''
    '''65727333001053367881220235421809751254540594752243'''
    '''52584907711670556013604839586446706324415722155397'''
    '''53697817977846174064955149290862569321978468622482'''
    '''83972241375657056057490261407972968652414535100474'''
    '''82166370484403199890008895243450658541227588666881'''
    '''16427171479924442928230863465674813919123162824586'''
    '''17866458359124566529476545682848912883142607690042'''
    '''24219022671055626321111109370544217506941658960408'''
    '''07198403850962455444362981230987879927244284909188'''
    '''84580156166097919133875499200524063689912560717606'''
    '''05886116467109405077541002256983155200055935729725'''
    '''71636269561882670428252483600823257530420752963450'''
)
def 							UpperCAmelCase_  (						__lowerCamelCase : str			):
   lowercase_      :List[str]         =			1
   for digit in s:
      product *= int(__lowerCamelCase			)
   return product
def 							UpperCAmelCase_  (						__lowerCamelCase : str = N			):
   lowercase_      :Any         =			-sys.maxsize - 1
   lowercase_      :int         =			n[:13]
   lowercase_      :Optional[int]         =			13
   while cur_index < len(__lowerCamelCase			) - 13:
      if int(n[cur_index]			) >= int(substr[0]			):
         lowercase_      :str         =			substr[1:] + n[cur_index]
         cur_index += 1
      else:
         lowercase_      :List[str]         =			max(__lowerCamelCase     ,str_eval(__lowerCamelCase			)			)
         lowercase_      :Any         =			n[cur_index : cur_index + 13]
         cur_index += 13
   return largest_product


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


