SCUSA Region ICPC Masthead ACM Balloon Logo
2017 ACM ICPC South Central USA Regional Programming Contest

A - Batter Up

While the Chicago Cubs were ecstatic with their 2016 World Series championship, they were eliminated from the playoffs in 2017. Looking ahead to 2018 they are beginning to embrace the more data-driven analysis of player's values known as Sabermetrics.

For example, a player's batting average is calculated by dividing the total number of base hits by the total number of official at-bats. One limitation of using the batting average to evaluate players is that it treats all hits equally, rather than taking into account doubles, triples or home runs. For this reason, analysts often prefer to consider what is known as the slugging percentage, which distinguishes between different hit outcomes. To calculate the slugging percentage, the total number of bases of all hits is divided by the total numbers of time at bat, that did not result in walks, or at-bats.

More specifically, an at-bat can earn 0, 1, 2, 3 or 4 bases ( these are referred to as official at-bats ). Furthermore, some at-bats, such as those that result in a base-on-balls ( i.e. a "walk") are not considered in either the player's batting average or slugging percentage.

For example, if a player hits a triple (allows him to run three bases), strikes out ( runs zero bases ), and hits a double ( runs two bases ), their slugging percentage would be (3+0+2 )/3 approxmately 1.666667. If a player hits a single ( 1 base ), walks, and hits a home run ( 4 bases ), the slugging level would be ( 1 + 4 ) / 2 = 2.5 . Notice that in this case, the denominator is two, not three, because the walk does not count towards the slugging percentage.


The input is composed of several lines. The first line contains a single postitive integer n where 1 ≤ n ≤ 100 that specifies the number of batters for whom we are calculating averages. The next two lines make a set both of which pertain to one batter:


Display the player's slugging percentage as a real number, accurate to within an absolute or relative error of 10-6.

Sample Input

3 0 2
-1 -1 -1 -1 0 0 0 0 0 0 1
1 -1 4

Sample Output