#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) ((v).begin()), ((v).end())

void BRO(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
template <typename T> void stop(T x){return void(cout << x << endl);}
void HIRO(void) {
#ifndef ONLINE_JUDGE
    freopen("D:\\Personal\\No\\CP\\input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);

#endif
}
const long long mod = 1e9 + 7;
const int MOD = 998244353;
/*
  When I wrote this, only Allah and I understood what I was doing
  Now, only Allah knows
  */

int dp[20][2][2][2];
void get_this_shit_done() {
    string a , b;
    cin >> a >> b;
    if(a.size() < b.size()){
        std::reverse(a.begin(), a.end());
        while(a.size() < b.size()) a.push_back('0');
        std::reverse(a.begin(), a.end());
    }
    // dp[idx][low][high][started]
    memset(dp, -1, sizeof dp);
    function<int(int, bool, bool, bool)> go = [&](int idx, bool low, bool high, bool started)-> int {
        if(idx == a.size()){
            return 1;
        }
        int &ret = dp[idx][low][high][started];
        if(~ret)
            return ret;
        ret = 0;
        int mn = low ? a[idx] - '0' : 0;
        int mx = high ? b[idx] - '0' : 9;
        if(not started){
            for(int i = mn ; i <= mx ; i++){
                if(i != 0)
                    ret = max(ret, go(idx + 1, low & (i == mn), high & ( i == mx ), true) * i);
                else
                    ret = go(idx + 1, low & (i == mn), high & (i == mx), false);
            }
        }else{
            for (int i = mn; i <= mx ; ++i) {
                ret = max(ret, go(idx + 1, low & (i == mn), high & ( i == mx ), started) * i);
            }
        }
        return ret;
    };
    int res = go(0, true, true, false);
    vector<int>v;
    function<void(int, bool, bool, bool)> build = [&](int idx, bool low, bool high, bool started) -> void {
        if(idx == b.size()) return;
        int ret = go(idx, low, high, started);
        int mn = low ? a[idx] - '0' : 0;
        int mx = high ? b[idx] - '0' : 9;
        if(not started){
            for(int i = mn ; i <= mx ; i++){
                if(i != 0){
                    if(ret == go(idx + 1, low & (i == mn), high & (i == mx), true) * i){
                        cout << i;
                        build(idx + 1, low & (i == mn), high & (i == mx), true);
                        
                    }
                } else {
                    if(ret == go(idx + 1, low & (i == mn), high & (i == mx), false)) {
                        build(idx + 1, low & (i == mn), high & (i == mx), false);
                       
                    }
                }
            }
        } else {
            for (int i = mn; i <= mx ; ++i) {
                if(ret == go(idx + 1, low & (i == mn), high & (i == mx), started) * i) {
                    cout << i;
                    build(idx + 1, low & (i == mn), high & (i == mx), started);
                   
                }
            }
        }
    };

    build(0, true, true, false);
}

signed main() {
    BRO();
    HIRO();
    //freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    int t = 1 ;
    //cin >> t;
    while(t--){
        get_this_shit_done();
    }
}
