#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<<30) { if((__builtin_popcount(i)+1)*2%3==0) { if(--N==0) { s="5"; FOR(x,d-1) { s+='3'+((i&(1<