#include <bits/stdc++.h>
using namespace std;
long t;
bool kt(long x) {
  t = 0;
  while (x > 0) {
    t += x % 10;
    x /= 10;
  }
  if (t <= 10) return true;
  return false;
}
int main() {
  vector<long> h;
  long k, s = 0, tong, kq;
  cin >> k;
  for (long i = 1;; ++i) {
    if (kt(i)) h.push_back(i);
    if (h.size() == k) {
      cout << h[k - 1] * 10 + (10 - t);
      return 0;
    }
  }
}
