#include <iostream>
#include <algorithm>

using namespace std;

int main(){

long long x, y;
cin>>x>>y;
int pom;
int tmp;

int max = x;
int min = x;
if(y > x) {
    max = y;
}
if(y < x) {
    min = y;
}
int max2 = 0;
int sum = 0;
int i = 1;
while(max != 0) {
    pom = max % 10;
    max /= 10;
    if(min != 0) {
        tmp = min % 10;
        min/=10;
        //cout<<tmp;
        
        //cout<<pom;
        if(pom > tmp) {
            sum = sum + pom * i;
            //cout<<pom;
        }else if(pom < tmp) {
            sum = sum + tmp * i;
            //cout<<tmp;
        }
        else {
            sum = sum + (pom * i + tmp * i * 10);
            i=i*10;
            //cout<<pom<<tmp;
        }
    }else{
        sum = sum + pom * i;
       // cout<<pom;
    }
    
    i = i * 10;
    
    //cout<<endl;
}
cout<<sum;

    
}