Largest Stock Price Decline

No attempts yetTime limit5sMemory limit256 MB

Problem

Fatima Cynara is an analyst at Amalgamated Artichokes (AA). Like any company, AA has had good years and bad ones. Fatima studies the trend of the AA stock price, and she wants to know the largest decline in the price over a given span of time. Suppose the prices over a span were 19, 12, 13, 11, 20 and 14. Then the largest decline is 8, from the first price to the fourth. If the last price were 10 instead of 14, the largest decline would be 10, between the last two prices.

From her earlier analyses Fatima found that the stock price over any period can be modelled accurately enough by

price(k)=p(sin(ak+b)+cos(ck+d)+2)\mathrm{price}(k) = p \cdot (\sin(ak+b) + \cos(ck+d) + 2)

where pp, aa, bb, cc and dd are constants and the angles of the sine and the cosine are in radians. Consider only integer values of kk. The decline between two prices price(i)\mathrm{price}(i) and price(j)\mathrm{price}(j) with i<ji < j is price(i)price(j)\mathrm{price}(i) - \mathrm{price}(j). Find the largest decline in the sequence of prices.

The figure above shows the price function of the first example. The largest decline runs from the fourth price to the seventh.

Input

The first line holds six integers pp, aa, bb, cc, dd and nn separated by spaces. (1p10001 \le p \le 1000, 0a,b,c,d10000 \le a, b, c, d \le 1000, 1n1061 \le n \le 10^6)

The first five integers are the constants of the price function. The prices to consider are price(1)\mathrm{price}(1), price(2)\mathrm{price}(2), \ldots, price(n)\mathrm{price}(n).

Output

Print the largest decline in the stock prices on one line, rounded to six decimal places. If the prices never decline, print 0.000000.