N=int(input()) for _ in range(N): x,y=input().split() y=int(y) if x[-2]=='.': x=x+'00' elif x[-2]=='.': x=x+'0' x=int(x.replace('.','')) ans=0;c=1 for i in range(1,y): d=c*x*pow(10,-3) ans+=i*d c-=d print(ans+y*c)