#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
const int NMAX = 2000005;
struct QUEUE{
bool c;
int r , t;
};
int cmmdc(int a , int b)
{
int r;
while(b)
{
r = a % b;
a = b;
b = r;
}
return a;
}
int cmmmc(int a,int b)
{
return a * b / cmmdc(a,b);
}
QUEUE q[NMAX];
bool viz[NMAX];
bool sol[NMAX];
int main()
{
freopen("multiplu.in","r",stdin);
freopen("multiplu.out","w",stdout);
int M , A , B,r;
scanf("%d%d",&A,&B);
M = cmmmc(A,B);
int p , u;
p= u = 1;
QUEUE temp;
temp.c = 1;
temp.r = 1;
temp.t = 0;
q[u] = temp;
viz[1] = 1;
while(p <= u)
{
temp = q[p];
r = (temp.r * 10 + 0) % M;
if(viz[r] == 0)
{
viz[r] = 1;
u++;
q[u].c = 0;
q[u].r = r;
q[u].t = p;
if(r == 0)
break;
}
r = (temp.r * 10 + 1) % M;
if(viz[r] == 0)
{
viz[r] = 1;
u++;
q[u].c = 1;
q[u].r = r;
q[u].t = p;
if(r == 0)
break;
}
p++;
}
int x = u;
int k = 0;
while(x != 0)
{
sol[++k] = q[x].c;
x = q[x].t;
}
for(int i = k ; i >= 1 ; i--)
printf("%d",sol[i]);
return 0;
}