#problem 4

import math

def isPalidrome(test):
	return str(test) == str(test)[::-1] #op extended slicing feature

max = 0

for i in range(999,99,-1):
	for j in range(999,99,-1):
		prod = i*j
		if isPalidrome(prod) and prod > max:
			max = prod

print max