


import copy
import os
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union


if TYPE_CHECKING:
						from ...processing_utils import ProcessorMixin
						from ...utils import TensorType

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__lowerCAmelCase      :					int    							=logging.get_logger(__name__)

__lowerCAmelCase      :					List[Any]    							={
    'google/owlvit-base-patch32': 'https://huggingface.co/google/owlvit-base-patch32/resolve/main/config.json',
    'google/owlvit-base-patch16': 'https://huggingface.co/google/owlvit-base-patch16/resolve/main/config.json',
    'google/owlvit-large-patch14': 'https://huggingface.co/google/owlvit-large-patch14/resolve/main/config.json',
}
class 			_lowercase (     A__			):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE__							:     int         =						'''owlvit_text_model'''


				def __init__(			self     :List[Any]     ,     lowerCAmelCase__     :List[str]=49_408     ,     lowerCAmelCase__     :int=512     ,     lowerCAmelCase__     :Any=2_048     ,     lowerCAmelCase__     :List[Any]=12     ,     lowerCAmelCase__     :Optional[int]=8     ,     lowerCAmelCase__     :List[str]=16     ,     lowerCAmelCase__     :List[str]="quick_gelu"     ,     lowerCAmelCase__     :Dict=1E-5     ,     lowerCAmelCase__     :int=0.0     ,     lowerCAmelCase__     :Any=0.02     ,     lowerCAmelCase__     :int=1.0     ,     lowerCAmelCase__     :Tuple=0     ,     lowerCAmelCase__     :Dict=49_406     ,     lowerCAmelCase__     :List[str]=49_407     ,     **lowerCAmelCase__     :Dict     ,     )						->     int:
										super().__init__(pad_token_id=snake_case_     ,     bos_token_id=snake_case_     ,     eos_token_id=snake_case_     ,     **snake_case_      )

										__SCREAMING_SNAKE_CASE		:	List[Any]						     =						vocab_size
										__SCREAMING_SNAKE_CASE		:	Optional[Any]						     =						hidden_size
										__SCREAMING_SNAKE_CASE		:	Union[str, Any]						     =						intermediate_size
										__SCREAMING_SNAKE_CASE		:	Tuple						     =						num_hidden_layers
										__SCREAMING_SNAKE_CASE		:	Tuple						     =						num_attention_heads
										__SCREAMING_SNAKE_CASE		:	str						     =						max_position_embeddings
										__SCREAMING_SNAKE_CASE		:	List[str]						     =						hidden_act
										__SCREAMING_SNAKE_CASE		:	int						     =						layer_norm_eps
										__SCREAMING_SNAKE_CASE		:	List[str]						     =						attention_dropout
										__SCREAMING_SNAKE_CASE		:	Any						     =						initializer_range
										__SCREAMING_SNAKE_CASE		:	Tuple						     =						initializer_factor



				@classmethod
				def 						__magic_name__(			cls     :Optional[Any]     ,     lowerCAmelCase__     :Optional[int]     ,     **lowerCAmelCase__     :Dict      )						->     "PretrainedConfig":
										cls._set_token_in_kwargs(snake_case_      )

										__SCREAMING_SNAKE_CASE     ,     __SCREAMING_SNAKE_CASE		:	int						     =						cls.get_config_dict(snake_case_     ,     **snake_case_      )

										# get the text config dict if we are loading from OwlViTConfig
										if config_dict.get('''model_type'''      ) == "owlvit":
																__SCREAMING_SNAKE_CASE		:	List[str]						     =						config_dict['''text_config''']

										if "model_type" in config_dict and hasattr(cls     ,     '''model_type'''      ) and config_dict["model_type"] != cls.model_type:
																logger.warning(
																    f'''You are using a model of type {config_dict['model_type']} to instantiate a model of type '''
																    f'''{cls.model_type}. This is not supported for all configurations of models and can yield errors.'''      )

										return cls.from_dict(snake_case_     ,     **snake_case_      )




