#include <bits/stdc++.h>
using namespace std;
int k;
vector<int> v;
int now = 2;
int calc(int dgt, int i) {
  int res = 0;
  if (dgt >= v.size()) {
    v.push_back(1);
    return 1;
  }
  v[dgt]++;
  for (int i = (dgt); i < (v.size()); ++i) res += v[i];
  if (res > 10 || v[dgt] >= 10) {
    res = calc(dgt + 1, i);
    v[dgt] = 0;
    return res;
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> k;
  v.push_back(9);
  v.push_back(1);
  int res = 1;
  for (int i = (0); i < (k - 1); ++i) {
    v[0]--, v[1]++;
    if (v[1] > 10 - res) {
      res = calc(2, i);
      v[0] = 10 - res, v[1] = 0;
    }
  }
  reverse((v).begin(), (v).end());
  for (int i = (0); i < (v.size()); ++i) cout << v[i];
  cout << endl;
  return 0;
}
