def g(p, n):
  a = p
  b = 0
  
  if n % 2 == 1:
    p = p // 10
  
  while p != 0:
    d = p
    p = p // 10
    b = b * 10 + d
    a = a * 10
  
  return a + b

def f(n):
  l = len(str(n))
  h = (l + 1) // 2
  p = int(str(n)[0:h])
  
  if g(p, l) > n:
    p = p - 1

  p = p * 2

  o = 1
  for i in range(1, h):
    o = o * 10

  if l % 2 == 0:
    o = o * 10

  p = p - (p // 2) + o - 1

  return p

n = int(input())
x = f(n)
print(x % 1000000000)
print(x % 1000000007)