




'''simple docstring'''


from typing import Union

from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_vision_available():
  from PIL import Image

  from ..image_utils import load_image

if is_torch_available():
  from ..models.auto.modeling_auto import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING

lowercase_ 		=      logging.get_logger(__name__)





@add_end_docstrings(_a )
class    __lowercase						(  _a ):







   def __init__(	self      ,							*UpperCamelCase      ,							**UpperCamelCase      )				->    str:
     super().__init__(*snake_case_      ,							**snake_case_      )
     self.check_model_type(snake_case_      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase=None      ,							UpperCamelCase=None      ,							UpperCamelCase=None      ,							**UpperCamelCase      )				->    Dict:
     __a	,       __a			=					{}, {}
     if padding is not None:
       __a			=					padding
     if truncation is not None:
       __a			=					truncation
     if top_k is not None:
       __a			=					top_k
     return preprocess_params, {}, postprocess_params







   def __call__(	self      ,							UpperCamelCase      ,							UpperCamelCase = None      ,							**UpperCamelCase      )				->    Any:
     if isinstance(snake_case_      ,							(Image.Image, str)      ) and isinstance(snake_case_      ,							snake_case_      ):
       __a			=					{'image': image, 'question': question}
     else:
       __a			=					image
     __a			=					super().__call__(snake_case_      ,							**snake_case_      )
     return results







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase=False      ,							UpperCamelCase=False      )				->    Tuple:
     __a			=					load_image(inputs['image']      )
     __a			=					self.tokenizer(
         inputs['question']      ,							return_tensors=self.framework      ,							padding=snake_case_      ,							truncation=snake_case_      )
     __a			=					self.image_processor(images=snake_case_      ,							return_tensors=self.framework      )
     model_inputs.update(snake_case_      )
     return model_inputs







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      )				->    List[str]:
     __a			=					self.model(**snake_case_      )
     return model_outputs







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase=5      )				->    int:
     if top_k > self.model.config.num_labels:
       __a			=					self.model.config.num_labels

     if self.framework == "pt":
       __a			=					model_outputs.logits.sigmoid()[0]
       __a	,       __a			=					probs.topk(snake_case_      )
     else:
       raise ValueError(f"Unsupported framework: {self.framework}"      )

     __a			=					scores.tolist()
     __a			=					ids.tolist()
     return [{"score": score, "answer": self.model.config.idalabel[_id]} for score, _id in zip(snake_case_      ,							snake_case_      )]









'''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())



