"""simple docstring"""



from __future__ import annotations

import time
from collections.abc import Sequence
from random import randint

from matplotlib import pyplot as plt



def 					_lowerCamelCase(					a ,  a ,  a							):
       if not arr:
              return None, None, 0
       if low == high:
              return low, high, arr[low]

       __a     				=  (low + high) // 2
       __a				, __a				, __a     				=  max_subarray(a ,  a ,  a							)
       __a				, __a				, __a     				=  max_subarray(a ,  mid + 1 ,  a							)
       __a				, __a				, __a     				=  max_cross_sum(a ,  a ,  a ,  a							)
       if left_sum >= right_sum and left_sum >= cross_sum:
              return left_low, left_high, left_sum
       elif right_sum >= left_sum and right_sum >= cross_sum:
              return right_low, right_high, right_sum
       return cross_left, cross_right, cross_sum



def 					_lowerCamelCase(					a ,  a ,  a ,  a							):
       __a				, __a     				=  float("-inf"							), -1
       __a				, __a     				=  float("-inf"							), -1

       __a     				=  0
       for i in range(a ,  low - 1 ,  -1							):
              summ += arr[i]
              if summ > left_sum:
                     __a     				=  summ
                     __a     				=  i

       __a     				=  0
       for i in range(mid + 1 ,  high + 1							):
              summ += arr[i]
              if summ > right_sum:
                     __a     				=  summ
                     __a     				=  i

       return max_left, max_right, (left_sum + right_sum)



def 					_lowerCamelCase(					a							):
       __a     				=  [randint(1 ,  a							) for _ in range(a							)]
       __a     				=  time.time()
       max_subarray(a ,  0 ,  input_size - 1							)
       __a     				=  time.time()
       return end - start



def 					_lowerCamelCase(					):
       __a     				=  [1_0, 1_0_0, 1_0_0_0, 1_0_0_0_0, 5_0_0_0_0, 1_0_0_0_0_0, 2_0_0_0_0_0, 3_0_0_0_0_0, 4_0_0_0_0_0, 5_0_0_0_0_0]
       __a     				=  [time_max_subarray(a							) for input_size in input_sizes]
       print("No of Inputs\t\tTime Taken"							)
       for input_size, runtime in zip(a ,  a							):
              print(a ,  "\t\t" ,  a							)
       plt.plot(a ,  a							)
       plt.xlabel("Number of Inputs"							)
       plt.ylabel("Time taken in seconds"							)
       plt.show()


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

   testmod()

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