


'''simple docstring'''

import os

def _SCREAMING_SNAKE_CASE (A			)			->			str:






       """simple docstring"""







       lowercase__      =					len(grid[0]			)
       lowercase__      =					len(A			)

       lowercase__      =					0
       lowercase__      =					0
       lowercase__      =					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			):
                     lowercase__      =					grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
                     lowercase__      =					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:
                            lowercase__      =					(
                                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:
                            lowercase__      =					(
                                grid[i][j]
                                * grid[i - 1][j + 1]
                                * grid[i - 2][j + 2]
                                * grid[i - 3][j + 3]
                            )

                     lowercase__      =					max(
                         A    ,					A    ,					A    ,					A			)
                     if max_product > largest:
                            lowercase__      =					max_product

       return largest

def _SCREAMING_SNAKE_CASE ()			->			Optional[Any]:






       """simple docstring"""







       lowercase__      =					[]
       with open(os.path.dirname(A			) + '''/grid.txt'''			) as file:
              for line in file:
                     grid.append(line.strip('''\n'''			).split(''' '''			)			)

       lowercase__      =					[[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 _SCREAMING_SNAKE_CASE (A = 1_000			)			->			int:






       """simple docstring"""







       return sum(2 * a * ((a - 1) // 2) for a in range(3    ,					n + 1			)			)


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




