#include <bits/stdc++.h>
using namespace std;
long long int a[100000];
int perfect(long long int a) {
  int n, s = 0, r;
  while (a) {
    r = a % 10;
    s += r;
    a /= 10;
  }
  if (s == 10)
    return 1;
  else
    return 0;
}
int main() {
  unsigned long long int i = 18, j = 1, n, n1;
  while (1) {
    if (perfect(i)) a[j++] = i;
    if (j == 10013) break;
    i++;
  }
  cin >> n;
  cout << a[n] << endl;
  return 0;
}
