"""simple docstring"""



import os



def 					_lowerCamelCase(					a = "matrix.txt"							):
       with open(os.path.join(os.path.dirname(a							) ,  a							)							) as in_file:
              __a     				=  in_file.read()

       __a     				=  [[int(a							) for cell in row.split(","							)] for row in data.strip().splitlines()]
       __a     				=  [[0 for cell in row] for row in grid]
       __a     				=  len(grid[0]							)

       __a     				=  [[0 for i in range(a							)] for j in range(a							)]
       __a     				=  grid[0][0]
       for i in range(1 ,  a							):
              __a     				=  grid[0][i] + dp[0][i - 1]
       for i in range(1 ,  a							):
              __a     				=  grid[i][0] + dp[i - 1][0]

       for i in range(1 ,  a							):
              for j in range(1 ,  a							):
                     __a     				=  grid[i][j] + min(dp[i - 1][j] ,  dp[i][j - 1]							)

       return dp[-1][-1]


if __name__ == "__main__":
   print(F'''{solution() = }''')

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