class 			_lowercase (     A__			):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE__							:     str         =						'''owlvit_vision_model'''


				def __init__(			self     :List[Any]     ,     lowerCAmelCase__     :List[Any]=768     ,     lowerCAmelCase__     :Optional[Any]=3_072     ,     lowerCAmelCase__     :Dict=12     ,     lowerCAmelCase__     :str=12     ,     lowerCAmelCase__     :Optional[int]=3     ,     lowerCAmelCase__     :Tuple=768     ,     lowerCAmelCase__     :int=32     ,     lowerCAmelCase__     :int="quick_gelu"     ,     lowerCAmelCase__     :Any=1E-5     ,     lowerCAmelCase__     :List[str]=0.0     ,     lowerCAmelCase__     :List[Any]=0.02     ,     lowerCAmelCase__     :Tuple=1.0     ,     **lowerCAmelCase__     :Dict     ,     )						->     List[Any]:
										super().__init__(**snake_case_      )

										__SCREAMING_SNAKE_CASE		:	Dict						     =						hidden_size
										__SCREAMING_SNAKE_CASE		:	Tuple						     =						intermediate_size
										__SCREAMING_SNAKE_CASE		:	Dict						     =						num_hidden_layers
										__SCREAMING_SNAKE_CASE		:	Union[str, Any]						     =						num_attention_heads
										__SCREAMING_SNAKE_CASE		:	Any						     =						num_channels
										__SCREAMING_SNAKE_CASE		:	List[Any]						     =						image_size
										__SCREAMING_SNAKE_CASE		:	Tuple						     =						patch_size
										__SCREAMING_SNAKE_CASE		:	str						     =						hidden_act
										__SCREAMING_SNAKE_CASE		:	Union[str, Any]						     =						layer_norm_eps
										__SCREAMING_SNAKE_CASE		:	List[Any]						     =						attention_dropout
										__SCREAMING_SNAKE_CASE		:	Union[str, Any]						     =						initializer_range
										__SCREAMING_SNAKE_CASE		:	Dict						     =						initializer_factor



				@classmethod
				def 						__magic_name__(			cls     :Tuple     ,     lowerCAmelCase__     :List[Any]     ,     **lowerCAmelCase__     :str      )						->     "PretrainedConfig":
										cls._set_token_in_kwargs(snake_case_      )

										__SCREAMING_SNAKE_CASE     ,     __SCREAMING_SNAKE_CASE		:	int						     =						cls.get_config_dict(snake_case_     ,     **snake_case_      )

										# get the vision config dict if we are loading from OwlViTConfig
										if config_dict.get('''model_type'''      ) == "owlvit":
																__SCREAMING_SNAKE_CASE		:	Any						     =						config_dict['''vision_config''']

										if "model_type" in config_dict and hasattr(cls     ,     '''model_type'''      ) and config_dict["model_type"] != cls.model_type:
																logger.warning(
																    f'''You are using a model of type {config_dict['model_type']} to instantiate a model of type '''
																    f'''{cls.model_type}. This is not supported for all configurations of models and can yield errors.'''      )

										return cls.from_dict(snake_case_     ,     **snake_case_      )




class 			_lowercase (     A__			):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE__							:     Optional[int]         =						'''owlvit'''
				SCREAMING_SNAKE_CASE__							:     Optional[int]         =						True


				def __init__(			self     :Union[str, Any]     ,     lowerCAmelCase__     :Optional[int]=None     ,     lowerCAmelCase__     :List[Any]=None     ,     lowerCAmelCase__     :Tuple=512     ,     lowerCAmelCase__     :int=2.6592     ,     lowerCAmelCase__     :Optional[Any]=True     ,     **lowerCAmelCase__     :Tuple     ,     )						->     Dict:
										super().__init__(**snake_case_      )

										if text_config is None:
																__SCREAMING_SNAKE_CASE		:	List[Any]						     =						{}
																logger.info('''text_config is None. Initializing the OwlViTTextConfig with default values.'''      )

										if vision_config is None:
																__SCREAMING_SNAKE_CASE		:	Tuple						     =						{}
																logger.info('''vision_config is None. initializing the OwlViTVisionConfig with default values.'''      )

										__SCREAMING_SNAKE_CASE		:	Optional[int]						     =						OwlViTTextConfig(**snake_case_      )
										__SCREAMING_SNAKE_CASE		:	List[str]						     =						OwlViTVisionConfig(**snake_case_      )

										__SCREAMING_SNAKE_CASE		:	Dict						     =						projection_dim
										__SCREAMING_SNAKE_CASE		:	int						     =						logit_scale_init_value
										__SCREAMING_SNAKE_CASE		:	int						     =						return_dict
										__SCREAMING_SNAKE_CASE		:	List[Any]						     =						1.0


				@classmethod
				def 						__magic_name__(			cls     :Optional[int]     ,     lowerCAmelCase__     :Dict     ,     **lowerCAmelCase__     :str      )						->     "PretrainedConfig":
										cls._set_token_in_kwargs(snake_case_      )

										__SCREAMING_SNAKE_CASE     ,     __SCREAMING_SNAKE_CASE		:	Optional[Any]						     =						cls.get_config_dict(snake_case_     ,     **snake_case_      )

										if "model_type" in config_dict and hasattr(cls     ,     '''model_type'''      ) and config_dict["model_type"] != cls.model_type:
																logger.warning(
																    f'''You are using a model of type {config_dict['model_type']} to instantiate a model of type '''
																    f'''{cls.model_type}. This is not supported for all configurations of models and can yield errors.'''      )

										return cls.from_dict(snake_case_     ,     **snake_case_      )


				@classmethod
				def 						__magic_name__(			cls     :Any     ,     lowerCAmelCase__     :List[str]     ,     lowerCAmelCase__     :List[Any]     ,     **lowerCAmelCase__     :Dict      )						->     Union[str, Any]:
										__SCREAMING_SNAKE_CASE		:	int						     =						{}
										__SCREAMING_SNAKE_CASE		:	Dict						     =						text_config
										__SCREAMING_SNAKE_CASE		:	Optional[Any]						     =						vision_config

										return cls.from_dict(snake_case_     ,     **snake_case_      )



				def 						__magic_name__(			self     :Optional[int]      )						->     Tuple:
										__SCREAMING_SNAKE_CASE		:	Optional[Any]						     =						copy.deepcopy(self.__dict__      )
										__SCREAMING_SNAKE_CASE		:	int						     =						self.text_config.to_dict()
										__SCREAMING_SNAKE_CASE		:	List[Any]						     =						self.vision_config.to_dict()
										__SCREAMING_SNAKE_CASE		:	List[str]						     =						self.__class__.model_type
										return output




