






"""simple docstring"""





import copy
import os
from typing import Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_SCREAMING_SNAKE_CASE					:				Tuple					    =						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE					:				Tuple					    =						{
    '''BridgeTower/bridgetower-base''': '''https://huggingface.co/BridgeTower/bridgetower-base/blob/main/config.json''',
    '''BridgeTower/bridgetower-base-itm-mlm''': (
        '''https://huggingface.co/BridgeTower/bridgetower-base-itm-mlm/blob/main/config.json'''
    ),
}






class      a						(					__snake_case		):
    SCREAMING_SNAKE_CASE						:     Union[str, Any]						= """bridgetower_vision_model"""






    def __init__(       self     :							Union[str, Any]       ,						__SCREAMING_SNAKE_CASE     :							Dict=768       ,						__SCREAMING_SNAKE_CASE     :							Dict=12       ,						__SCREAMING_SNAKE_CASE     :							str=3       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]=16       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]=288       ,						__SCREAMING_SNAKE_CASE     :							Tuple=1       ,						__SCREAMING_SNAKE_CASE     :							List[Any]=1e-0_5       ,						__SCREAMING_SNAKE_CASE     :							List[Any]=False       ,						__SCREAMING_SNAKE_CASE     :							List[Any]=True       ,						__SCREAMING_SNAKE_CASE     :							Tuple=False       ,						**__SCREAMING_SNAKE_CASE     :							Any       ,						)     ->		Optional[Any]:
      super().__init__(**__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						hidden_size
      lowerCamelCase_         =						num_hidden_layers
      lowerCamelCase_         =						num_channels
      lowerCamelCase_         =						patch_size
      lowerCamelCase_         =						image_size
      lowerCamelCase_         =						initializer_factor
      lowerCamelCase_         =						layer_norm_eps
      lowerCamelCase_         =						stop_gradient
      lowerCamelCase_         =						share_layernorm
      lowerCamelCase_         =						remove_last_layer






    @classmethod
    def    UpperCamelCase       (       cls     :							Dict       ,						__SCREAMING_SNAKE_CASE     :							Union[str, os.PathLike]       ,						**__SCREAMING_SNAKE_CASE     :							Union[str, Any]					)     ->		"PretrainedConfig":
      lowerCamelCase_     ,	lowerCamelCase_         =						cls.get_config_dict(__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE					)

      if config_dict.get('model_type'					) == "bridgetower":
        lowerCamelCase_         =						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(__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE					)






class      a						(					__snake_case		):
    SCREAMING_SNAKE_CASE						:     Union[str, Any]						= """bridgetower_text_model"""






    def __init__(       self     :							List[Any]       ,						__SCREAMING_SNAKE_CASE     :							Dict=50265       ,						__SCREAMING_SNAKE_CASE     :							List[str]=768       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]=12       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]=12       ,						__SCREAMING_SNAKE_CASE     :							int=1       ,						__SCREAMING_SNAKE_CASE     :							List[str]=3072       ,						__SCREAMING_SNAKE_CASE     :							List[Any]="gelu"       ,						__SCREAMING_SNAKE_CASE     :							List[Any]=0.1       ,						__SCREAMING_SNAKE_CASE     :							Dict=0.1       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]=514       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]=1       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]=1e-0_5       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]=1       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any]=0       ,						__SCREAMING_SNAKE_CASE     :							List[Any]=2       ,						__SCREAMING_SNAKE_CASE     :							List[str]="absolute"       ,						__SCREAMING_SNAKE_CASE     :							str=True       ,						**__SCREAMING_SNAKE_CASE     :							Optional[Any]       ,						)     ->		Dict:
      super().__init__(**__SCREAMING_SNAKE_CASE					)

      lowerCamelCase_         =						vocab_size
      lowerCamelCase_         =						hidden_size
      lowerCamelCase_         =						num_hidden_layers
      lowerCamelCase_         =						num_attention_heads
      lowerCamelCase_         =						hidden_act
      lowerCamelCase_         =						initializer_factor
      lowerCamelCase_         =						intermediate_size
      lowerCamelCase_         =						hidden_dropout_prob
      lowerCamelCase_         =						attention_probs_dropout_prob
      lowerCamelCase_         =						max_position_embeddings
      lowerCamelCase_         =						type_vocab_size
      lowerCamelCase_         =						layer_norm_eps
      lowerCamelCase_         =						position_embedding_type
      lowerCamelCase_         =						use_cache
      lowerCamelCase_         =						pad_token_id
      lowerCamelCase_         =						bos_token_id
      lowerCamelCase_         =						eos_token_id






    @classmethod
    def    UpperCamelCase       (       cls     :							Union[str, Any]       ,						__SCREAMING_SNAKE_CASE     :							Union[str, os.PathLike]       ,						**__SCREAMING_SNAKE_CASE     :							str					)     ->		"PretrainedConfig":
      lowerCamelCase_     ,	lowerCamelCase_         =						cls.get_config_dict(__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE					)

      if config_dict.get('model_type'					) == "bridgetower":
        lowerCamelCase_         =						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(__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE					)






