Andy managed to qualify for the CCO once again! That is, the Canadian **Chemistry** Olympiad (imagine doing chemistry LUL).

The CCO is comprised of two parts, a written examination where participants are expected to tackle grueling theoretical problems, as well as a practical component for which demonstrating lab prowess is necessary for a better final result.

Andy's theoretical knowledge is unrivaled. Unfortunately, his practical skills are not.

Aspiring to qualify for the even more prestigious IChO, Andy has decided to polish up his fundamentals. Specifically, his ability to mix solutions together.

He has put together an assortment of different solutions. Each is composed of chemicals, the solution is a mixture of of chemical A and of chemical B. As well, each solution comes with a cost of production .

Using any combination of his mixtures, Andy would like to create a solution in which the amounts of chemical A and B are in the ratio . Each of the solutions can only be used once. For all possible solutions with this ratio, he would like the one with the least total cost. Can you help Andy come up with the optimal solution?

Notice that sometimes Andy sets himself up for failure. In the case that making a solution with such a ratio is impossible, output .

#### Input Specification

The first line contains three integers , and .

The next lines will each contain three integers .

#### Output Specification

Output one integer, the minimum cost to make a solution with a ratio of , or if it is not possible.

#### Subtasks

##### Subtask 1 [10%]

##### Subtask 2 [90%]

No further constraints.

#### Sample Input 1

```
3 1 1
1 1 10
1 2 2
2 1 3
```

#### Sample Output 1

`5`

#### Sample Explanation 1

It is optimal to use the second and third mixtures to yield a solution with of solution A and of solution B, resulting in a ratio of .

#### Sample Input 2

```
1 4 3
3 4 100000
```

#### Sample Output 2

`-1`

## Comments