s=input() n=len(s) m=(n+1)//2 for d in [1e9,1e9+7]: print((int(s[:m])+pow(10,n//2)-1-(s[:n//2][::-1]>s[m:]))%int(d))