## 28218: Slalom

[提交][状态][讨论版][数据上传:][下载FPS1元][下载测试数据1元][20kb]

## 题目描述

You are competing in a ski slalom, and you need to select the best skis for the race. The format of the race is that there are

N

pairs of left and right gates, where each right gate is

W

metres to the right of its corresponding left gate, and you may neither pass to the left of the left gate nor to the right of the right gate. The

ith

pair of gates occurs at distance

yi

down the hill, with the horizontal position of the

ith

left gate given by

xi

. Each gate is further down the hill than the previous gate (i.e.

yi

<

yi+1

for all

i

).

You may select from S pairs of skis, where the jth pair has speed sj. Your movement is governed by the following rule: if you select a pair of skis with speed sj, you move with a constant downward velocity of sj metres per second. Additionally, at any time you may move at a horizontal speed of at most vh metres per second.

You may start and finish at any two horizontal positions. Determine which pair of skis will allow you to get through the race course, passing through all the gates, in the shortest amount of time.

## 输入

The first line of input contains the three integers W, vh, and N, separated by spaces, with 1 <= W <= 108, 1 <= vh <= 106, and 1 <= N <= 105.

The following N lines of input each contain two integers xi and yi, the horizontal and vertical positions respectively of the ith left gate, with 1 <= xi, yi <= 108.

The next line of input contains an integer S, the number of skis, with 1 <= S <= 106.

The following S lines of input each contain one integer sj, the speed of the jth pair of skis, with 1 <= sj <= 106.

##### I
3 2 3
1 1
5 2
1 3
3
3
2
1

##### II
3 2 3
1 1
5 2
1 3
1
3


## 输出

If it is impossible to complete the race with any pair of skis, print the lineIMPOSSIBLE. Otherwise, print the vertical speed sj of the pair of skis that allows you to get through the race course in the shortest time.

##### I
2

##### II
IMPOSSIBLE


## 样例输入

3 2 3
1 1
5 2
1 3
3
3
2
1


## 样例输出

2


[提交][状态]