#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int main() { llong aa, bb; cin >> aa >> bb; string a = to_string(aa); string b = to_string(bb); if(a.length() == b.length()) { bool awin; rep(i, a.length()) { int ai = stoi(""s + a[i]); int bi = stoi(""s + b[i]); if(ai == bi) continue; awin = ai > bi; if(ai == 7 && bi == 4) awin = false; else if(ai == 4 && bi == 7) awin = true; break; } if(awin) { cout << a << "\n"; } else { cout << b << "\n"; } } else if(a.length() > b.length()) { cout << a << "\n"; } else { cout << b << "\n"; } }