public static void main(String[] args) {
		String s;
		char[] c;
		boolean check;
		ArrayList<Integer> arr = new ArrayList<Integer>();
		int result = 0;
		
		for(int i = 999; i > 0; i--)
		{
			for(int j = 999; j > 0; j--)
			{
				s = "" + (i*j);
				c = s.toCharArray();
				check = true;
				for(int x = 0; x < (c.length+1)/2; x++)
				{
					if(c[x] != c[c.length-x-1])
						check = false;
				}
				if(check)
				{
					arr.add(i * j);
				}
			}
		}
		
		for(int i : arr)
		{
			if(i > result)
				result = i;
		}
		System.out.println(result);
	}