#include <bits/stdc++.h>
using namespace std;
bool sum(int num) {
  int ssum = 0;
  while (num > 0) {
    ssum = ssum + num % 10;
    num = num / 10;
  }
  if (ssum == 10) {
    return true;
  } else {
    return false;
  }
}
int main() {
  int test, num = 19;
  cin >> test;
  while (test > 0) {
    if (sum(num)) {
      test--;
    }
    num += 9;
  }
  cout << num - 9 << endl;
  return 0;
}
