#include <bits/stdc++.h>
using namespace std;
ifstream fin("multiplu.in");
ofstream fout("multiplu.out");
int a, b, m, x;
queue<int> q;
bitset<100002> 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 || (x * 10) % m == 0 || (x * 10 + 1) % m == 0) break;
q.push(x * 10);
q.push(x * 10 + 1);
}
fout << q.front();
return 0;
}