#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:255000000")
bool firstout = 1;
template <class T>
T &minn(T &a, T b) {
  if (b < a) a = b;
  return a;
}
template <class T>
T &maxx(T &a, T b) {
  if (a < b) a = b;
  return a;
}
int &madd(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return a;
}
int &msub(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000007;
  return a;
}
int &mmult(int &a, int b) { return a = (long long)a * b % 1000000007; }
int mdiv(long long a, long long b, long long m) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  if (a % b == 0) return a / b;
  return (a + m * mdiv(-a, m, b)) / b;
}
long long infl = (long long)1012345678 * 1012345678;
int n, m;
long long q;
int A[1012];
int f(long long a) {
  int res = 0;
  for (; a; a /= 10) res += a % 10;
  return res;
}
long long g(long long x) {
  long long res = 0;
  long long d = 1;
  int i, j, k;
  ++x;
  int s = f(x);
  for (; x; x /= 10, d *= 10) {
    for (; x % 10; --x) {
      {
        res += --s * d;
        if (res > infl) res = infl;
      }
    }
    for (i = (1); i < (10); ++i) {
      {
        long long a = d * (x / 10) * i;
        res += a;
        if (res > infl) res = infl;
      }
    }
  }
  return res;
}
int main() {
  int i, j, k;
  char c;
  int a, d;
  int ts;
  for (ts = 1; scanf("%"
                     "I64d",
                     &(q)) > 0;
       ++ts) {
    long long l = 1, r = q + 1, mid;
    for (; l + 1 < r;) {
      mid = (l + r) / 2;
      long long a = g(mid);
      if (a <= q)
        l = mid;
      else
        r = mid;
    }
    r = l;
    l = 0;
    long long res = g(r + 1);
    res = g(r);
    for (; res != q;)
      if (res < q)
        res += f(++r);
      else
        res -= f(++l);
    printf((firstout) ? "%"
                        "I64d"
                      : " %"
                        "I64d",
           (l + 1)),
        firstout = 0;
    printf((firstout) ? "%"
                        "I64d"
                      : " %"
                        "I64d",
           (r)),
        firstout = 0;
    printf("\n"), firstout = 1;
  }
  return 0;
}
