#include <bits/stdc++.h>
using namespace std;
long long sum(long long n) {
  long long s = 0;
  while (n) {
    long long d = n % 10;
    s += d;
    n /= 10;
  }
  return s;
}
void solve() {
  long long k;
  cin >> k;
  long long dp[17][17];
  for (long long i = 0; i <= 16; i++) dp[i][0] = dp[i][i] = 1;
  for (long long i = 1; i <= 16; i++) {
    for (long long j = 1; j < i; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1];
    }
  }
  if (k > 9) {
    long long cnt = 9;
    long long l = 11, r = 2;
    long long c = 2;
    while (cnt + dp[l][r] - 1 < k) {
      cnt += dp[l][r] - 1;
      l++;
      r++;
      c++;
    }
    long long num = 91;
    c -= 2;
    while (c) {
      num *= 10;
      c--;
    }
    long long ans;
    for (long long i = num + 1; cnt < k; i++) {
      if (sum(i) == 10) {
        ans = i;
        cnt++;
      }
    }
    cout << ans << "\n";
  } else {
    long long num;
    for (long long i = 19; k > 0; i++) {
      if (sum(i) == 10) {
        num = i;
        k--;
      }
    }
    cout << num << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
