


import os



def 			lowerCAmelCase (		)-> Optional[Any]:
				with open(os.path.dirname(lowerCAmelCase_ ) + '''/grid.txt''' ) as f:
								lowerCAmelCase_ :      List[str]    				=				[]  # noqa: E741
								for _ in range(20 ):
												l.append([int(lowerCAmelCase_ ) for x in f.readline().split()] )

								lowerCAmelCase_ :      List[str]    				=				0

								# right
								for i in range(20 ):
												for j in range(17 ):
																lowerCAmelCase_ :      List[str]    				=				l[i][j] * l[i][j + 1] * l[i][j + 2] * l[i][j + 3]
																if temp > maximum:
																				lowerCAmelCase_ :      Optional[Any]    				=				temp

        # down
								for i in range(17 ):
												for j in range(20 ):
																lowerCAmelCase_ :      str    				=				l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
																if temp > maximum:
																				lowerCAmelCase_ :      Union[str, Any]    				=				temp

        # diagonal 1
								for i in range(17 ):
												for j in range(17 ):
																lowerCAmelCase_ :      Tuple    				=				l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
																if temp > maximum:
																				lowerCAmelCase_ :      Tuple    				=				temp

        # diagonal 2
								for i in range(17 ):
												for j in range(3 ,   20 ):
																lowerCAmelCase_ :      Optional[Any]    				=				l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
																if temp > maximum:
																				lowerCAmelCase_ :      Any    				=				temp
								return maximum


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



def 			lowerCAmelCase (		lowerCAmelCase_ = 1_000_000 )-> int:
				lowerCAmelCase_ :      Dict    				=				1
				lowerCAmelCase_ :      List[Any]    				=				1
				lowerCAmelCase_ :      Optional[Any]    				=				{1: 1}

				for inputa in range(2 ,   lowerCAmelCase_ ):
								lowerCAmelCase_ :      Tuple    				=				0
								lowerCAmelCase_ :      Dict    				=				inputa

								while True:
												if number in counters:
																counter += counters[number]
																break
												if number % 2 == 0:
																number //= 2
																counter += 1
												else:
																lowerCAmelCase_ :      Any    				=				(3 * number) + 1
																counter += 1

								if inputa not in counters:
												lowerCAmelCase_ :      Tuple    				=				counter

								if counter > pre_counter:
												lowerCAmelCase_ :      Optional[int]    				=				inputa
												lowerCAmelCase_ :      Union[str, Any]    				=				counter
				return largest_number


if __name__ == "__main__":
						print(solution(int(input().strip())))