#include<iostream>
    using namespace std;
     
    int main(){
        unsigned long long br1,br2;
        cin >> br1 >> br2;
        unsigned long long max;
        unsigned long long min;
        if (br1>=br2) {max=br1;min=br2;}
        else {max=br2;min=br1;}
        unsigned long long d=1;
        unsigned long long d0=1;
        while (max>=10){
            max=max/10;;
            d=d*10;
        }
        while (min>=10){
            min=min/10;;
            d0=d0*10;
        }
        unsigned long long br=0;
        unsigned long long c;
        while (d>=1){
            if ((br1/d)>(br2/d)) {c=br1/d;br=br+c*d;}
            else {
                if ((br1/d)<(br2/d)){
                    c=br2/d;
                    br=br+c*d;
                }
                else {
                    c=br1/d;
                    if (c==0 && d>d0) {}
                    else{
                        br=br*10;
                        br=br+11*d*c;
                    }
     
                }
            }
     
            br1=br1-(br1/d)*d;
            br2=br2-(br2/d)*d;
            d=d/10;
     
        }
        cout << br;
        return 0;
    }