import os







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

  SCREAMING_SNAKE_CASE__:   Union[str, Any]=      0

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

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

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

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


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


def 			A__      (	snake_case_ :		str      ):
 if not head:
  return True
 # split the list to two parts
 SCREAMING_SNAKE_CASE__,	SCREAMING_SNAKE_CASE__:   Optional[int]=      head.next, head
 while fast and fast.next:
  SCREAMING_SNAKE_CASE__:   Dict=      fast.next.next
  SCREAMING_SNAKE_CASE__:   Union[str, Any]=      slow.next
 SCREAMING_SNAKE_CASE__:   Union[str, Any]=      slow.next
 SCREAMING_SNAKE_CASE__:   Union[str, Any]=      None  # Don't forget here! But forget still works!
 # reverse the second part
 SCREAMING_SNAKE_CASE__:   Optional[int]=      None
 while second:
  SCREAMING_SNAKE_CASE__:   Any=      second.next
  SCREAMING_SNAKE_CASE__:   int=      node
  SCREAMING_SNAKE_CASE__:   Optional[Any]=      second
  SCREAMING_SNAKE_CASE__:   Any=      nxt
 # compare two parts
 # second part has the same or one less node
 while node:
  if node.val != head.val:
   return False
  SCREAMING_SNAKE_CASE__:   Tuple=      node.next
  SCREAMING_SNAKE_CASE__:   Optional[int]=      head.next
 return True







def 			A__      (	snake_case_ :		Optional[Any]      ):
 if not head or not head.next:
  return True

 # 1. Get the midpoint (slow)
 SCREAMING_SNAKE_CASE__:   List[Any]=      head
 while fast and fast.next:
  SCREAMING_SNAKE_CASE__,	SCREAMING_SNAKE_CASE__:   Any=      fast.next.next, slow.next

 # 2. Push the second half into the stack
 SCREAMING_SNAKE_CASE__:   Optional[Any]=      [slow.val]
 while slow.next:
  SCREAMING_SNAKE_CASE__:   Optional[int]=      slow.next
  stack.append(slow.val      )

 # 3. Comparison
 while stack:
  if stack.pop() != cur.val:
   return False
  SCREAMING_SNAKE_CASE__:   Tuple=      cur.next

 return True







def 			A__      (	snake_case_ :		Any      ):
 if not head or not head.next:
  return True
 SCREAMING_SNAKE_CASE__:   Optional[int]=      {}
 SCREAMING_SNAKE_CASE__:   Union[str, Any]=      0
 while head:
  if head.val in d:
   d[head.val].append(snake_case_      )
  else:
   SCREAMING_SNAKE_CASE__:   Optional[int]=      [pos]
  SCREAMING_SNAKE_CASE__:   Dict=      head.next
  pos += 1
 SCREAMING_SNAKE_CASE__:   Dict=      pos - 1
 SCREAMING_SNAKE_CASE__:   str=      0
 for v in d.values():
  if len(snake_case_      ) % 2 != 0:
   middle += 1
  else:
   SCREAMING_SNAKE_CASE__:   List[Any]=      0
   for i in range(0       ,				len(snake_case_      )      ):
    if v[i] + v[len(snake_case_      ) - 1 - step] != checksum:
     return False
    step += 1
  if middle > 1:
   return False
 return True

