#include <bits/stdc++.h>
using namespace std;
int k, x[1000010], len = 1, i, sum, ans;
void work(int p) {
  if (p > len) {
    len = p;
  }
  x[p]++;
  if (x[p] == 10) {
    x[p] = 0;
    work(p + 1);
  } else {
    return;
  }
}
int main() {
  scanf("%d", &k);
  while (len) {
    work(1);
    ans = 0;
    for (int i = 1; i <= len; i++) {
      ans += x[i];
    }
    if (ans == 10) {
      sum++;
    }
    if (sum == k) {
      for (int i = len; i >= 1; i--) {
        printf("%d", x[i]);
      }
      printf("\n");
      break;
    }
  }
  return 0;
}
