#include <bits/stdc++.h>
using namespace std;
const int maxn = 10005;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
int judge(int x) {
  int sum = 0;
  while (x) {
    sum += (x % 10);
    x /= 10;
  }
  return (sum == 10);
}
int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1;; i++) {
    if (judge(i) == 1) {
      cnt++;
      if (cnt == n) {
        cout << i << endl;
        return 0;
      }
      if ((i % 10) != 0) {
        i += 8;
      }
    }
  }
  return 0;
}
