





'''simple docstring'''




import os






def 	_lowerCAmelCase      (  __snake_case  :			List[str]      )					->					Optional[Any]:
     __A						:			List[str]								=	len(grid[0]      )
     __A						:			List[Any]								=	len(__snake_case      )

     __A						:			int								=	0
     __A						:			List[str]								=	0
     __A						:			int								=	0

     # Check vertically, horizontally, diagonally at the same time (only works
     # for nxn grid)
     for i in range(__snake_case      ):
          for j in range(n_rows - 3      ):
               __A						:			Union[str, Any]								=	grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
               __A						:			Union[str, Any]								=	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:
                    __A						:			Dict								=	(
                        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:
                    __A						:			List[Any]								=	(
                        grid[i][j]
                        * grid[i - 1][j + 1]
                        * grid[i - 2][j + 2]
                        * grid[i - 3][j + 3]
                    )

               __A						:			Tuple								=	max(
                   __snake_case			,							__snake_case			,							__snake_case			,							__snake_case      )
               if max_product > largest:
                    __A						:			str								=	max_product

     return largest






def 	_lowerCAmelCase      (  )					->					str:
     __A						:			List[str]								=	[]
     with open(os.path.dirname(__snake_case      ) + '/grid.txt'      ) as file:
          for line in file:
               grid.append(line.strip('\n'      ).split(' '      )      )

     __A						:			List[str]								=	[[int(__snake_case      ) for i in grid[j]] for j in range(len(__snake_case      )      )]

     return largest_product(__snake_case      )


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






'''simple docstring'''




import math






def 	_lowerCAmelCase      (  __snake_case  :			int      )					->					bool:

     if 1 < number < 4:
          # 2 and 3 are primes
          return True
     elif number < 2 or number % 2 == 0 or number % 3 == 0:
          # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
          return False

     # All primes number are in format of 6k +/- 1
     for i in range(5			,							int(math.sqrt(__snake_case      ) + 1      )			,							6      ):
          if number % i == 0 or number % (i + 2) == 0:
               return False
     return True






def 	_lowerCAmelCase      (  __snake_case  :			float = 0.1      )					->					int:
     __A						:			Dict								=	3
     __A						:			int								=	3

     while primes / (2 * j - 1) >= ratio:
          for i in range(j * j + j + 1			,							(j + 2) * (j + 2)			,							j + 1      ):
               primes += is_prime(__snake_case      )
          j += 2
     return j


if __name__ == "__main__":
  import doctest

  doctest.testmod()