Seeds#887

Seeds

1 second
64 megabytes
Very easy

At the market, there is a row of spots where sunflower seeds are sold. Potential buyers walk along this row, eventually stopping to purchase seeds. The quality of the seeds is consistent across all spots, so the only differences are in the price and the location of the spot.

Before entering the market as a new seed seller, you conducted research to understand how the number of buyers depends on these two factors. The research found that most buyers follow a similar pattern: they pass by several spots, noting the prices, and after passing spots, they return to the spot with the lowest price they noticed and make a purchase there. If multiple spots have the same price, the buyer chooses the closest one.

Suppose there are five spots with prices , , , , . If a buyer with K=4 moves from left to right, they see prices , , , . At this moment, they decide they have seen enough, return to the third spot, and buy there. Although the second spot has the same price as the third, it is farther away for this buyer. If the same buyer enters from the right, they see prices , , , , and return to the fifth spot.

The number of spots passed before deciding () depends on each buyer's greed and patience and varies among buyers. The research provides the average percentage B_K of buyers for each (1 \leq K \leq N,\ 0 \leq B_K \leq 99), with the sum of all B_K equal to .

You are required to determine the optimal strategy for this market (that is, the price and placement of the new spot to maximize the expected average income), assuming that half of the customers move from the first spot to the -th and the other half from the -th to the first, all following the described pattern.

Input

The first line contains the number of existing spots . The second line contains integers — the prices at each spot. The third line contains integers from to — the values of B_K for each (2 \leq N \leq 100, each price between and ). All numbers in each line are separated by spaces.

Output

Print two integers — and . (0 < L < N) is the position after which the new spot should be placed (you cannot place your spot first or last). is the optimal price. If there is more than one optimal solution, you must choose the one with the minimum , and among those, the minimum .

Examples

Example 1

Loading
Loading