#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
int huan[10]= { 1,1,1,1,1,
1,1,1,1,1};
int res[400][10] = {0};
int n = 9;
int step = 0;
int sum = 0;
void cut(int a[])//每步统计并存储在res中。
{
for(int i = 1; i <= n; i++)
res[sum][i] = a[i];
sum ++;
}
void up(int, int);
void down(int n, int s)//取下前n个环
{
if(n == 1)
{
huan[1] = 0;
cut(huan);
return;
}
if(n == 2)
{
huan[2] = 0;
cut(huan);
huan[1] =0;
cut(huan);
return;
}
down(n-2,step);
huan[n] = 0;
cut(huan);
up(n-2,step);
down(n-1,step);
}
void up(int n, int s)//挂上前n个环
{
if(n == 1)
{
huan[1] = 1;
cut(huan);
return;
}
if(n == 2)
{
huan[1] = 1;
cut(huan);
huan[2] =1;
cut(huan);
return;
}
up(n-1,step);
down(n-2,step);
huan[n] = 1;
cut(huan);
up(n-2,step);
}
int main()
{
while(cin>>step)
{
cut(huan);
down(n,step);
// cout<<sum<<endl;
if(step > sum - 1)
cout<<-1<<endl;
else
{
for(int i = 1; i <=n; i++)
cout<<res[step][i];
cout<<endl;
}
sum = 0;
memset(res,0,sizeof(res));
for(int i = 0; i < 10; i++)
huan[i]= 1;
}
return 0;
}