class      a						(					__snake_case		):
    SCREAMING_SNAKE_CASE						:     Dict						= """bridgetower"""






    def __init__(       self     :							Union[str, Any]       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]=True       ,						__SCREAMING_SNAKE_CASE     :							Tuple="gelu"       ,						__SCREAMING_SNAKE_CASE     :							str=768       ,						__SCREAMING_SNAKE_CASE     :							Tuple=1       ,						__SCREAMING_SNAKE_CASE     :							List[Any]=1e-0_5       ,						__SCREAMING_SNAKE_CASE     :							Tuple=False       ,						__SCREAMING_SNAKE_CASE     :							Dict="add"       ,						__SCREAMING_SNAKE_CASE     :							str=12       ,						__SCREAMING_SNAKE_CASE     :							str=6       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]=False       ,						__SCREAMING_SNAKE_CASE     :							Any=False       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]=None       ,						__SCREAMING_SNAKE_CASE     :							int=None       ,						**__SCREAMING_SNAKE_CASE     :							List[str]       ,						)     ->		List[Any]:
      # TODO: remove this once the Hub files are updated.
      lowerCamelCase_         =						kwargs.pop('text_config_dict'       ,						__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						kwargs.pop('vision_config_dict'       ,						__SCREAMING_SNAKE_CASE					)

      super().__init__(**__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						share_cross_modal_transformer_layers
      lowerCamelCase_         =						hidden_act
      lowerCamelCase_         =						hidden_size
      lowerCamelCase_         =						initializer_factor
      lowerCamelCase_         =						layer_norm_eps
      lowerCamelCase_         =						share_link_tower_layers
      lowerCamelCase_         =						link_tower_type
      lowerCamelCase_         =						num_attention_heads
      lowerCamelCase_         =						num_hidden_layers
      lowerCamelCase_         =						tie_word_embeddings
      lowerCamelCase_         =						init_layernorm_from_vision_encoder

      if text_config is None:
        lowerCamelCase_         =						{}
        logger.info('`text_config` is `None`. Initializing the `BridgeTowerTextConfig` with default values.'					)

      if vision_config is None:
        lowerCamelCase_         =						{}
        logger.info('`vision_config` is `None`. Initializing the `BridgeTowerVisionConfig` with default values.'					)

      lowerCamelCase_         =						BridgeTowerTextConfig(**__SCREAMING_SNAKE_CASE					)
      lowerCamelCase_         =						BridgeTowerVisionConfig(**__SCREAMING_SNAKE_CASE					)






    @classmethod
    def    UpperCamelCase       (       cls     :							List[Any]       ,						__SCREAMING_SNAKE_CASE     :							BridgeTowerTextConfig       ,						__SCREAMING_SNAKE_CASE     :							BridgeTowerVisionConfig       ,						**__SCREAMING_SNAKE_CASE     :							int					)     ->		List[Any]:
      return cls(text_config=text_config.to_dict()       ,						vision_config=vision_config.to_dict()       ,						**__SCREAMING_SNAKE_CASE					)






    def    UpperCamelCase       (       self     :							Optional[Any]					)     ->		Optional[Any]:
      lowerCamelCase_         =						copy.deepcopy(self.__dict__					)
      lowerCamelCase_         =						self.text_config.to_dict()
      lowerCamelCase_         =						self.vision_config.to_dict()
      lowerCamelCase_         =						self.__class__.model_type
      return output












"""simple docstring"""





import os







def      lowerCamelCase__       (							)      ->				List[Any]:
  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())




