#K2466. Selecting the Best Phone

    ID: 24743 Type: Default 1000ms 256MiB

Selecting the Best Phone

Selecting the Best Phone

You are given a list of phones, each with three ratings: Battery Life, Camera Quality, and Storage Capacity. In addition, you are given three integers representing Adam's preference percentages for each of these features (denoted by B, C, and S). The weighted score for a phone is computed as:

\[ \text{score} = \frac{B \times \text{Battery} + C \times \text{Camera} + S \times \text{Storage}}{100} \]

Your task is to select the phone with the highest weighted score. In the case of a tie, choose the phone which appears first in the list.

inputFormat

The first line contains an integer n — the number of phones.

The next n lines each contain three space-separated integers representing the ratings for Battery Life, Camera Quality, and Storage Capacity.

The last line contains three space-separated integers: B, C, and S — the preference percentages for Battery Life, Camera Quality, and Storage Capacity respectively.

It is guaranteed that the percentages sum to 100.

outputFormat

Output a single integer — the index (0-indexed) of the phone with the highest weighted score.

## sample
3
6 7 8
9 6 7
8 8 6
50 30 20
1

</p>