'''simple docstring'''




import os






def __lowerCAmelCase			(							)     ->   Union[str, Any]:
    with open(os.path.dirname(UpperCamelCase__    ) + '''/grid.txt'''    ) as f:
        __lowerCamelCase          =  []  # noqa: E741
        for _ in range(20    ):
            l.append([int(UpperCamelCase__    ) for x in f.readline().split()]    )

        __lowerCamelCase          =  0

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

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

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

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


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

'''simple docstring'''




from __future__ import annotations

from typing import Any






def __lowerCAmelCase			(							UpperCamelCase__    )     ->   None:
    create_state_space_tree(UpperCamelCase__    ,  []    ,  0    )






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    ,  UpperCamelCase__    )     ->   None:

    if index == len(UpperCamelCase__    ):
        print(UpperCamelCase__    )
        return

    create_state_space_tree(UpperCamelCase__    ,  UpperCamelCase__    ,  index + 1    )
    current_subsequence.append(sequence[index]    )
    create_state_space_tree(UpperCamelCase__    ,  UpperCamelCase__    ,  index + 1    )
    current_subsequence.pop()


if __name__ == "__main__":
  __UpperCAmelCase												=[3, 1, 2, 4]
  generate_all_subsequences(seq)

  seq.clear()
  seq.extend(["A", "B", "C"])
  generate_all_subsequences(seq)
