def kaibun_number(s,MOD): ls = len(s) p10 = [1]*(ls+1) # p10[i] = 10**i for i in range(1,ls+1): p10[i] = p10[i-1]*10%MOD all9 = [9*p10[i//2]%MOD for i in range(ls+1)] for i in range(1,ls+1): all9[i] += all9[i-1] all9[i] %= MOD def minus(lst,L,R): lst[R] -= 1 while L <= R and lst[R] < 0: lst[R] = 9 R -= 1 lst[R] -= 1 return L < R lst = list(map(int,s)) can_leading_zero = 1 L,R = 0,len(s)-1 ans = 0 while 1: if L > R: ans += 1 break if L == R: ans += 1 + lst[L] - can_leading_zero break for i in range(lst[L]): if i: ans += p10[(R-L)//2] else: ans += all9[R-L-1] ans %= MOD if lst[L] > lst[R]: if not minus(lst,L,R-1): break can_leading_zero = 0 L += 1 R -= 1 return ans%MOD s = input() print(kaibun_number(s,10**9)) print(kaibun_number(s,10**9+7))