

'''simple docstring'''





class 				__lowerCAmelCase  :




  def __init__(       self      )						->				Dict:
        '''simple docstring'''






        _lowercase			 =0
        _lowercase			 =0
        _lowercase			 ={}




  def 						A__  (       self							,     lowerCAmelCase      )						->				str:
        '''simple docstring'''






        if vertex not in self.adjacency:
              _lowercase			 ={}
              self.num_vertices += 1




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase							,     lowerCAmelCase      )						->				List[Any]:
        '''simple docstring'''






        self.add_vertex(_snake_case      )
        self.add_vertex(_snake_case      )

        if head == tail:
              return

        _lowercase			 =weight
        _lowercase			 =weight




  def 						A__  (       self      )						->				List[Any]:
        '''simple docstring'''






        _lowercase			 =self.get_edges()
        for edge in edges:
              _lowercase , _lowercase , _lowercase			 =edge
              edges.remove((tail, head, weight)      )
        for i in range(len(_snake_case      )      ):
              _lowercase			 =list(edges[i]      )

        edges.sort(key=lambda lowerCAmelCase      : e[2]      )
        for i in range(len(_snake_case      ) - 1      ):
              if edges[i][2] >= edges[i + 1][2]:
                    _lowercase			 =edges[i][2] + 1
        for edge in edges:
              _lowercase , _lowercase , _lowercase			 =edge
              _lowercase			 =weight
              _lowercase			 =weight




  def __str__(       self      )						->				Optional[Any]:
        '''simple docstring'''






        _lowercase			 =''
        for tail in self.adjacency:
              for head in self.adjacency[tail]:
                    _lowercase			 =self.adjacency[head][tail]
                    string += F'''{head} -> {tail} == {weight}\n'''
        return string.rstrip('\n'      )




  def 						A__  (       self      )						->				int:
        '''simple docstring'''






        _lowercase			 =[]
        for tail in self.adjacency:
              for head in self.adjacency[tail]:
                    output.append((tail, head, self.adjacency[head][tail])      )
        return output




  def 						A__  (       self      )						->				Dict:
        '''simple docstring'''






        return self.adjacency.keys()




  @staticmethod
  def 						A__  (       lowerCAmelCase=None							,     lowerCAmelCase=None      )						->				List[Any]:
        '''simple docstring'''






        _lowercase			 =Graph()
        if vertices is None:
              _lowercase			 =[]
        if edges is None:
              _lowercase			 =[]
        for vertex in vertices:
              g.add_vertex(_snake_case      )
        for edge in edges:
              g.add_edge(*_snake_case      )
        return g





  class 				__lowerCAmelCase  :




    def __init__(       self      )						->				List[Any]:
          '''simple docstring'''






          _lowercase			 ={}
          _lowercase			 ={}




    def __len__(       self      )						->				int:
          '''simple docstring'''






          return len(self.parent      )




    def 						A__  (       self							,     lowerCAmelCase      )						->				List[str]:
          '''simple docstring'''






          if item in self.parent:
                return self.find(_snake_case      )

          _lowercase			 =item
          _lowercase			 =0
          return item




    def 						A__  (       self							,     lowerCAmelCase      )						->				List[Any]:
          '''simple docstring'''






          if item not in self.parent:
                return self.make_set(_snake_case      )
          if item != self.parent[item]:
                _lowercase			 =self.find(self.parent[item]      )
          return self.parent[item]




    def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase      )						->				Dict:
          '''simple docstring'''






          _lowercase			 =self.find(_snake_case      )
          _lowercase			 =self.find(_snake_case      )

          if roota == roota:
                return roota

          if self.rank[roota] > self.rank[roota]:
                _lowercase			 =roota
                return roota

          if self.rank[roota] < self.rank[roota]:
                _lowercase			 =roota
                return roota

          if self.rank[roota] == self.rank[roota]:
                self.rank[roota] += 1
                _lowercase			 =roota
                return roota
          return None




  @staticmethod
  def 						A__  (       lowerCAmelCase      )						->				List[Any]:
        '''simple docstring'''






        _lowercase			 =graph.num_vertices

        _lowercase			 =Graph.UnionFind()
        _lowercase			 =[]
        while num_components > 1:
              _lowercase			 ={}
              for vertex in graph.get_vertices():
                    _lowercase			 =-1

              _lowercase			 =graph.get_edges()
              for edge in edges:
                    _lowercase , _lowercase , _lowercase			 =edge
                    edges.remove((tail, head, weight)      )
              for edge in edges:
                    _lowercase , _lowercase , _lowercase			 =edge
                    _lowercase			 =union_find.find(_snake_case      )
                    _lowercase			 =union_find.find(_snake_case      )
                    if seta != seta:
                          if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
                                _lowercase			 =[head, tail, weight]

                          if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
                                _lowercase			 =[head, tail, weight]
              for vertex in cheap_edge:
                    if cheap_edge[vertex] != -1:
                          _lowercase , _lowercase , _lowercase			 =cheap_edge[vertex]
                          if union_find.find(_snake_case      ) != union_find.find(_snake_case      ):
                                union_find.union(_snake_case							,     _snake_case      )
                                mst_edges.append(cheap_edge[vertex]      )
                                _lowercase			 =num_components - 1
        _lowercase			 =Graph.build(edges=_snake_case      )
        return mst





import os
def   a   (    )					->   Optional[int]:





      """simple docstring"""



      with open(os.path.dirname(A__  ) + '/grid.txt'  ) as f:
            _lowercase			 =[]  # noqa: E741
            for _ in range(20  ):
                  l.append([int(A__  ) for x in f.readline().split()]  )

            _lowercase			 =0

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

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

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

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


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


