while(f(a,b,r)=until(b>y&y*10\t&f(a\t,y)|!a^r%=11,y=a%t=10^r++)+r,print(f(input,"")))