#include <bits/stdc++.h>
using namespace std;
map<long long int, string> dp() {
  long long int no = 1;
  map<long long int, string> ans;
  for (long long int i = 1; i <= 100000; i++) {
    long long int n = i, rem = 0;
    while (n != 0) {
      rem += n % 10;
      n /= 10;
    }
    if (rem <= 10) {
      string s = to_string(i);
      ans[no] = (s + to_string(10 - rem));
      no++;
    }
  }
  return ans;
}
void Panda() {
  map<long long int, string> ans = dp();
  long long int n;
  cin >> n;
  long long int no = 1;
  while (n) {
    long long int j = no, rem = 0;
    while (j != 0) {
      rem += j % 10;
      j /= 10;
    }
    if (rem == 10) n--;
    no++;
  }
  cout << no - 1 << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  ;
  cin.tie(NULL);
  cout.tie(NULL);
  Panda();
  return 0;
}
