

"""simple docstring"""




import os



def 	UpperCAmelCase__   (				A__   )      ->      Any:




   """simple docstring"""
   lowerCamelCase__						=			len(grid[0]   )
   lowerCamelCase__						=			len(A__   )

   lowerCamelCase__						=			0
   lowerCamelCase__						=			0
   lowerCamelCase__						=			0

   # Check vertically, horizontally, diagonally at the same time (only works
   # for nxn grid)
   for i in range(A__   ):
      for j in range(n_rows - 3   ):
         lowerCamelCase__						=			grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
         lowerCamelCase__						=			grid[i][j] * grid[i][j + 1] * grid[i][j + 2] * grid[i][j + 3]

         # Left-to-right diagonal (\) product
         if i < n_columns - 3:
            lowerCamelCase__						=			(
                grid[i][j]
                * grid[i + 1][j + 1]
                * grid[i + 2][j + 2]
                * grid[i + 3][j + 3]
            )

         # Right-to-left diagonal(/) product
         if i > 2:
            lowerCamelCase__						=			(
                grid[i][j]
                * grid[i - 1][j + 1]
                * grid[i - 2][j + 2]
                * grid[i - 3][j + 3]
            )

         lowerCamelCase__						=			max(
             A__	,    A__	,    A__	,    A__   )
         if max_product > largest:
            lowerCamelCase__						=			max_product

   return largest



def 	UpperCAmelCase__   (				)      ->      str:




   """simple docstring"""
   lowerCamelCase__						=			[]
   with open(os.path.dirname(A__   ) + "/grid.txt"   ) as file:
      for line in file:
         grid.append(line.strip("\n"   ).split(" "   )   )

   lowerCamelCase__						=			[[int(A__   ) for i in grid[j]] for j in range(len(A__   )   )]

   return largest_product(A__   )


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







"""simple docstring"""




def 	UpperCAmelCase__   (				A__   )      ->      list[int]:




   """simple docstring"""

   if length <= 0 or not isinstance(A__	,    A__   ):
      raise ValueError("Length must be a positive integer."   )
   return [n * (2 * n - 1) for n in range(A__   )]


if __name__ == "__main__":
     print(hexagonal_numbers(length=5))
     print(hexagonal_numbers(length=10))




