#include "bits/stdc++.h"
#include <random>
#include <algorithm>
#include <unordered_set>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define Sort(a) sort(a.begin(),a.end())
#define cSort(a,cmp) sort(a.begin(),a.end(),cmp)
#define reSort(a) sort(a.rbegin(), a.rend())
static const ll llMAX = numeric_limits<long long>::max();
static const int intMAX = numeric_limits<int>::max();
static const ll  llMIN = numeric_limits<long long>::min();
static const int intMIN = numeric_limits<int>::min();
static const ll d_5 = 100000;
static const ll d9_7 = 1000000007;
static const ll d_9 = 1000000000;
static const double PI=3.14159265358979323846;
template<class T>
T gcd(T a,T b){
  if(a==0){
    return b;

  }else if(b==0){
    return a;
  }
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
ll digitpower(ll a,ll b){//aのb乗を計算
  if(b==1){
    return a;
  }else if(b==0){
    return 1;
  }
  int mode=1;
  if(mode==0){
    if(b%2==1){
      ll tmp = digitpower(a,(b-1)/2);
      tmp%=d9_7;
      tmp*=tmp;
      tmp%=d9_7;
      tmp*=a;
      return (tmp)%d9_7;
    }else{
      ll tmp = digitpower(a,(b)/2);
      tmp%=d9_7;
      tmp*=tmp;
      tmp%=d9_7;
      return (tmp)%d9_7;
    }
  }else{
    if(b%2==1){
      ll tmp = digitpower(a,(b-1)/2);
      tmp*=tmp;
      tmp*=a;
      return (tmp);
    }else{
      ll tmp = digitpower(a,(b)/2);
      tmp*=tmp;
      return (tmp);
    }
  }
  return 0;
  
}
template<class T>
void Printvector(std::vector<T> &a){
  int size = a.size();
  rep(i,size){
    cout<<a[i]<<" ";
  }
  cout<<endl;
}
template<class T>
void Printvector(std::vector<std::vector<T>> &a){
  int size = a.size();
  rep(i,size){
    int size2=a[i].size();
    rep(j,size2){
      cout<<a[i][j]<<" ";
    }
    cout<<endl;
  }
  cout<<endl;
}
  ll k;
  int ssize=17;
vector<set<ll>> nums(50);
int flag=0;
void printd(vi ans){
  if(flag==1)return;
  ll a=0;
  rep(i,ssize){
    a+=((ll)ans[i+2])*digitpower(10,(ll)(ssize-i-1));
  }
  cout<<a<<endl;
  flag=1;
}
ll func(int nowd,vi digi,ll nowk,int flag0){//nowdが、indexで何桁目かを表す
if(flag==1){
  return -1;
}
int pastd=digi[digi.size()-1];
    if(pastd>=1){
      flag0=1;
    }
  if(nowd==0){
    if(flag0==0){
      if(k<=9){
        cout<<k<<endl;
        flag=1;
        return 0;
      }else{
        return 10;
      }
    }
    if(pastd>=1){
      if(nowk==k){
        digi.pb(pastd-1);
        printd(digi);
        digi.pop_back();
      }
      nowk++;
    }
    if(nowk==k){
        digi.pb(pastd);
        printd(digi);
        digi.pop_back();
      }
      nowk++;
      if(pastd<=8){
      if(nowk==k){
        digi.pb(pastd+1);
        printd(digi);
        digi.pop_back();
      }
      nowk++;
    }
    return nowk;
  }else{
    if(flag0==0){
      for(int i=0;i<=9 && flag==0;i++){
        
        digi.pb(i);
        nowk=func(nowd-1,digi,nowk,flag0);
        digi.pop_back();
      }
      return nowk;
    }
    if(pastd>=1){
      digi.pb(pastd-1);
      nowk=func(nowd-1,digi,nowk,flag0);
        digi.pop_back();
    }
      digi.pb(pastd);
      nowk=func(nowd-1,digi,nowk,flag0);
        digi.pop_back();
    
    if(pastd<=8){
      digi.pb(pastd+1);
      nowk=func(nowd-1,digi,nowk,flag0);
        digi.pop_back();
    }
  }
  return nowk;
}
int main(void){
  cin>>k;
  func(ssize,{0},0,0);
  return 0;
}

//<<std::setprecision(30)

//重複削除
 /* std::sort(vec.begin(), vec.end());
 
  vec.erase(std::unique(vec.begin(), vec.end()), vec.end());*/

  //ペアの全探索
  /*do{
		int s=0;
		for(int i=0;i<n/2;i++)s+=v[i]^v[i+n/2];
		r=max(s,r);
		reverse(v.begin()+n/2,v.end());
	}while(next_permutation(v.begin(),v.end()));*/


Measured memory_bytes: 256