#include #define unless(x) if (!(x)) #define pb push_back #define eb emplace_back /* #define f first */ /* #define s second */ #define lb lower_bound #define ub upper_bound #define ins insert #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define mem(x, y) memset(x, y, sizeof(x)) #define sz(x) ((int) (x).size()) #define popcount __builtin_popcountll using namespace std; using ll = long long; using ld = long double; using pi = pair; using pll = pair; using vi = vector; using vll = vector; using vpi = vector; using vpll = vector; using vvi = vector>; using vvll = vector>; template using minpq = priority_queue, greater>; template using maxpq = priority_queue, less>; // *INDENT-OFF* template bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cerr << x; } void __print(double x) { cerr << x; } void __print(long double x) { cerr << x; } void __print(char x) { cerr << '\'' << x << '\''; } void __print(const char *x) { cerr << '\"' << x << '\"'; } void __print(const string &x) { cerr << '\"' << x << '\"'; } void __print(bool x) { cerr << (x ? "true" : "false"); } template void __print(const pair &x) { cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}'; } template void __print_tup(const tuple& t) { cerr << get(t); if constexpr(I < sizeof...(Tp) - 1) { cerr << ", "; __print_tup(t); } } template void __print(const tuple& t) { cerr << '{'; __print_tup(t); cerr << '}'; } template void __print(const T &x) { int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}"; } void _print() { cerr << "]\n"; } template void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); } template T fdiv(T x, T y) { T q = x / y; T r = x % y; if ((r != 0) && ((r < 0) != (y < 0))) --q; return q; } template T cdiv(T x, T y) { return x / y + ((x % y != 0) ? !((x > 0) ^ (y > 0)) : 0); } namespace std { template class y_combinator_result { Fun fun_; public: template explicit y_combinator_result(T &&fun): fun_(std::forward(fun)) {} template decltype(auto) operator()(Args &&...args) { return fun_(std::ref(*this), std::forward(args)...); } }; template decltype(auto) yy(Fun &&fun) { return y_combinator_result>(std::forward(fun)); } } template /* cin >> pair */ istream& operator>>(istream &istream, pair &p) { return (istream >> p.first >> p.second); } template /* cin >> vector */ istream& operator>>(istream &istream, vector &v) { for (auto &it : v) cin >> it; return istream; } template /* cout << pair */ ostream& operator<<(ostream &ostream, const pair &p) { return (ostream << p.first << " " << p.second); } template /* cout << vector */ ostream& operator<<(ostream &ostream, const vector &c) { for (auto &it : c) cout << it << " "; return ostream; } ll sum_n(int n) { return (ll) n * (n + 1) / 2; } const string yes = "Yes"; const string no = "No"; #ifdef LOCAL #define dbg(x...) cerr << "\e[1;31m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[0m"; #else #define dbg(x...) #endif // *INDENT-ON* // YOU ARE ACTUALLY **SUPPOSED** TO READ THE FOLLOWING. // No need to hurry. Relax. // Read Problems Carefully. (Please do this, you keep making mistakes because you avoided this.) // Read both the input sizes (i.e. n <= 1e5, etc) and the sum of n thing. (i.e. sum of n <= 1e6, etc). // Be Careful about input data size. You keep inputting data as int, when long long was required. // Don't force some technique on a problem. BS does not solve everything. On many occasions, greedy rules. // Declare double values as long double or ld (NEVER double, because of precision issues) void solve() { int n; cin >> n; vi v; for (int i = 1; i <= 9; i++) { for (int j = i + 1; j <= 9; j++) { v.pb(i * 10 + j); } } n--; int k = sz(v); cout << v[n % k]; for (int i = 0; i < n / k; i++) { cout << v[n % k] % 10; } cout << '\n'; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); solve(); return 0; }