Snow Plowing | 프로그래밍의 벗 PivotOJ
PivotOJ

Snow Plowing

시간 제한: 1000ms메모리 제한: 1024MB출처: LMIO 2015-2016BOJ 30290
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

There has been snowing heavily last night. Prienai snow plowing company now faces a huge challenge – it has to clean L kilometers of snow-covered road.

The company owns N snow plowers numbered from 1 to N. Initially, i-th snow plower is parked in a garage located at the Ai-th kilometer of the road. It costs Ki euros for the i-th snow plower to drive one kilometer.

[이미지 1]

After finishing the work all snow plowers must return to the garages they left from. In order to avoid traffic jams they have to finish plowing and return to garages within T minutes.

Every vehicle can drive at most 1 kilometer per minute, regardless of whether it is plowing or not.

Calculate the lowest possible cost for cleaning the snow off the entire road.

입력

The first row contains three integers: the number of snow plowers N, the length of the road L, the duration in minutes T in which the road has to be cleaned and the snow plowers have to get back to their garages.

N rows follow, i-th of which contains two integers: Ai, the distance from the beginning of the road to the i-th garage, and Ki – the cost of driving one kilometer for that snow plower. All garage coordinates are presented in strictly ascending order (Ai < Ai+1 for every i).

출력

Output a single number – the lowest possible cost of cleaning the road. If it is impossible to clean the road in T minutes output the word NEPAVYKS.

예제

예제 1

입력
2 5 6
0 2
3 1
출력
14

예제 2

입력
2 3 5
0 2
3 1
출력
7
코드를 제출하려면 로그인하세요.