#include <bits/stdc++.h>
using namespace std;

int sudar(int x, int y, int m, int s, int n){
    if (x%m > y%m){
        s = x%m*n + s;
    }
    else if (x%m < y%m)
        s = y%m*n + s;
    else if (x == 0)
        s = y%m*n + s;
    else if (y == 0)
        s = x%m*n + s;
    else{
        s = y%m*n + s;
        n = n*10;
        s = x%m*n + s;
    }
    if(x == 0 || y== 0)
        return s;
    sudar(x/m, y/m, m, s, n*m);
}

int main(){
    int x, y;
    cin >> x >> y;
    int s = sudar(x, y, 10, 0, 1);
    
    cout << s;


    return 0;
}