After waking up at *hh*:*mm*, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is *H* points, moreover each minute without food increases his hunger by *D* points.

At any time Andrew can visit the store where tasty buns are sold (you can assume that is doesn't take time to get to the store and back). One such bun costs *C* roubles and decreases hunger by *N* points. Since the demand for bakery drops heavily in the evening, there is a special 20% discount for buns starting from 20:00 (note that the cost might become rational). Of course, buns cannot be sold by parts.

Determine the minimum amount of money Andrew has to spend in order to feed his cat. The cat is considered fed if its hunger level is less than or equal to zero.
The first line contains two integers *hh* and *mm* (00 ≤ *hh* ≤ 23, 00 ≤ *mm* ≤ 59) — the time of Andrew's awakening.

The second line contains four integers *H*, *D*, *C* and *N* (1 ≤ *H* ≤ 10<sup class="upper-index">5</sup>, 1 ≤ *D*, *C*, *N* ≤ 10<sup class="upper-index">2</sup>).
In the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.

In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per 15 roubles each and spend a total of 1365 roubles.
19 00
255 1 100 1
25200.0000
17 41
1000 6 15 11
1365.0000
16 34
61066 14 50 59
43360.0000
18 18
23331 86 87 41
49590.0000
10 48
68438 8 18 29
36187.2000
08 05
63677 9 83 25
186252.0000
00 00
100000 100 100 100
100000.0000
20 55
100000 100 100 100
80000.0000
23 59
100000 100 100 100
80000.0000
00 00
1 100 100 100
100.0000
21 26
33193 54 97 66
39032.8000
20 45
33756 24 21 1
567100.8000
14 33
92062 59 89 72
110146.4000
01 24
92730 5 35 29
94920.0000
20 58
93398 43 86 99
64947.2000
23 04
37170 81 32 64
14873.6000
01 38
70542 27 74 26
200836.0000
04 28
38505 65 25 95
10150.0000
00 10
33077 21 40 22
60160.0000
10 44
66449 67 90 83
72090.0000
05 51
10220 5 33 48
7029.0000
20 19
68886 28 48 94
28147.2000
01 49
11621 55 78 46
19734.0000
21 28
78549 91 4 98
2566.4000
18 06
88580 22 35 59
43232.0000
22 28
55507 53 61 11
246293.6000
18 58
22434 84 91 59
34143.2000
15 36
32466 27 22 15
46464.0000
17 31
9603 53 73 74
9490.0000
14 53
76530 92 4 22
13916.0000
18 31
10753 23 30 74
4152.0000
17 43
16290 46 90 94
15660.0000
18 38
3652 11 53 94
2067.0000
19 57
3 4 7 6
7.0000
import math
hh,mm=map(int,input().split())
h,d,c,n=map(int,input().split())
x=60-mm
y=60*(19-hh)
p=math.ceil(h/n)
if hh>=20:
	print("{0:0.4f}".format(p*c*0.8))
else:
	b=h+d*(x+y)
	bc=math.ceil(b/n)
	print("{0:0.4f}".format(min(p*c,0.8*bc*c)))
