#include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0;i pii; typedef vector vi; typedef vector vvi; ll C[30][30]; ll dig[30]; void comb(){ REP(i,30) C[i][i] = 1; REP(i,30) C[i][0] = 1; for(int i=1;i<30;i++){ for(int j=1;j0){ if(n%2) cnt++; n >>= 1; } return cnt; } int main(){ ll N; cin >> N; comb(); for(int i=3;i<30;i++){ for(int j=2;j=N) break; } N = N - (sum - dig[digit]); int cnt = 0; for(int i=1;i0){ if(n%2==0) ans+="3"; else ans += "5"; n>>=1; } string l = string(digit-ans.length(),'3'); reverse(ALL(ans)); cout << l << ans << endl; return 0; } } }