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