#include using namespace std; string decommpress(string s) { string res = ""; set nupc = {'N', 'U', 'P', 'C'}; set one_or_two = {'1', '2'}; for (auto&& c : s) { if (nupc.count(c)) { res.push_back(c); } else if (one_or_two.count(c)) { if (c == '2') res += res; } else { assert(false); } } return res; } int main() { int K; cin >> K; vector compressed = { "N1U1P1C1", // 0 "N2U1P1C1", // 1 "N1U2P1C1", // 2 "N2U2P1C1", // 3 "N1U1P2C1", // 4 "N2U1P2C1", // 5 "N1U2P2C1", // 6 "N2U2P2C1", // 7 "N1U1P1C2", // 8 "N2U1P1C2", // 9 "N1U2P1C2", // 10 "N2U2P1C2", // 11 "N1U1P2C2", // 12 "N2U1P2C2", // 13 "N1U2P2C2", // 14 "N2U2P2C2", // 15 }; vector decompressed; for (auto t : compressed) { string t_decompressed = decommpress(t); decompressed.push_back(t_decompressed); } // ソートをしない // sort(decompressed.begin(), decompressed.end()); cout << decompressed[K - 1] << endl; }