




'''simple docstring'''


from __future__ import annotations

import unittest

from transformers import DistilBertConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
  import tensorflow as tf

  from transformers.models.distilbert.modeling_tf_distilbert import (
      TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFDistilBertForMaskedLM,
      TFDistilBertForMultipleChoice,
      TFDistilBertForQuestionAnswering,
      TFDistilBertForSequenceClassification,
      TFDistilBertForTokenClassification,
      TFDistilBertModel,
  )





class    __lowercase						:







   def __init__(	self      ,							UpperCamelCase      ,							)				->    Optional[int]:
     __a			=					parent
     __a			=					13
     __a			=					7
     __a			=					True
     __a			=					True
     __a			=					False
     __a			=					True
     __a			=					99
     __a			=					32
     __a			=					2
     __a			=					4
     __a			=					37
     __a			=					'gelu'
     __a			=					0.1
     __a			=					0.1
     __a			=					512
     __a			=					16
     __a			=					2
     __a			=					0.02
     __a			=					3
     __a			=					4
     __a			=					None







   def 		UpperCamelCase__			(	self      )				->    int:
     __a			=					ids_tensor([self.batch_size, self.seq_length]      ,							self.vocab_size      )

     __a			=					None
     if self.use_input_mask:
       __a			=					random_attention_mask([self.batch_size, self.seq_length]      )

     __a			=					None
     __a			=					None
     __a			=					None
     if self.use_labels:
       __a			=					ids_tensor([self.batch_size]      ,							self.type_sequence_label_size      )
       __a			=					ids_tensor([self.batch_size, self.seq_length]      ,							self.num_labels      )
       __a			=					ids_tensor([self.batch_size]      ,							self.num_choices      )

     __a			=					DistilBertConfig(
         vocab_size=self.vocab_size      ,							dim=self.hidden_size      ,							n_layers=self.num_hidden_layers      ,							n_heads=self.num_attention_heads      ,							hidden_dim=self.intermediate_size      ,							hidden_act=self.hidden_act      ,							dropout=self.hidden_dropout_prob      ,							attention_dropout=self.attention_probs_dropout_prob      ,							max_position_embeddings=self.max_position_embeddings      ,							initializer_range=self.initializer_range      ,							)

     return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Optional[int]:
     __a			=					TFDistilBertModel(config=UpperCamelCase      )
     __a			=					{'input_ids': input_ids, 'attention_mask': input_mask}

     __a			=					model(UpperCamelCase      )

     __a			=					[input_ids, input_mask]

     __a			=					model(UpperCamelCase      )

     self.parent.assertEqual(result.last_hidden_state.shape      ,							(self.batch_size, self.seq_length, self.hidden_size)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Tuple:
     __a			=					TFDistilBertForMaskedLM(config=UpperCamelCase      )
     __a			=					{'input_ids': input_ids, 'attention_mask': input_mask}
     __a			=					model(UpperCamelCase      )
     self.parent.assertEqual(result.logits.shape      ,							(self.batch_size, self.seq_length, self.vocab_size)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    str:
     __a			=					TFDistilBertForQuestionAnswering(config=UpperCamelCase      )
     __a			=					{
         'input_ids': input_ids,
         'attention_mask': input_mask,
     }
     __a			=					model(UpperCamelCase      )
     self.parent.assertEqual(result.start_logits.shape      ,							(self.batch_size, self.seq_length)      )
     self.parent.assertEqual(result.end_logits.shape      ,							(self.batch_size, self.seq_length)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    List[Any]:
     __a			=					self.num_labels
     __a			=					TFDistilBertForSequenceClassification(UpperCamelCase      )
     __a			=					{'input_ids': input_ids, 'attention_mask': input_mask}
     __a			=					model(UpperCamelCase      )
     self.parent.assertEqual(result.logits.shape      ,							(self.batch_size, self.num_labels)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Tuple:
     __a			=					self.num_choices
     __a			=					TFDistilBertForMultipleChoice(UpperCamelCase      )
     __a			=					tf.tile(tf.expand_dims(UpperCamelCase      ,							1      )      ,							(1, self.num_choices, 1)      )
     __a			=					tf.tile(tf.expand_dims(UpperCamelCase      ,							1      )      ,							(1, self.num_choices, 1)      )
     __a			=					{
         'input_ids': multiple_choice_inputs_ids,
         'attention_mask': multiple_choice_input_mask,
     }
     __a			=					model(UpperCamelCase      )
     self.parent.assertEqual(result.logits.shape      ,							(self.batch_size, self.num_choices)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Optional[int]:
     __a			=					self.num_labels
     __a			=					TFDistilBertForTokenClassification(UpperCamelCase      )
     __a			=					{'input_ids': input_ids, 'attention_mask': input_mask}
     __a			=					model(UpperCamelCase      )
     self.parent.assertEqual(result.logits.shape      ,							(self.batch_size, self.seq_length, self.num_labels)      )







   def 		UpperCamelCase__			(	self      )				->    int:
     __a			=					self.prepare_config_and_inputs()
     ((__a)	,       (__a)	,       (__a)	,       (__a)	,       (__a)	,       (__a))			=					config_and_inputs
     __a			=					{'input_ids': input_ids, 'attention_mask': input_mask}
     return config, inputs_dict





@require_tf
class    __lowercase						(  __magic_name__       ,							__magic_name__       ,							unittest.TestCase ):
   _a							=      (
       (
           TFDistilBertModel,
           TFDistilBertForMaskedLM,
           TFDistilBertForQuestionAnswering,
           TFDistilBertForSequenceClassification,
           TFDistilBertForTokenClassification,
           TFDistilBertForMultipleChoice,
       )
       if is_tf_available()
       else None
   )
   _a							=      (
       {
           """feature-extraction""": TFDistilBertModel,
           """fill-mask""": TFDistilBertForMaskedLM,
           """question-answering""": TFDistilBertForQuestionAnswering,
           """text-classification""": TFDistilBertForSequenceClassification,
           """token-classification""": TFDistilBertForTokenClassification,
           """zero-shot""": TFDistilBertForSequenceClassification,
       }
       if is_tf_available()
       else {}
   )
   _a							=      False
   _a							=      False







   def 		UpperCamelCase__			(	self      )				->    Optional[int]:
     __a			=					TFDistilBertModelTester(self      )
     __a			=					ConfigTester(self      ,							config_class=UpperCamelCase      ,							dim=37      )







   def 		UpperCamelCase__			(	self      )				->    Dict:
     self.config_tester.run_common_tests()







   def 		UpperCamelCase__			(	self      )				->    List[Any]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_distilbert_model(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    Any:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_distilbert_for_masked_lm(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    List[str]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_distilbert_for_question_answering(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    Optional[int]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_distilbert_for_sequence_classification(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    Optional[int]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_distilbert_for_multiple_choice(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    str:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_distilbert_for_token_classification(*UpperCamelCase      )







   @slow
   def 		UpperCamelCase__			(	self      )				->    Optional[Any]:
     for model_name in list(TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]      ):
       __a			=					TFDistilBertModel.from_pretrained(UpperCamelCase      )
       self.assertIsNotNone(UpperCamelCase      )





@require_tf
class    __lowercase						(  unittest.TestCase ):







   @slow
   def 		UpperCamelCase__			(	self      )				->    Optional[Any]:
     __a			=					TFDistilBertModel.from_pretrained('distilbert-base-uncased'      )
     __a			=					tf.constant([[0, 1, 2, 3, 4, 5]]      )
     __a			=					model(UpperCamelCase      )[0]

     __a			=					[1, 6, 768]
     self.assertEqual(output.shape      ,							UpperCamelCase      )

     __a			=					tf.constant(
         [
             [
                 [0.19_261_885, -0.13_732_955, 0.4_119_799],
                 [0.22_150_156, -0.07_422_661, 0.39_037_204],
                 [0.22_756_018, -0.0_896_414, 0.3_701_467],
             ]
         ]      )
     tf.debugging.assert_near(output[:, :3, :3]      ,							UpperCamelCase      ,							atol=1e-4      )









'''simple docstring'''


import os


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

    __a			=					0

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

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

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

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


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



