



"""simple docstring"""


import os

def 			_lowerCAmelCase				(       lowercase_						):
						UpperCAmelCase					=			len(grid[0]						)
						UpperCAmelCase					=			len(lowercase_						)

						UpperCAmelCase					=			0
						UpperCAmelCase					=			0
						UpperCAmelCase					=			0

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

																		UpperCAmelCase					=			max(
																		    lowercase_		,     lowercase_		,     lowercase_		,     lowercase_						)
																		if max_product > largest:
																								UpperCAmelCase					=			max_product

						return largest

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

						UpperCAmelCase					=			[[int(lowercase_						) for i in grid[j]] for j in range(len(lowercase_						)						)]

						return largest_product(lowercase_						)


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









"""simple docstring"""


from math import factorial, radians

def 			_lowerCAmelCase				(       lowercase_		,     lowercase_ = 18		,     lowercase_ = 10						):
						UpperCAmelCase					=			angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0)

						# Converting from degrees to radians
						UpperCAmelCase					=			radians(lowercase_						)

						UpperCAmelCase					=			angle_in_radians
						UpperCAmelCase					=			3
						UpperCAmelCase					=			-1

						for _ in range(lowercase_						):
												result += (b * (angle_in_radians**a)) / factorial(lowercase_						)

												UpperCAmelCase					=			-b  # One positive term and the next will be negative and so on...
												a += 2  # Increased by 2 for every term.

						return round(lowercase_		,     lowercase_						)


if __name__ == "__main__":
				__import__("""doctest""").testmod()





