#include <stdio.h>
#include <math.h>

int main()
{
    
    int resenje = 0, broj1 = 0, broj2 = 0, i = 0, arrlen = 0, arrlen1 = 0, arrlen2 = 0, mnozenje=1, deo1 = 0, deo2 = 0, deo = 0;
    
    scanf("%d %d", &broj1, &broj2);
    
    
    arrlen1=(broj1==0)?1:log10(broj1)+1;
    arrlen2=(broj2==0)?1:log10(broj2)+1;
    
    if (arrlen1>= arrlen2) arrlen = arrlen1;
    else if (arrlen2 >= arrlen1) arrlen= arrlen2;
    
    for (i=1; i<=arrlen;i++){
        deo1 = broj1 % 10; deo2 = broj2 % 10;
        deo = deo2;
        if (deo1>deo2) deo = deo1;
        if (arrlen1 > 0 && arrlen2 > 0) {
            if (deo1==deo2) {
                resenje+=deo1*mnozenje;
                mnozenje*= 10;
                resenje+=deo1*mnozenje;
            }
            else{
                resenje+=deo*mnozenje;
            }
            arrlen1--; arrlen2--;
        }
        else if (arrlen1 == 0) {
            resenje+=deo2*mnozenje;
            arrlen2--;
        }
        else if (arrlen2 == 0) {
            resenje+=deo1*mnozenje;
            arrlen1--;
        }
        broj1=broj1/10; broj2=broj2/10;
        mnozenje*=10;
    }
    
    printf("%d\n", resenje);

    return 0;
}