#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
const int maxn = 4e5 + 10;
int s[maxn];
int judge(int x) {
  int ret = 0;
  while (x) {
    ret += x % 10;
    x /= 10;
  }
  return ret;
}
int main() {
  int tot = 0, n;
  for (int i = 1; i <= 11000000; i++) {
    int a = judge(i);
    if (a == 10) s[++tot] = i;
  }
  cin >> n;
  cout << s[n] << endl;
  return 0;
}
