def f(e,t): MOD = 10**e - 1 r = 0 for i in s: r = (r*10+i)%MOD r -= t r %= MOD for i in range(e): x = pow(10,i,MOD) for d in range(1,10): if r == d*x%MOD: return i if r == (-d)*x%MOD: return i s = [int(i) for i in input() if i != "."] d = sum(s)-899117 res = [(ei,f(ei,ti)) for ei,ti in [(7, 8489600), (11, 51138658574), (13, 8429357496320), (15, 213655651443710), (17, 26611130275476623)]] x,MOD = 0,1 for m,r in res: while x%m != r: x += MOD MOD *= m print(s[-1-x],(s[-1-x]-d)%10)