#include <iostream>
#define ll long long

using namespace std;

int main() {
  ll x, y, nbr=0;
  cin >> x >> y;

  ll mesto=1;
  ll veci_br, manji_br;
  veci_br = x > y ? x : y;
  manji_br = x > y ? y : x;

  ll vbc, mbc, vcfr;

  while(veci_br > 0) {
    vbc = veci_br%(ll)10;

    if (manji_br < 1) {
      vcfr = vbc;
      nbr += mesto*vcfr;
      mesto*=(ll)10;

    } else {
      mbc = manji_br%(ll)10;
      manji_br/=(ll)10;
      vcfr = vbc > mbc ? vbc : mbc;

      if (mbc == vbc) {
        nbr += mesto*vcfr;
        mesto*=(ll)10;
        nbr += mesto*vcfr;
        mesto*=(ll)10;
      } else {
        nbr += mesto*vcfr;
        mesto*=(ll)10;
      }
    }

    veci_br/=(ll)10;
  }

  cout << nbr << endl;

  return 0;
}