#include using namespace std; int main() { string a, b; cin >> a >> b; if (a.size() > b.size()) { cout << a << endl; } else if (a.size() < b.size()) { cout << b << endl; } else { for (int i = 0; i < a.size(); ++i) { if (a[i] > b[i] || (a[i] == '4' && b[i] == '7')) { cout << a << endl; goto end; } if (a[i] < b[i] && (a[i] != '4' && b[i] != '7')) { cout << b << endl; goto end; } } } cout << a << endl; end:; }