#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - 48;
    c = getchar();
  }
}
int a[20010], tot;
int main() {
  int sum, k;
  for (int i = 10; i <= 2e7; i++) {
    sum = 0;
    for (int tmp = i; tmp; tmp = tmp / 10) {
      sum += tmp % 10;
      if (sum > 10) break;
    }
    if (sum == 10) a[++tot] = i;
  }
  read(k);
  cout << a[k] << "\n";
  return 0;
}
