#include "bits/stdc++.h"
#define ll long long
using namespace std;

int int_length(ll x)
{
  ll count = 0;
  while (x != 0)
  {
    x = x / 10;
    count++;
  }
  return count;
}

int solve(ll a, ll b)
{
  ll len_a = int_length(a);
  ll len_b = int_length(b);
  ll len_res;
  ll maxlen = (len_a > len_b ? len_a : len_b);
  ll minlen = (len_a < len_b ? len_a : len_b);
  ll a_arr[maxlen];
  ll b_arr[maxlen];
  ll res_arr[maxlen + minlen];
  ll res = 0;
  ll c = maxlen - 1;
  ll raz = 0;
  for (ll i = maxlen; i > 0; i--, raz++)
  {
    if (raz > len_a)
      b_arr[c] = -1;
    else
    {
      a_arr[c] = a % 10;
      a = a / 10;
      --c;
    }
  }
  c = maxlen - 1;
  raz = 0;
  for (ll i = maxlen; i > 0; i--, raz++)
  {
    if (raz > len_b)
      b_arr[c] = -1;
    else
    {
      b_arr[c] = b % 10;
      b = b / 10;
      --c;
    }
  }
  c = 0;
  for (ll i = 0; i < maxlen; i++)
  {
    if (i < minlen)
    {
      if (a_arr[i] == b_arr[i])
      {
        res_arr[c] = a_arr[i];
        c++;
        res_arr[c] = b_arr[i];
        c++;
      }
      else if (a_arr[i] > b_arr[i])
      {
        res_arr[c] = a_arr[i];
        c++;
      }
      else if (a_arr[i] < b_arr[i])
      {
        res_arr[c] = b_arr[i];
        c++;
      }
    }
    else if (len_a > len_b)
    {
      res_arr[c] = a_arr[i];
      c++;
    }
    else if (len_a < len_b)
    {
      res_arr[c] = b_arr[i];
      c++;
    }
  }
  len_res = c;
  for (ll i = 0; i < len_res; i++)
  {
    res += res_arr[i];
    res *= 10;
  }
  return res / 10;
}

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  ll a, b;
  cin >> a >> b;

  cout << solve(a, b);

  return 0;
}