#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define F first
#define S second
#define loop(a,n) for(int i=a; i<=n ; i++)
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define NAME "B99E"
using namespace std;

int dem(ll x) {
    return to_string(x).size();
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen(NAME".INP", "r", stdin);
    //freopen(NAME".OUT", "w", stdout);
    int b, e;
    while (cin >> b >> e) {
        bool tim = false;
        for (int len = 1; len <= 50; len++) {
            ll pow10 = 1;
            for (int i = 0; i < len + 1; i++) pow10 *= 10;
            ll tu = b * pow10 + e;
            if (tu % 89 != 0) continue;
            ll n = tu / 89;
            if (dem(n) == len) {
                cout << n << endl;
                tim = true;
                break;
            }
        }
        if (!tim) cout << 0 << endl;
    }
    return 0;
}
