#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  vector<int> v;
  int temp = 19;
  int i = 0;
  while (i < 10000) {
    int a = 0;
    string s = to_string(temp);
    for (int j = 0; j < s.size(); j++) {
      a += s[j] - '0';
    }
    if (a == 10) {
      v.push_back(temp);
      i++;
    }
    temp += 9;
  }
  cout << v[k - 1];
  return 0;
}
