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

void conv(vector<int>& vec, ll a)
{
    while(a>9)
    {
        vec.push_back(a%10);
        a/=10;
    }
    vec.push_back(a);
}

void print_vec(vector<int> v)
{
    for(int t:v)
        cout<<t<<" ";
    cout<<endl;
}

int main()
{
    ll x, y;cin>>x>>y;
    vector<int> broj1, broj2;

    conv(broj1, x);
    conv(broj2, y);

    int i = 0;
    ll ans = 0, st = 1;
    while(i<broj1.size() && i<broj2.size())
    {
        if(broj1[i]>=broj2[i])
        {
            ans += st*broj1[i];
            st*=10;
        }
        if(broj1[i]<=broj2[i])
        {
            ans += st*broj2[i];
            st*=10;
        }
        i++;
    }
    while(i<broj1.size())
    {
        ans += st*broj1[i];
        st*=10;
        i++;
    }
    while(i<broj2.size())
    {
        ans += st*broj2[i];
        st*=10;
        i++;
    }

    cout<<ans;


    return 0;
}