package main import . "fmt" func main() { var t int Scan(&t) for ;t>0;t-- { p,k:=0.0,0 Scan(&p,&k) if k==1 { Println(1) continue } if p==0 { Println(k) continue } else if p==1 { Println(1) continue } r:=1-p g:=r s:=p for i:=2;i