Only *T* milliseconds left before the start of well-known online programming contest Codehorses Round 2017.

Polycarp needs to download B++ compiler to take part in the contest. The size of the file is *f* bytes.

Polycarp's internet tariff allows to download data at the rate of one byte per *t*<sub class="lower-index">0</sub> milliseconds. This tariff is already prepaid, and its use does not incur any expense for Polycarp. In addition, the Internet service provider offers two additional packages:
 -  download *a*<sub class="lower-index">1</sub> bytes at the rate of one byte per *t*<sub class="lower-index">1</sub> milliseconds, paying *p*<sub class="lower-index">1</sub> burles for the package; -  download *a*<sub class="lower-index">2</sub> bytes at the rate of one byte per *t*<sub class="lower-index">2</sub> milliseconds, paying *p*<sub class="lower-index">2</sub> burles for the package. 
Polycarp can buy any package many times. When buying a package, its price (*p*<sub class="lower-index">1</sub> or *p*<sub class="lower-index">2</sub>) is prepaid before usage. Once a package is bought it replaces the regular tariff until package data limit is completely used. After a package is consumed Polycarp can immediately buy a new package or switch to the regular tariff without loosing any time. While a package is in use Polycarp can't buy another package or switch back to the regular internet tariff.

Find the minimum amount of money Polycarp has to spend to download an *f* bytes file no more than in *T* milliseconds.

Note that because of technical reasons Polycarp can download only integer number of bytes using regular tariff and both packages. I.e. in each of three downloading modes the number of downloaded bytes will be integer. It means that Polycarp can't download a byte partially using the regular tariff or/and both packages.
The first line contains three integer numbers *f*, *T* and *t*<sub class="lower-index">0</sub> (1 ≤ *f*, *T*, *t*<sub class="lower-index">0</sub> ≤ 10<sup class="upper-index">7</sup>) — size of the file to download (in bytes), maximal time to download the file (in milliseconds) and number of milliseconds to download one byte using the regular internet tariff.

