#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int v = 0;
  map<int, int> s;
  for (int i = 19; s.size() < 10010; i += 9) {
    int kk = i;
    int c = 0;
    while (kk > 0) {
      c += kk % 10;
      kk /= 10;
    }
    if (c == 10) s[v++] = i;
  }
  cout << s[n - 1];
  return 0;
}
