#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1 << 29;
constexpr int MOD = 1000000007;
constexpr int dx[4] = {1, 0, -1, 0};
constexpr int dy[4] = {0, 1, 0, -1};
vector<int> st;
vector<int> C;
void dfs(int n, int k, bool flag) {
  if (n == 1) {
    if (k >= 10) return;
    st.push_back(k);
    int now = 0;
    for (int i = 0; i < st.size(); i++) {
      now *= 10;
      now += st[i];
    }
    C.push_back(now);
    st.pop_back();
    return;
  }
  for (int j = flag ? 1 : 0; j <= min(k, 9); j++) {
    st.push_back(j);
    dfs(n - 1, k - j, false);
    st.pop_back();
  }
  return;
}
int main() {
  int N;
  cin >> N;
  for (int i = 2; i < 9; i++) {
    dfs(i, 10, true);
  }
  cout << C[N - 1] << endl;
  return 0;
}
