def kaibun_number(s,MOD): m = (len(s)+1)//2 ans = int(s[:m])%MOD - pow(10,m-1,MOD) + 1 if s[m-len(s)%2:] < s[:m][::-1]: ans -= 1 r = 9 for i in range(1,len(s)): ans += r if i%2==0: r = r*10%MOD return ans%MOD s = input() print(kaibun_number(s,10**9)) print(kaibun_number(s,10**9+7))