#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int m;
int n;
long long st10[20];
string toString(long long x) {
  stringstream sout;
  sout << x;
  return sout.str();
}
int main() {
  long long a;
  cin >> a;
  while (a < (long long)1e3) a *= 2;
  st10[0] = 1;
  for (int i = 1; i < 20; i++) st10[i] = st10[i - 1] * (long long)10;
  long long k = 1;
  while (true) {
    if (st10[k - 1] * 45 * k > a) break;
    k++;
  }
  k--;
  a -= 45 * st10[k - 1] * k;
  long long b = 0;
  while (a >= st10[k]) {
    a -= st10[k];
    b++;
  }
  string pref;
  while (b) {
    if (b > 9) {
      pref += "9";
      b -= 9;
    } else {
      pref += (char)(b + 48);
      b = 0;
    }
  }
  if (a == 0) {
    cout << pref;
    for (int i = 0; i < (k); i++) cout << 0;
    cout << ' ';
    cout << pref;
    for (int i = 0; i < (k); i++) cout << 9;
    cout << endl;
    return 0;
  }
  string tmp = toString(a);
  long long d = k - ((int)(tmp).size());
  for (int i = 0; i < (d); i++) tmp = "0" + tmp;
  cout << pref << 0 << tmp << ' ' << pref << 1;
  tmp = toString(a - 1);
  d = k - ((int)(tmp).size());
  for (int i = 0; i < (d); i++) tmp = "0" + tmp;
  cout << tmp << endl;
  return 0;
}
