//https://ncode.syosetu.com/n4830bu/294/ #include using namespace std; int main() { int N; cin >> N; for (int len = 1;; len++) { for (int bit = 0; bit < (1 << len); bit++) { if ((bit & 1) && __builtin_popcount(bit) % 3 == 0) { N--; if (!N) { for (int i = len - 1; i >= 0; i--) { if (bit & (1 << i)) cout << 5; else cout << 3; } cout << endl; return 0; } } } } }