#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { string A,B; cin >> A >> B; if ( A.length() > B.length() ) { cout << A << endl; return 0; } if ( A.length() < B.length() ) { cout << B << endl; return 0; } for ( int i = 0; i < A.length(); i++ ) { int a = A[i]-'0'; int b = B[i]-'0'; if ( a == b ) { continue; } bool f = a > b; if ( a == 7 && b == 4 ) { f = false; } if ( a == 4 && b == 7 ) { f = true; } cout << ( f ? A : B ) << endl; break; } return 0; }