Souma wants to make a small amount of a food .
To make the food , he needs to prepare a mixture of two ingredients and , with a ratio of , both mass in grams.
Unfortunately, he has ran out of ingredients at his house. Therefore, he will go to the local grocery store to purchase the needed ingredients.
The grocery store sells kinds of ingredients. For each ingredient, there is exactly one package of it in stock.
The package of ingredient contains grams of the ingredient and grams of the ingredient , sold for dollars.
Souma intends to purchase some of these packages. He needs to use all of the purchased items to make his food .
Find the minimum amount of money required for him to make his desired food, .
If it is impossible to make his desired food, output -1
.
Constraints
Input Specification
The first line of input will contain 3 space separated integers, , , and .
The next lines of input will contain 3 space separated integers, , , and .
Sample Input 1
1 1 10
10 10 10
Sample Output 1
-1
Sample Input 2
3 1 1
1 2 1
2 1 2
3 3 10
Sample Output 2
3
Comments