#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

ll digit_sum(ll n)
{
    ll res = 0LL;
    while (n)
    {
        res += n % 10LL;
        n /= 10LL;
    }
    return res;
}

ll next_snuke(ll n)
{
    ll now = n;
    ll base = 1;
    ll smallest = n;
    double small = (double) smallest / digit_sum(smallest)
    while(now < 100L * n)
    {
        ll check = (now / base) % 10L;
        if (check != 9)
        {
            cout << "*" << now << ' ' << check << ' ' << base << endl;
            now += base;
            ll d_now = (double)now / digit_sum(now);
            if (small > d_now)
            {
                smallest = now;
                small = d_now;
            }
            if (check == 8) base *= 10L;
        }
        else
            base *= 10L;
    }
    return smallest;
}

int main()
{
    ll k;
    cin >> k;

    ll snuke = 0LL;
    // while (k)
    // {
    //     snuke = next_snuke(snuke + 1LL);
    //     cout << snuke << endl;
    //     --k;
    // }
    cout << next_snuke(6999999999999999LL + 1LL) << endl;
    return 0;
}