#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0); int a, b; cin >> a >> b; string x = to_string(a), y = to_string(b); if (x.length() > y.length()) cout << x << endl; else if (x.length() < y.length()) cout << y << endl; else { for (int i = 0; i < x.length(); i++) { if (x[i] == y[i]) continue; if (x[i] == '4' && y[i] == '7') cout << x << endl; else if (x[i] == '7' && y[i] == '4') cout << y << endl; else if (x[i] > y[i]) cout << x << endl; else cout << y << endl; break; } } return 0; }