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