



"""simple docstring"""

lowercase__			   =  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"





def       __magic_name__    (   ):
							__a		:		Dict									=       input("""Enter message: """					)
							__a		:		Union[str, Any]									=       input("""Enter key [alphanumeric]: """					)
							__a		:		Optional[Any]									=       input("""Encrypt/Decrypt [e/d]: """					)

							if mode.lower().startswith("""e"""					):
														__a		:		int									=       """encrypt"""
														__a		:		str									=       encrypt_message(_lowerCamelCase  ,       _lowerCamelCase					)
							elif mode.lower().startswith("""d"""					):
														__a		:		Optional[Any]									=       """decrypt"""
														__a		:		Optional[Any]									=       decrypt_message(_lowerCamelCase  ,       _lowerCamelCase					)

							print(F'''\n{mode.title()}ed message:'''					)
							print(_lowerCamelCase					)





def       __magic_name__    (   _lowerCamelCase				: str  ,       _lowerCamelCase				: str					):
							return translate_message(_lowerCamelCase  ,       _lowerCamelCase  ,       """encrypt"""					)





def       __magic_name__    (   _lowerCamelCase				: str  ,       _lowerCamelCase				: str					):
							return translate_message(_lowerCamelCase  ,       _lowerCamelCase  ,       """decrypt"""					)





def       __magic_name__    (   _lowerCamelCase				: str  ,       _lowerCamelCase				: str  ,       _lowerCamelCase				: str					):
							__a		:		Optional[int]									=       []
							__a		:		str									=       0
							__a		:		Union[str, Any]									=       key.upper()

							for symbol in message:
														__a		:		Dict									=       LETTERS.find(symbol.upper()					)
														if num != -1:
																					if mode == "encrypt":
																												num += LETTERS.find(key[key_index]					)
																					elif mode == "decrypt":
																												num -= LETTERS.find(key[key_index]					)

																					num %= len(_lowerCamelCase					)

																					if symbol.isupper():
																												translated.append(LETTERS[num]					)
																					elif symbol.islower():
																												translated.append(LETTERS[num].lower()					)

																					key_index += 1
																					if key_index == len(_lowerCamelCase					):
																												__a		:		Optional[int]									=       0
														else:
																					translated.append(_lowerCamelCase					)
							return "".join(_lowerCamelCase					)


if __name__ == "__main__":
	main()






"""simple docstring"""

import os





def       __magic_name__    (   _lowerCamelCase				: Dict					):
							__a		:		List[str]									=       len(grid[0]					)
							__a		:		int									=       len(_lowerCamelCase					)

							__a		:		Tuple									=       0
							__a		:		List[Any]									=       0
							__a		:		List[str]									=       0

							# Check vertically, horizontally, diagonally at the same time (only works
							# for nxn grid)
							for i in range(_lowerCamelCase					):
														for j in range(n_rows - 3					):
																					__a		:		List[Any]									=       grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
																					__a		:		Tuple									=       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		:		List[Any]									=       (
																												    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		:		str									=       max(
																					    _lowerCamelCase  ,       _lowerCamelCase  ,       _lowerCamelCase  ,       _lowerCamelCase					)
																					if max_product > largest:
																												__a		:		Optional[Any]									=       max_product

							return largest





def       __magic_name__    (   ):
							__a		:		Tuple									=       []
							with open(os.path.dirname(_lowerCamelCase					) + """/grid.txt"""					) as file:
														for line in file:
																					grid.append(line.strip("""\n"""					).split(""" """					)					)

							__a		:		Tuple									=       [[int(_lowerCamelCase					) for i in grid[j]] for j in range(len(_lowerCamelCase					)					)]

							return largest_product(_lowerCamelCase					)


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

