We consider a positive integer perfect, if and only if the sum of its digits is exactly $10$. Given a positive integer $k$, your task is to find the $k$-th smallest perfect positive integer.
A single line with a positive integer $k$ ($1 \leq k \leq 10\,000$).
The first perfect integer is $19$ and the second one is $28$.
1
19
2
28
13
136
101
1432
1023
100270
9999
10800010
10000
10800100
2333
310060
9139
10134010
9859
10422001
5987
2221201
3
37
4
46
5
55
7
73
9
91
10
109
15
154
51
613
99
1414
138
2224
233
5050
666
27100
1234
110206
3567
1033003
4445
1221301
5689
2114002
6666
3102004
7777
5300200
8888
10110061
9411
10214200
5539
2101114
6259
2511100
2387
312220
8515
10030114
#include<bits/stdc++.h>
 
using namespace std;
 
/*** Optimization ***/
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
 
/*** Typedef ***/
typedef long long ll;
typedef unsigned long long ull;
 
/*** Input Output***/ 
#define sci1(a) scanf("%d",&a)
#define sci2(a,b) scanf("%d %d",&a,&b)
#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)
#define sc3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
 
/*** #define pf1(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)***/
 
/*** Loops ***/
#define for0(num) for(ll i = 0; i < num; i++)
#define for1(num) for(ll i = 1; i <= num; i++)
#define forr(num) for(ll i = num - 1; i >= 0; i--)
#define forin(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');
 
/*** Define Values ***/
#define mx 1000000
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 1000010
#define INF 1e15


#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define REP(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

 
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
/*** STLs ***/
typedef vector<int> vi;
typedef vector <ll> vll;
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll , ll> > vpll;

 
/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtGreat(v) sort(all(v), greater<ll>())
inline bool cmp(pll a,pll b){ if(a.ss == b.ss) return a.ff < b.ff; return a.ss < b.ss; }
 
/*** BitWise Operations
bool getBit (ll num, ll pos) { return num & (1 << pos); } // get bit right -> left
ll setBit (ll num, ll pos) { return num | (1 << pos); }
ll chearBit (ll num, ll pos) { ll mask = ~(1 << pos); return num & mask; }
ll updateBit (ll num, ll pos, bool bit1or0) { ll value = bit1or0 ? 1 : 0; ll mask = ~(1 << pos); return (num & mask) | (value << pos); }
 ***/
 
/*** Grids ***/
int drx[8] = {-2,-2,-1,-1,1,1,2,2};
int dcy[8] = {-1,1,-2,2,-2,2,-1,1};
int dirx[4] = { -1, 0, 1, 0 };
int diry[4] = { 0, -1, 0, 1 };

 /*** Some Prints ***/
#define en cout << '\n';
#define no cout << "NO" << '\n';
#define yes cout << "YES" << '\n';
#define case cout << "Case " << t++ << ": ";
#define one cout << "-1"<<'\n';
#define ret return 0;

/*** Functions***/
ll BigMod(ll base, ll pow, ll modvalue){ if (pow == 0) return 1;  ll ans = BigMod(base, pow / 2, modvalue);ll total = ((ans % modvalue) * (ans % modvalue)) % modvalue;  if(pow % 2 == 0) return total; else{ return (total * (base % modvalue) ) % modvalue; } }
ll InverseMod(ll base, ll pow) { if(pow == 0) return 1; ll ans = InverseMod(base, pow / 2); ans = (ans * ans) % mod; if(pow & 1){ return (ans * base) % mod; } else{ return ans; } }
bool isprime(ll num) { if(num < 2) return false; for(ll i = 2; i * i <= num; i++){ if(num % i == 0) return false; } return true; }
ll EularPHI(ll num) { double ans = num; for(ll i = 2; i * i <= num; i++){ if(num % i == 0){ while (num % i == 0) { num /= i; } ans *= (1.0 - (1.0 / (double)i)); } } if(num > 1) ans *= (1.0 - (1.0 / (double)num)); return (ll)ans; }
 
template <class T> inline T gcd(T a,T b){if(b == 0)return a; return gcd(b, a % b);}
template <class T> inline T lcm(T a,T b){return a * b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll ans = 1;while(p--) ans *= b; return ans;}

