#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) typedef long long ll; int main(){ string a, b; cin >> a >> b; ll A = 0, B = 0; FOR(i,0,a.length()){ A *= 10; A += a[i] == '4' ? 8 : a[i] - '0'; } FOR(i,0,b.length()){ B *= 10; B += b[i] == '4' ? 8 : b[i] - '0'; } cout << (A > B ? a : b) << endl; return 0; }