SP25048 ROOBOT - Robot
Description
There is a robot on the 2D plane. Robot initially standing on the position (0, 0). Robot can make a 4 different moves:
1. Up (from (x, y) to (x, y + 1)) with probability **U**.
2. Right (from (x, y) to (x + 1, y)) with probability **R**.
3. Down (from (x, y) to (x, y - 1)) with probability **D**.
4. Left (from (x, y) to (x - 1, y)) with probability **L**.
After moving **N** times Robot gets points.
- Let x $ _{1} $ be the smallest coordinate in X-axis, that Robot reached in some moment.
- Let x $ _{2} $ be the largest coordinate in X-axis, that Robot reached in some moment.
- Let y $ _{1} $ be the smallest coordinate in Y-axis, that Robot reached in some moment.
- Let y $ _{2} $ be the largest coordinate in Y-axis, that Robot reached in some moment.
Points achieved by Robot equals to x $ _{2} $ - x $ _{1} $ + y $ _{2} $ - y $ _{1} $ .
Given **N, U, R, D, L**. Calculate [expected value](https://en.wikipedia.org/wiki/Expected_value) of points that Robot achieved after **N** moves.
Input Format
First line: One interger **N (1 .**
Second line: Four real numbers **U, R, D, L (U + R + D + L = 1, 0** ) with maximum of 6 numbers after dot.
Output Format
One number: expected value of points achieved by Robot. The answer will be considered correct if its relative or absolute error does not exceed 10 $ ^{-6} $ .