#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, count = 0, tmp = 0;
  long long num, dig, sum = 0;
  long long kekke;
  int ten = 0;
  cin >> k;
  for (int i = 0; i < k; i++) {
    count++;
    if (count < 10)
      sum = count;
    else {
      if (ten == 10) {
        ten = 0;
        tmp -= 8;
      } else {
        ten++;
        tmp++;
      }
    }
    if (count < 10)
      kekke = sum;
    else
      kekke = tmp;
    if (count / kekke >= 2) {
      i--;
      continue;
    } else
      cout << count << endl;
  }
}
