#include <bits/stdc++.h>
using namespace std;
set<long long int> st;
void imple() {
  for (int first = 1; first <= 9; first++) {
    for (int second = 0; second <= 9; second++) {
      if (first + second == 10) {
        st.insert((first * 10) + second);
      }
      for (int third = 0; third <= 9; third++) {
        if (first + second + third == 10) {
          st.insert((first * 100) + (second * 10) + third);
        }
        for (int fourth = 0; fourth <= 9; fourth++) {
          if (first + second + third + fourth == 10) {
            st.insert((first * 1000) + (second * 100) + (third * 10) + fourth);
          }
          for (int fifth = 0; fifth <= 9; fifth++) {
            if (first + second + third + fourth + fifth == 10) {
              st.insert((first * 10000) + (second * 1000) + (third * 100) +
                        (fourth * 10) + fifth);
            }
            for (int sixth = 0; sixth <= 9; sixth++) {
              if (first + second + third + fourth + fifth + sixth == 10) {
                st.insert((first * 100000) + (second * 10000) + (third * 1000) +
                          (fourth * 100) + (fifth * 10) + sixth);
              }
              for (int seventh = 0; seventh <= 9; seventh++) {
                if (first + second + third + fourth + fifth + sixth + seventh ==
                    10) {
                  st.insert((first * 1000000) + (second * 100000) +
                            (third * 10000) + (fourth * 1000) + (fifth * 100) +
                            (sixth * 10) + (seventh));
                }
                for (int eigth = 0; eigth <= 9; eigth++) {
                  if (first + second + third + fourth + fifth + sixth +
                          seventh + eigth ==
                      10) {
                    st.insert((first * 10000000) + (second * 1000000) +
                              (third * 100000) + (fourth * 10000) +
                              (fifth * 1000) + (sixth * 100) + (seventh * 10) +
                              eigth);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
int main() {
  long long n;
  cin >> n;
  imple();
  long long int cnt = 0;
  for (set<long long int>::iterator it = st.begin(); it != st.end(); it++) {
    cnt++;
    if (cnt == n) {
      cout << *it << endl;
      break;
    }
  }
}
