#include #include #include #include using namespace std; #define REP(i,s,e) for (i = s; i <= e; i++) #define rep(i,n) REP (i,0,(int)(n)-1) #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP (i,(int)(n)-1,0) #define INF (int)1e8 #define MOD (int)(1e9+7) typedef long long ll; int comb[30][30]; int C(int n, int k) { if (n < k) return 0; else if (comb[n][k] > 0) return comb[n][k]; else if (n == k || k == 0) return 1; else return comb[n][k] = C(n-1,k) + C(n-1,k-1); } int main(void) { int i, n; cin >> n; n--; int digits = 0; while (true) { int cnt = 0; REP (i,1,digits/3) cnt += C(digits-1,digits-i*3); if (cnt > n) break; n -= cnt; digits++; } vector ans; for (i = 1; i < 1<