#include using namespace std; int main() { int n; cin >> n; int t = (n - 1) / 36; int r = (n - 1) % 36 + 1; for (int i = 1; i < 9; i++) { if (r + i <= 9) { cout << i; for (int j = 0; j <= t; j++) { cout << i + r; } cout << endl; break; } r -= 9 - i; } }