Doll Claw Machine
Time limit2sMemory limit512 MB
Given p, c, and n, find the expected number of dolls after exactly k runs for each k up to n, modulo 1000000007.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Probability, Math
- Solved
- No attempts yet
Statement
Each time the machine runs, it dispenses a doll with probability . However, if no doll came out in the previous runs, a doll is dispensed with certainty regardless of .
Given , , and , find for every natural number the expected number of dolls obtained after exactly runs.
Input
The input consists of test cases. The first line contains the integer .
Each test case is one line containing the integers , , and , separated by spaces. is the probability that a doll comes out. Here .
The sum of over all test cases is at most .
Output
For each test case, print lines. On line , print the expected number of dolls obtained after exactly runs, modulo . Precisely, if the answer can be written as for natural numbers and , print .