

'''simple docstring'''

import os





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

    SCREAMING_SNAKE_CASE:int						      =					0

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

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

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

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


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









'''simple docstring'''

import PIL.Image
import PIL.ImageOps
from packaging import version
from PIL import Image


if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"):
    A_       						=							{
        "linear": PIL.Image.Resampling.BILINEAR,
        "bilinear": PIL.Image.Resampling.BILINEAR,
        "bicubic": PIL.Image.Resampling.BICUBIC,
        "lanczos": PIL.Image.Resampling.LANCZOS,
        "nearest": PIL.Image.Resampling.NEAREST,
    }
else:
    A_       						=							{
        "linear": PIL.Image.LINEAR,
        "bilinear": PIL.Image.BILINEAR,
        "bicubic": PIL.Image.BICUBIC,
        "lanczos": PIL.Image.LANCZOS,
        "nearest": PIL.Image.NEAREST,
    }





def    A_  ( snake_case ):
  SCREAMING_SNAKE_CASE:Any						      =					(images / 2 + 0.5).clamp(0      ,       1 )
  SCREAMING_SNAKE_CASE:Optional[Any]						      =					images.cpu().permute(0      ,       2      ,       3      ,       1 ).float().numpy()
  SCREAMING_SNAKE_CASE:str						      =					numpy_to_pil(snake_case )
  return images





def    A_  ( snake_case ):
  if images.ndim == 3:
    SCREAMING_SNAKE_CASE:List[str]						      =					images[None, ...]
  SCREAMING_SNAKE_CASE:List[Any]						      =					(images * 255).round().astype("uint8" )
  if images.shape[-1] == 1:
    # special case for grayscale (single channel) images
    SCREAMING_SNAKE_CASE:Any						      =					[Image.fromarray(image.squeeze()      ,       mode="L" ) for image in images]
  else:
    SCREAMING_SNAKE_CASE:int						      =					[Image.fromarray(snake_case ) for image in images]

  return pil_images