ll extgcd(ll a,ll b,ll& x,ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

ll powm(ll a,ll b) {
    ll res = 1;
    while (b) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return res;
}
ll divide(ll a,ll b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}
ll mul(ll a,ll b) {
    return ((a % mod) * (b % mod)) % mod;
}
 
ll add(ll a,ll b) {
    return (a % mod + b % mod) % mod;
}
ll Totfun(ll n){
    ll z=n;
    if(n%2==0){
        while(n%2==0){
            n/=2;
        }
        z/=2;
    }
    for(ll i=3;i*i<=n;i+=2){
        if(isprime(i)&&n%i==0){
          while(n%i==0){
            n/=i;
          }
        z-=z/i;  
        }
    }
    if(n>1){
        z-=z/n;
    }
    return z;
}

/*
fact[0]=1;
rep(i,1,mx){
 fact[i]=mul(i,fact[i-1]);
}
*/
/*
vll a[mx];
ll l[mx],d[mx];
void dfs(ll x,ll y){
   l[x]=1; d[x]=y;
   for(ll i:a[x])
   if(!l[i])
   dfs(i,y+1);
}
void bfs(ll x){
    queue<ll> q;
    q.push(x);
    l[x]=1;
    d[x]=0;
    while(!q.empty()){
        ll cur=q.front();
        q.pop();
        for(ll i : a[cur]){
            if(1-l[i]){
                q.push(i);
                d[i]=d[cur]+1;
                l[i]=1;
            }
        }
    }
}
*/
 /*matrix exponential
 ll n;
   ll d;
   cin>>n;
   ll ans[2]={0,1};
   ll a[2][2],tmp[2][2];
   a[0][0]=0;
   a[0][1]=1;
   a[1][0]=1;
   a[1][1]=1;
   while(n>0){
       if(n%2){
           d=ans[0];
           ans[0]=(d*a[0][0]+a[1][0]*ans[1])%mod;
           ans[1]=(d*a[0][1]+a[1][1]*ans[1])%mod;
       }
       tmp[0][0]=(a[0][0]*a[0][0]+a[0][1]*a[1][0]); 
       tmp[0][1]=(a[0][0]*a[0][1]+a[0][1]*a[1][1]); 
       tmp[1][0]=(a[1][0]*a[0][0]+a[1][1]*a[1][0]); 
       tmp[1][1]=(a[1][0]*a[0][1]+a[1][1]*a[1][1]); 
       rep(i,0,2){
           rep(j,0,2) a[i][j]=tmp[i][j]%mod;
       }
       n/=2;
   }
   cout<<ans[0];
*/

vector<ll> primetilln(ll n){
    vector<ll>v;
    for(ll i=2; i<=n; i++){
        if(isprime(i)){
            v.pb(i);
        }
    }
    return v;
}
vector<ll> primeFactors(ll n)
{
    vector<ll>v;
    while (n % 2 == 0)
    {
        v.pb(2);
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            v.pb(i);
            n = n/i;
        }
    }
    if (n > 2)
        v.pb(n);
    return v;
}

bool ispalindrome(string s){
    bool flag=true;
    int n=s.size();
    for(int i=0; i<n; i++){
        if(s[i]!=s[n-1-i]) {
            flag=false;
            break;
        } 
    }
    return flag;
}

void addedge(vector<int> vec[], int u, int v)
{
    vec[u].push_back(v);
    vec[v].push_back(u);
}

bool vectorSortedOrNot(vector<int> v, int n)
{
    if (n == 1 || n == 0)
        return 1;

    if (v[n - 1 ] < v[n - 2])
        return 0;

    return vectorSortedOrNot(v, n - 1);
}

int countNonIncreasing(int arr[], int n)
{
    int cnt = 0;
    int len = 1;
    for (int i = 0; i < n - 1; ++i) {
        if (arr[i + 1] <= arr[i])
            len++;
        else {
            cnt += (((len + 1) * len) / 2);
            len = 1;
        }
    }
    if (len > 1)
        cnt += (((len + 1) * len) / 2);
 
    return cnt;
}

int sumDigits(int num)
    {
        return num == 0 ? 0 : num % 10 + sumDigits(num / 10);
    }

int modFact(int n, int p)
{
    if (n >= p)
        return 0;
 
    ll result = 1;
    for (int i = 1; i <= n; i++)
        result = (result * i) % p;
 
    return result;
}

int nCrModp(int n, int r, int p)
{
    if (r > n - r)
        r = n - r;
    int C[r + 1];
    memset(C, 0, sizeof(C));
 
    C[0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j - 1]) % p;
    }
    return C[r];
}


int main(){
    #ifndef ONLINE_JUDGE
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt","w",stdout);
    #endif
 
   ios_base::sync_with_stdio(false); 
   cin.tie(NULL);
   cout.tie(NULL);
   cout<<fixed<<setprecision(20);
   ll test=1;
   //cin>>test;
   while(test--){
       int k;
       cin>>k;
       int ans(0);
       while(k){
           ans++;
           if(sumDigits(ans)==10)k--;
       }
       cout<<ans;
    }

#ifndef ONLINE_JUDGE
    printf("\nRun Time -> %.10fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC);
#endif
   return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do something instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/