### Problem Statement

The lake where we vacation sometimes floods. As soon as the level reaches the maximum level that can be contained by the banks of the lake, the additional water covers a fixed floodplain area, which enlarges the area of the lake. Below are views of the lake from the side, with water indicated by X's.
```
|              |          |              |
|___        ___|          |XXXXXXXXXXXXXX|
|      |                  |XXXXXX|
|      |                  |XXXXXX|
|XXXXXX|                  |XXXXXX|
|XXXXXX|                  |XXXXXX|

(not flooded)             (flooded)

```
The amount of evaporation depends on the surface area. When the lake is not flooded, the evaporation is evapNormal units of water per day. When the lake is flooded, the evaporation is evapFlood units per day. The lake never goes dry and never extends beyond the floodplain.

Assume that the lake is initially full but not flooded. Create a class WaterLevel that contains a method netAmt that is given evapNormal, evapFlood, and int[] rain, the amounts of rain that fell on each day during our vacation. The method returns the net increase (a positive value) or decrease (a negative value) in the units of water in the lake during our vacation. The i-th element of rain tells how many units of water fell during the entire i-th day. You should assume that it rains at a constant rate throughout the day.

### Definition

 Class: WaterLevel Method: netAmt Parameters: int, int, int[] Returns: double Method signature: double netAmt(int evapNormal, int evapFlood, int[] rain) (be sure your method is public)

### Notes

-A return value with either an absolute or relative error of less than 1.0E-9 is considered correct.

### Constraints

-evapNormal will be between 0 and 1000 inclusive
-evapFlood will be between evapNormal and 1000 inclusive
-rain will contain between 1 and 50 elements inclusive
-each element of rain will be between 0 and 1000 inclusive

### Examples

0)

 `20` `40` `{0,60,0,0}`
`Returns: -35.0`
 After the first day, 20 units have evaporated so we are 20 units below flood stage. After the first half of the second day, 30 units of rain have fallen while 10 units have evaporated, so we have reached flood stage. By the end of the day another 30 have fallen and 20 (40 / 2) have evaporated leaving us 10 units above flood stage. On the third day, we leave flood stage after 1/4 of a day. By the end of the day we are 15 units below flood stage. On the fourth day 20 units evaporate leaving us 35 units below flood stage.
1)

 `20` `39` `{0,60}`
`Returns: 10.5`
 After the first day, we are 20 units below flood stage. We reach flood stage after half of the next day. During the last half of the day 30 units of rain fall while 19.5 units evaporate.
2)

 `20` `40` `{0}`
`Returns: -20.0`
3)

 `200` `800` `{0,600}`
`Returns: 0.0`
 After the first day, the level is 200 below flood stage due to evaporation. Halfway through the second day, 300 units have rain have fallen and 100 units have evaporated so we have just reached flood stage. After that we are at a stable equilibrium in which the level does not change.

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=2263

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=5071&pm=2263

dgoodman

#### Testers:

zoidal , lbackstrom , brett1479

Math