#include <bits/stdc++.h>
using namespace std;
ifstream fin("multiplu.in");
ofstream fout("multiplu.out");
long long a, b, m, x;
queue<long long> q;
bitset<10002> fr;
static inline long long cmmdc(long long a, long long b) {
long long rest = a % b;
while(rest) {
a = b;
b = rest;
rest = a % b;
}
return b;
}
int main() {
fin >> a >> b;
m = a * b / cmmdc(a, b);
q.push(1);
fr[1] = 1;
while(q.front() % m != 0) {
x = q.front();
if(x % m == 0) break;
if(!fr[x * 10]) q.push(x * 10);
if(!fr[x * 10 + 1]) q.push(x * 10 + 1);
q.pop();
}
fout << q.front();
return 0;
}