use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); for l in s.lines().skip(1) { let v: Vec = l.split(' ').flat_map(str::parse).collect(); let mut a = 0.; for i in 1..v[1] as i32 { a += v[0] * (1. - v[0]).powi(i - 1) * i as f64; } println!("{}", a + (1. - v[0]).powi(v[1] as i32 - 1) * v[1]) } }