The second line contains a description of the first additional package. The line contains three integer numbers *a*<sub class="lower-index">1</sub>, *t*<sub class="lower-index">1</sub> and *p*<sub class="lower-index">1</sub> (1 ≤ *a*<sub class="lower-index">1</sub>, *t*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">1</sub> ≤ 10<sup class="upper-index">7</sup>), where *a*<sub class="lower-index">1</sub> is maximal sizes of downloaded data (in bytes), *t*<sub class="lower-index">1</sub> is time to download one byte (in milliseconds), *p*<sub class="lower-index">1</sub> is price of the package (in burles).

The third line contains a description of the second additional package. The line contains three integer numbers *a*<sub class="lower-index">2</sub>, *t*<sub class="lower-index">2</sub> and *p*<sub class="lower-index">2</sub> (1 ≤ *a*<sub class="lower-index">2</sub>, *t*<sub class="lower-index">2</sub>, *p*<sub class="lower-index">2</sub> ≤ 10<sup class="upper-index">7</sup>), where *a*<sub class="lower-index">2</sub> is maximal sizes of downloaded data (in bytes), *t*<sub class="lower-index">2</sub> is time to download one byte (in milliseconds), *p*<sub class="lower-index">2</sub> is price of the package (in burles).

Polycarp can buy any package many times. Once package is bought it replaces the regular tariff until package data limit is completely used. While a package is in use Polycarp can't buy another package or switch back to the regular internet tariff.
In the first example Polycarp has to buy the first additional package 5 times and do not buy the second additional package. He downloads 120 bytes (of total 26·5 = 130 bytes) in 120·8 = 960 milliseconds (960 ≤ 964). He spends 8·5 = 40 burles on it.

In the second example Polycarp has enough time to download 10 bytes. It takes 10·20 = 200 milliseconds which equals to upper constraint on download time.

In the third example Polycarp has to buy one first additional package and one second additional package.

In the fourth example Polycarp has no way to download the file on time.
120 964 20
26 8 8
13 10 4
40
10 200 20
1 1 1
2 2 3
0
8 81 11
4 10 16
3 10 12
28
8 79 11
4 10 16
3 10 12
-1
62 10000 209
95 106 79
84 92 57
57
705 100000 157
31 123 36
37 111 10
70
5848 10000000 3431
85 1154 19
92 1093 35
1004
66983 1000000 19
34 10 96
5 7 7
31815
455314 1000000 5
1 2 42
57 2 60
447960
3982256 10000000 6
34 2 11
80 1 83
1123749
97 10000 229
76 64 67
38 75 21
63
804 100000 190
13 115 24
86 91 65
438
6794 10000000 1720
63 1386 3
46 1367 90
243
66287 1000000 44
4 15 88
66 14 63
60984
482426 1000000 2
82 1 34
10 1 16
0
3601769 10000000 6
16 2 87
37 2 42
3294942
86 10000 283
46 86 59
99 65 80
80
985 100000 203
90 93 12
48 66 21
132
9177 10000000 3121
45 600 95
3 1018 54
15675
59251 1000000 24
85 16 76
20 8 18
23742
674801 1000000 1
60 1 19
64 1 71
0
3919525 10000000 3
85 1 79
91 1 98
817255
96 10000 184
28 76 43
49 92 36
72
902 100000 265
72 87 100
2 78 80
1100
8622 10000000 2094
18 967 79
57 1021 9
1188
65359 1000000 24
63 11 60
73 10 78
41676
867175 1000000 1
33 1 11
25 1 31
0
4825706 10000000 5
63 2 67
45 2 53
5008543
99 10000 173
5 78 35
10 89 91
560
912 100000 206
42 102 92
55 76 44
572
8249 10000000 1757
92 1030 67
14 970 65
4556
67872 1000000 39
45 13 52
31 12 33
64944
789332 1000000 2
7 1 99
75 1 86
663576
3215535 10000000 8
40 2 55
10 1 9
2021697
85 10000 217
83 66 23
64 108 51
23
975 100000 231
19 96 76
17 77 99
3724
7683 10000000 2221
70 902 59
76 1138 24
2064
64431 1000000 18
22 14 40
84 14 89
42355
530692 1000000 3
85 1 87
37 1 41
303016
4121717 10000000 4
18 2 43
64 1 68
2297448
80 10000 344
53 87 11
18 63 10
21
952 100000 283
97 52 64
66 71 58
506
6584 10000000 4115
51 1248 43
29 1290 80
5031
66326 1000000 20
88 13 20
46 12 60
10620
788404 1000000 2
66 1 75
90 1 1
6409
4857625 10000000 6
100 2 35
21 2 24
1675275
92 10000 275
34 73 99
83 77 66
66
666 100000 397
75 102 56
28 123 18
396
9951 10000000 2037
29 545 35
79 794 35
3675
79855 1000000 20
69 11 8
100 9 15
7694
636673 1000000 1
44 1 63
44 1 56
0
2827186 10000000 9
69 3 19
75 2 91
708814
1 1 1
1 1 1
1 1 1
0
10000000 10000000 10000000
10000000 10000000 10000000
10000000 10000000 10000000
-1
10000000 10000000 10000000
1 1 10000000
1 1 10000000
100000000000000
49266 10000000 10000000
2 120 48
3 193 90
1182384
49038 10000000 10000000
2 142 69
3 170 73
1193258
49470 10000000 10000000
1 114 51
2 141 56
1385160
543948 10000000 10000000
1 14 52
2 16 75
20398050
2400000 10000000 7
7 3 5
19 5 2
861658
6666666 10000000 4
1 1 3
1 2 2
16666664
2860000 9360000 65
5 2 47
7 5 6
16518696
4614000 9997000 6
2 1 70
3 3 5
71773335
6666666 8888888 4
1 1 3
1 2 2
17777776
6666666 7777777 4
1 1 3
1 2 2
18888887
6000000 10000000 3
2 1 5
3 2 2
7666668
76050 76050 1000000
101 1 101
313 1 313
76050
152380 152380 1000000
277 1 277
229 1 229
152380
160702 160702 1000000
223 1 223
347 1 347
160702
60632 60632 1000000
269 1 269
109 1 109
60632
152118 152118 1000000
199 1 199
167 1 167
152118
191864 191864 1000000
137 1 137
499 1 499
191864
161084 161084 1000000
443 1 443
317 1 317
161084
204520 204520 1000000
211 1 211
337 1 337
204520
124908 124908 1000000
173 1 173
157 1 157
124908
123510 123510 1000000
263 1 263
251 1 251
123510
2000000 10000000 9
3 3 5
5 7 2
2066668
7000000 10000000 9
3 1 5
5 2 2
7866670
7000000 10000000 5
3 1 5
5 3 2
9766670
10 12 14
19 2 4
8 1 10
14
4 5 6
7 2 2
3 1 7
9
9 39 22
7 9 13
8 3 22
35
5 15 2
21 11 9
15 2 6
0
15 464 32
65 28 96
33 93 48
96
15 419 32
65 28 96
33 93 48
-1
8581 3000000 3019
2151 140 4553
5920 883 9170
18212
8581 1201339 3019
2151 140 4553
5920 883 9170
-1
31 530 58
12 16 35
8 92 1
105
31 830 58
12 16 35
8 92 1
70
31 490 58
12 16 35
8 92 1
-1
3 14 5
2 4 9
7 6 11
9
3 15 5
2 4 9
7 6 11
0
3 12 5
2 4 9
7 6 11
18
3 11 5
2 4 9
7 6 11
-1
343 50397 187
735 732 357
147 864 838
-1
23 264 90
66 99 60
80 12 94
-1
68 1034 84
78 59 3
5 9 29
351
68 734 84
78 59 3
5 9 29
406
68 534 84
78 59 3
5 9 29
-1
65 649 24
90 9 5
23 92 71
5
65 580 24
90 9 5
23 92 71
-1
20 30 21
9 6 14
6 1 21
77
1 2 2
2 2 2
1 2 1
0
2 1 3
3 3 2
2 2 2
-1
3 1 1
3 3 2
2 3 1
-1
4 1 5
4 3 5
4 5 5
-1
5 2 2
6 6 5
4 3 2
-1
4 3 2
6 3 5
2 4 3
-1
3 3 3
1 1 5
7 3 7
15
9 3 8
1 2 1
8 2 6
-1
8 8 1
1 1 2
7 7 8
0
6 2 1
9 6 2
8 8 11
-1
2 7 6
7 12 7
10 7 1
-1
3 2 5
2 4 9
7 6 11
-1
4 4 1
6 9 7
4 3 6
0
1 14 3
5 1 14
2 7 8
0
6 16 1
5 10 2
11 15 7
0
17 1 3
10 1 3
16 16 5
-1
6 9 2
18 18 16
3 3 14
-1
11 3 17
11 15 5
2 10 3
-1
20 4 1
20 10 14
14 10 4
-1
def ceil(a, b):
    if a % b==0:
        return a//b
    else:
        return a//b+1

def process(f, T, t0, a1, t1, p1, a2, t2, p2):
    if f*t0 <= T:
        print("0")
        return
    elif t0 <= t1 and t0 <= t2:
        print("-1")
        return
    elif t0 > t1 and t0 <= t2:
        C1 = (t0-t1)
        R = f*t0-T
        X = R//C1
        if C1*X < R:
            X+=1
        if f >= X:
            answer = p1*ceil(X, a1)
            print(f'{answer}')
            return
        else:
            print("-1")
            return
        """     
        print(f'Minimize ceil(X/{a1})')
        print('Under Constraints')
        print(f'{C1}X >= {R}')
        print("And")
        print(f'{f} >= X')
        """
    elif t0 <= t1 and t0 > t2:
        C2 = (t0-t2)
        R = f*t0-T
        Y = R//C2
        if C1*Y < R:
            Y+=1
        if f >= Y:
            answer = p2*ceil(Y, a2)
            print(f'{answer}')
            return
        else:
            print("-1")
            return
        """
        print(f'Minimize {p2}ceil(Y/{a2})')
        print('Under Constraints')
        print(f'{C2}Y >= {R}')
        print("And")
        print(f'{f} >= Y')
        """
    else:
        C1 = (t0-t1)
        C2 = (t0-t2)
        R = f*t0-T
        Ci = max(C1, C2)
        if Ci*f < R:
            print("-1")
            return
        answer = float('inf')
        X = R//C1
        if C1*X < R:
            X+=1
        if f >= X:
            answer = min(answer, p1*ceil(X, a1))
        Y = R//C2
        if C2*Y < R:
            Y+=1
        if f >= Y:
            answer = min(answer, p2*ceil(Y, a2))
        X = R//C1
        if C1*X < R:
            X+=1
        X = (X-X % a1)
        Y = (R-C1*X)//C2
        if C1*X+C2*Y < R:
            Y+=1
        answer = min(answer, p1*ceil(X, a1)+p2*ceil(Y, a2))
        Y = R//C2
        if C2*Y < R:
            Y+=1
        Y = (Y-Y%a2)
        X = (R-C2*Y)//C1
        if C1*X+C2*Y < R:
            X+=1
        answer = min(answer, p1*ceil(X, a1)+p2*ceil(Y, a2))
        print(answer)
        return 
        """
        print(f'Minimize ceil(X/{a1})*{p1}+ceil(Y/{a2})*{p2}')
        print('Under Constraints')
        print(f'{C1}X+{C2}Y >= {R}')
        print("And")
        print(f'{f} >= X+Y')        
        
        """
    
    
f, T, t0 = [int(x) for x in input().split()]
a1, t1, p1 = [int(x) for x in input().split()]
a2, t2, p2 = [int(x) for x in input().split()]
process(f, T, t0, a1, t1, p1, a2, t2, p2)