using System;
using System.Linq;

namespace P_2022_1_1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            char[] a = Console.ReadLine().ToCharArray();
            char[] b = Console.ReadLine().ToCharArray();
            Array.Reverse(a);
            Array.Reverse(b);
            int eredmeny = 0;
            int q = 0;
            int w = 0;
            if (a.Length == b.Length)
            {
                for (int i = 0; i < a.Length; i++)
                {
                    if (Convert.ToInt32(a[i]) > Convert.ToInt32(b[i]))
                    {
                        eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    else if (Convert.ToInt32(a[i]) < Convert.ToInt32(b[i]))
                    {
                        eredmeny += (int)Char.GetNumericValue(b[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    else
                    {
                        eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                        eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                }
            }
            else if (a.Length > b.Length)
            {
                for (int i = 0; i < b.Length; i++)
                {
                    if (Convert.ToInt32(a[i]) > Convert.ToInt32(b[i]))
                    {
                        eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    else if (Convert.ToInt32(a[i]) < Convert.ToInt32(b[i]))
                    {
                        eredmeny += (int)Char.GetNumericValue(b[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    else
                    {
                        eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                        eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    w = i;
                }
                for (int i = w + 1; i < a.Length; i++)
                {
                    eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                    q++;
                }
            }
            else
            {
                for (int i = 0; i < a.Length; i++)
                {
                    if (Convert.ToInt32(a[i]) > Convert.ToInt32(b[i]))
                    {
                        eredmeny += (int)Char.GetNumericValue(a[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    else if (Convert.ToInt32(a[i]) < Convert.ToInt32(b[i]))
                    {
                        eredmeny += (int)Char.GetNumericValue(b[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    else
                    {
                        eredmeny += (int)Char.GetNumericValue(b[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                        eredmeny += (int)Char.GetNumericValue(b[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                        q++;
                    }
                    w = i;
                }
                for (int i = w + 1; i < b.Length; i++)
                {
                    eredmeny += (int)Char.GetNumericValue(b[i]) * (int)Math.Pow(Convert.ToDouble(10), Convert.ToDouble(q));
                    q++;
                }
            }
            Console.WriteLine(eredmeny);
        }
    }
}