#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    ll a, b;
    cin >> a;
    cin >> b;
    ll rez = 0;
    ll stepen = 1;
    while(a != 0 && b != 0){
        ll c1 = a % 10;
        ll c2 = b % 10;
        if(c1 == c2){
            rez += stepen * c1 + (stepen * 10) * c1;
            stepen *= 100;
        }
        else if(c1 > c2){
            rez += c1 * stepen;
            stepen *= 10;
        }
        else{
            rez += c2 * stepen;
            stepen *= 10;
        }
        a = a / 10;
        b = b / 10;
    }
    while(a != 0){
        ll cifra = a % 10;
        rez += cifra * stepen;
        stepen *= 10;
        a = a / 10;
    }
    while(b != 0){
        ll cifra = b % 10;
        rez += cifra * stepen;
        stepen *= 10;
        b = b / 10;
    }
    cout << rez;
}