class 			_lowercase (     A__			):






				'''simple docstring'''



				@property
				def 						__magic_name__(			self     :Any      )						->     Mapping[str, Mapping[int, str]]:
										return OrderedDict(
										    [
										        ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
										        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
										        ('''attention_mask''', {0: '''batch''', 1: '''sequence'''}),
										    ]      )


				@property
				def 						__magic_name__(			self     :List[Any]      )						->     Mapping[str, Mapping[int, str]]:
										return OrderedDict(
										    [
										        ('''logits_per_image''', {0: '''batch'''}),
										        ('''logits_per_text''', {0: '''batch'''}),
										        ('''text_embeds''', {0: '''batch'''}),
										        ('''image_embeds''', {0: '''batch'''}),
										    ]      )


				@property
				def 						__magic_name__(			self     :Any      )						->     float:
										return 1E-4


				def 						__magic_name__(			self     :Optional[Any]     ,     lowerCAmelCase__     :List[str]     ,     lowerCAmelCase__     :Union[str, Any] = -1     ,     lowerCAmelCase__     :int = -1     ,     lowerCAmelCase__     :Optional[int] = None     ,     )						->     Mapping[str, Any]:
										__SCREAMING_SNAKE_CASE		:	str						     =						super().generate_dummy_inputs(
										    processor.tokenizer     ,     batch_size=snake_case_     ,     seq_length=snake_case_     ,     framework=snake_case_      )
										__SCREAMING_SNAKE_CASE		:	Optional[Any]						     =						super().generate_dummy_inputs(
										    processor.image_processor     ,     batch_size=snake_case_     ,     framework=snake_case_      )
										return {**text_input_dict, **image_input_dict}



				@property
				def 						__magic_name__(			self     :Dict      )						->     int:
										return 14


"""simple docstring"""
import os

def  lowercase     ():
						with open(os.path.dirname(_lowerCAmelCase						) + """/grid.txt"""						) as f:
												__lowerCAmelCase     =  []  # noqa: E741
												for _ in range(20						):
																		l.append([int(_lowerCAmelCase						) for x in f.readline().split()]						)

												__lowerCAmelCase     =  0

												# right
												for i in range(20						):
																		for j in range(17						):
																								__lowerCAmelCase     =  l[i][j] * l[i][j + 1] * l[i][j + 2] * l[i][j + 3]
																								if temp > maximum:
																														__lowerCAmelCase     =  temp

        # down
												for i in range(17						):
																		for j in range(20						):
																								__lowerCAmelCase     =  l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
																								if temp > maximum:
																														__lowerCAmelCase     =  temp

        # diagonal 1
												for i in range(17						):
																		for j in range(17						):
																								__lowerCAmelCase     =  l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
																								if temp > maximum:
																														__lowerCAmelCase     =  temp

        # diagonal 2
												for i in range(17						):
																		for j in range(3 ,    20						):
																								__lowerCAmelCase     =  l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
																								if temp > maximum:
																														__lowerCAmelCase     =  temp
												return maximum


if __name__ == "__main__":
			print(solution())
