N=int(input()) from decimal import Decimal 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=Decimal(c*x)/Decimal(1000) ans+=i*d c-=d if c<0.0000001: break print(ans+y*c)