t=p=0 for r in raw_input():n=10**(205558%ord(r)%7)%9995;t+=n-2*p%n;p=n print t