#P1743E. FTL

FTL

Description

Monocarp is playing a video game. In the game, he controls a spaceship and has to destroy an enemy spaceship.

Monocarp has two lasers installed on his spaceship. Both lasers 11 and 22 have two values:

  • pip_i — the power of the laser;
  • tit_i — the reload time of the laser.

When a laser is fully charged, Monocarp can either shoot it or wait for the other laser to charge and shoot both of them at the same time.

An enemy spaceship has hh durability and ss shield capacity. When Monocarp shoots an enemy spaceship, it receives (Ps)(P - s) damage (i. e. (Ps)(P - s) gets subtracted from its durability), where PP is the total power of the lasers that Monocarp shoots (i. e. pip_i if he only shoots laser ii and p1+p2p_1 + p_2 if he shoots both lasers at the same time). An enemy spaceship is considered destroyed when its durability becomes 00 or lower.

Initially, both lasers are zero charged.

What's the lowest amount of time it can take Monocarp to destroy an enemy spaceship?

The first line contains two integers p1p_1 and t1t_1 (2p150002 \le p_1 \le 5000; 1t110121 \le t_1 \le 10^{12}) — the power and the reload time of the first laser.

The second line contains two integers p2p_2 and t2t_2 (2p250002 \le p_2 \le 5000; 1t210121 \le t_2 \le 10^{12}) — the power and the reload time of the second laser.

The third line contains two integers hh and ss (1h50001 \le h \le 5000; 1s<min(p1,p2)1 \le s < \min(p_1, p_2)) — the durability and the shield capacity of an enemy spaceship. Note that the last constraint implies that Monocarp will always be able to destroy an enemy spaceship.

Print a single integer — the lowest amount of time it can take Monocarp to destroy an enemy spaceship.

Input

The first line contains two integers p1p_1 and t1t_1 (2p150002 \le p_1 \le 5000; 1t110121 \le t_1 \le 10^{12}) — the power and the reload time of the first laser.

The second line contains two integers p2p_2 and t2t_2 (2p250002 \le p_2 \le 5000; 1t210121 \le t_2 \le 10^{12}) — the power and the reload time of the second laser.

The third line contains two integers hh and ss (1h50001 \le h \le 5000; 1s<min(p1,p2)1 \le s < \min(p_1, p_2)) — the durability and the shield capacity of an enemy spaceship. Note that the last constraint implies that Monocarp will always be able to destroy an enemy spaceship.

Output

Print a single integer — the lowest amount of time it can take Monocarp to destroy an enemy spaceship.

Sample Input 1

5 10
4 9
16 1

Sample Output 1

20

Sample Input 2

10 1
5000 100000
25 9

Sample Output 2

25

Note

In the first example, Monocarp waits for both lasers to charge, then shoots both lasers at 1010, they deal (5+41)=8(5 + 4 - 1) = 8 damage. Then he waits again and shoots lasers at 2020, dealing 88 more damage.

In the second example, Monocarp doesn't wait for the second laser to charge. He just shoots the first laser 2525 times, dealing (109)=1(10 - 9) = 1 damage each time.