cho.sh
Notes
Loading...

Random Robot

Time limit

1s

Memory limit

128 MB

Problem

A robot is on an infinite grid. It will make exactly N moves.

On each move, the robot chooses one of east, west, south, and north according to the given probabilities, then moves one cell in that direction.

A path is simple if no grid cell is visited more than once, including the starting cell. For example, EENE and ENW are simple paths, while ENWS and WWWWSNE are not because they visit a cell that was already visited. Here E, W, N, and S mean east, west, north, and south, respectively.

Compute the probability that the robot's path after N moves is simple.

Input

The first line contains N, followed by the probabilities of moving east, west, south, and north, in that order.

N is a positive integer no greater than 14. Each probability is an integer from 0 to 100, and the four probabilities sum to 100. Probabilities are given as percentages.

Output

Print the probability that the robot's path is simple.

An absolute or relative error of at most 10^-9 is accepted.