using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text;
using System.Threading.Tasks;

namespace ZadatakA_SudarBrojeva
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Unesi x");
            long x = long.Parse(Console.ReadLine());
            Console.WriteLine("Unesi y");
            long y = long.Parse(Console.ReadLine());
            long bx, smx, dmx, mx, shx, dhx, hx, sx, dx, jx;
            long by, smy, dmy, my, shy, dhy, hy, sy, dy, jy;
            bx = x / 1000000000;
            smx = x % 1000000000 / 100000000;
            dmx = x % 100000000 / 10000000;
            mx = x % 10000000 / 1000000;
            shx = x % 1000000 / 100000;
            dhx = x % 100000 / 10000;
            hx = x % 10000 / 1000;
            sx = x % 1000 / 100;
            dx = x % 100 / 10;
            jx = x % 10;
            by = y / 1000000000;
            smy = y % 1000000000 / 100000000;
            dmy = y % 100000000 / 10000000;
            my = y % 10000000 / 1000000;
            shy = y % 1000000 / 100000;
            dhy = y % 100000 / 10000;
            hy = y % 10000 / 1000;
            sy = y % 1000 / 100;
            dy = y % 100 / 10;
            jy = y % 10;
            
            long nb, nB, nsm, ndm, nm, nsh, ndh, nh, ns, nd, nj;
            nb = 0;
            nB = bx;
            if (by >= bx)
            {
                if (by > bx)
                    nB = by;
                else if (by == bx)
                    nB = bx * 10 + by;
                else 
                    nB = bx;
            }
            nsm = smx;
            if (smy >= smx)
            {
                if (smy > smx)
                    nsm = smy;
                else if (smy == smx)
                    nsm = smx * 10 + smy;
                else 
                    nsm = smx;
            }
            ndm = dmx;
            if (dmy >= dmx)
            {
                if (dmy > dmx)
                    ndm = dmy;
                else if (dmy == dmx)
                    ndm = dmx * 10 + dmy;
                else
                    ndm = dmx;
            }
            nm = mx;
            if (my >= mx)
            {
                if (my > mx)
                    nm = my;
                else if (my == mx)
                    nm = mx * 10 + my;
                else
                    nm = mx;
            }
            nsh = shx;
            if (shy >= shx)
            {
                if (shy > shx)
                    nsh = shy;
                else if (shy == shx)
                    nsh = shx * 10 + shy;
                else 
                    nsh = shx;
            }
            ndh = dhx;
            if (dhy >= dhx)
            {
                if (dhy > dhx)
                    ndh = dhy;
                else if (dhy == dhx)
                    ndh = dhx * 10 + dhy;
                else
                    ndh = dhx;
            }
            nh = hx;
            if (hy >= hx)
            {
                if (hy > hx)
                    nh = hy;
                else if (hy == hx)
                    nh = hx * 10 + hy;
                else
                    nh = hx;
            }
            ns = sx;
            if (sy >= sx)
            {
                if (sy > sx)
                    ns = sy;
                else if (sy == sx)
                    ns = sx * 10 + sy;
                else
                    ns = sx;
            }
            nd = dx;
            if (dy >= dx)
            {
                if (dy > dx)
                    nd = dy;
                else if (dy == dx)
                    nd = dx * 10 + dy;
                else
                    nd = dx;
            }
            nj = jx;
            if (jy >= jx)
            {
                if (jy > jx)
                    nj = jy;
                else if (jy == jx)
                    nj = jx * 10 + jy;
                else
                    nj = jx;
            }
            nb += nj;
            if (nj > 10)
                nb += nd * 100;
            else
                nb += nd * 10;
            if (nd > 10)
                nb += ns * 1000;
            else
                nb += ns * 100;
            if (ns > 10)
                nb += nh * 10000;
            else
                nb += nh * 1000;
            if (nh > 10)
                nb += ndh * 100000;
            else 
                nb += ndh * 10000;
            if (ndh > 10)
                nb += nsh * 1000000;
            else
                nb += nsh * 100000;
            if (nsh > 10)
                nb += nm * 10000000;
            else
                nb += nm * 1000000;
            if (nm > 10)
                nb += ndm * 100000000;
            else
                nb += ndm * 10000000;
            if (ndm > 10)
                nb += nsm * 1000000000;
            else
                nb += nsm * 100000000;
            if (nsm > 10)
                nb += nB * 10000000000;
            else
                nb += nB * 1000000000;
            Console.WriteLine(nb);







        }
    }
}