#include<iostream>
using namespace std;

int main(){
    int br1,br2;
    cin >> br1 >> br2;
    int max;
    int min;
    if (br1>=br2) {max=br1;min=br2;}
    else {max=br2;min=br1;}
    int d=1;
    int 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;
    int 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;
}