#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>N; int n5; for(int d=2;d<=30;d++) { ll p=0; FOR(n5,d) if(((n5+1)*2)%3==0) p+=C[d-1][n5]; if(p>=N) { for(i=1;;i+=2) if(__builtin_popcount(i)*2%3==0) { if(--N==0) { FOR(x,d) s+='3'+((i&(1<