#include <stdio.h>

int pow_i(int, int);

int main()
{
    int X, Y, Z = 0, brojac_cifara = 0;

    scanf("%d", &X);
    scanf("%d", &Y);

    if ((X < 1 || X > pow_i(10, 9)) || (Y < 1 || Y > pow_i(10, 9)))
        return 0;

    do
    {
        int cX = X % 10;
        int cY = Y % 10;

        if (X == 0 || Y == 0)
        {
            Z += (X != 0 ? cX : cY) * pow_i(10, brojac_cifara);
            brojac_cifara++;
        }
        else if (cX == cY) 
        {
            Z += cX * pow_i(10, brojac_cifara);
            brojac_cifara++;
            Z += cY * pow_i(10, brojac_cifara);
            brojac_cifara++;
        }
        else
        {
            Z += (cX > cY ? cX : cY) * pow_i(10, brojac_cifara);
            brojac_cifara++;
        }

        X /= 10;
        Y /= 10;
    } while (X > 0 || Y > 0);

    printf("%d", Z);
}

int pow_i(int base, int exp)
{
    if (exp == 0)
        return 1;

    int tmp = base;

    while (--exp)
        base *= tmp;

    return base;
}