i,j=31;main(n){for(scanf("%d",&n);__builtin_popcount(++i)%3||--n;);for(i=4*i+2;j=j-1;)(n=i>>j)>1&&putchar(51+n%2*2);}