#include <iostream>

using namespace std;

int main()
{
	int a,b,c,d;
	cin >> a;
	cin >> b;
	c = (a%10)*100+((a-(a%10))%100)+(((a-(a%100))%1000)/100);
	d = (b%10)*100+((b-(b%10))%100)+(((b-(b%100))%1000)/100);
	if (c < d){cout << d << endl;}
	else {cout << c << endl;}
	return 0;
}
