1.

import java.util.Locale;
import java.util.Scanner;

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* Problem: 10056 - What is the Probability?
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=997
*
* @author Felix Dietrich
* @version 1.0, 01/15/2010
*
* Method : Probability theory
* Status : Accepted
* Runtime: 0.548
*/

public class Main
{
public static void main(String... s)
{
Scanner sc = new Scanner(System.in);
sc.useLocale(Locale.ENGLISH);
int cases = sc.nextInt();
int n;
double p;
int playerI;

for(int i=0; i<cases; i++)
{
n = sc.nextInt();
p = sc.nextDouble();
playerI = sc.nextInt();

if(p > 1e-6)
System.out.println(String.format("%.04f", (Math.pow(1.0-p, playerI-1)*p)/(1.0-Math.pow(1.0-p, n))));
else
System.out.println("0.0000");
}
}
}