#include <fstream>
#define DIM 2000010
using namespace std;
ifstream fin ("multiplu.in" );
ofstream fout("multiplu.out");
int N, M, i, j, K, ok, minim;
int C[DIM], a, b, r, X, Y, Z;
int F[DIM], p, u;
int CMMDC(int a, int b){
int c;
while(b != 0){
c = a % b;
a = b;
b = c;
}
return a;
}
void SetUp(){
fin >> X >> Y;
Z = X * Y / CMMDC(X, Y);
return;
}
void CodeExpert(){
p = 1; u = 1;
C[1] = 1;
while(1 == 1){
X = C[p];
Y = C[p] * 10 + 0;
if(F[Y%Z] == 0){
u ++;
C[u] = Y;
F[Y%Z] = 1;
if(Y % Z == 0)
break;
}
Y = C[p] * 10 + 1;
if(F[Y%Z] == 0){
u ++;
C[u] = Y;
F[Y%Z] = 1;
if(Y % Z == 0)
break;
}
p ++;
}
fout << C[u];
return;
}
int main(){
SetUp();
CodeExpert();
return 0;
}