"""simple docstring"""



from __future__ import annotations



def 					_lowerCamelCase(					a ,  a							):
       if b == 0:
              return (1, 0)
       ((__a)				, (__a))     				=  extended_euclid(a ,  a % b							)
       __a     				=  a // b
       return (y, x - k * y)



def 					_lowerCamelCase(					a ,  a ,  a ,  a							):
       ((__a)				, (__a))     				=  extended_euclid(a ,  a							)
       __a     				=  na * na
       __a     				=  ra * x * na + ra * y * na
       return (n % m + m) % m



def 					_lowerCamelCase(					a ,  a							):
       ((__a)				, (__a))     				=  extended_euclid(a ,  a							)
       if b < 0:
              __a     				=  (b % n + n) % n
       return b



def 					_lowerCamelCase(					a ,  a ,  a ,  a							):
       __a				, __a     				=  invert_modulo(a ,  a							), invert_modulo(a ,  a							)
       __a     				=  na * na
       __a     				=  ra * x * na + ra * y * na
       return (n % m + m) % m


if __name__ == "__main__":
   from doctest import testmod

   testmod(name="""chinese_remainder_theorem""", verbose=True)
   testmod(name="""chinese_remainder_theorem2""", verbose=True)
   testmod(name="""invert_modulo""", verbose=True)
   testmod(name="""extended_euclid""", verbose=True)

"""simple docstring"""



import os



def 					_lowerCamelCase(					):
       with open(os.path.dirname(a							) + "/grid.txt"							) as f:
              __a     				=  []  # noqa: E741
              for _ in range(2_0							):
                     l.append([int(a							) for x in f.readline().split()]							)

              __a     				=  0

              # right
              for i in range(2_0							):
                     for j in range(1_7							):
                            __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(1_7							):
                     for j in range(2_0							):
                            __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(1_7							):
                     for j in range(1_7							):
                            __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(1_7							):
                     for j in range(3 ,  2_0							):
                            __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())
