#include <bits/stdc++.h>
using namespace std;
int n, uc, aux, s, su, v[10005], i;
int main() {
  cin >> n;
  i = 1;
  while (su <= n) {
    aux = i;
    s = 0;
    while (aux != 0) {
      uc = aux % 10;
      s = s + uc;
      aux = aux / 10;
    }
    if (s == 10) {
      su++;
      v[su] = i;
    }
    i++;
  }
  cout << v[n];
  return 0;
}
