Hide

Problem F
One Shot

Alice is playing Prisons and Porcupines, a game where people roll a set of dice to determine damage dealt in a single attack against an enemy. The damage dealt is the result of the rolled dice summed together. Alice knows the number of dice that are rolled for her first attack, and the amount of Health Points the enemy has. What is the chance that Alice’s damage dealt on the first attack is equal to or higher than the enemy’s Health Points? (This is known as a One Shot)

Input

The first line contains 7 integers, $d_i$ ($0 \leq d_i \leq 3$), the number of dice with 2, 4, 6, 8, 10, 12, and 20 sides, respectively, that will be rolled for Alice’s attack. The second line of input is a single integer, $h$ ($1 \leq h \leq 200$), the enemy’s Health Points.

Output

Output a single number: the total probability that Alice’s damage dealt on a single attack is equal to or higher than the enemy’s Health Points. Your answers should have an absolute error of at most $10^{-6}$.

Sample Input 1 Sample Output 1
0 0 0 0 0 0 1
20
0.05
Sample Input 2 Sample Output 2
1 0 1 0 0 0 1
20
0.3

Please log in to submit a solution to this problem

Log in