Waterfront

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

On the waterfront of the Prahova River, the Mayor of Ploieşti planted a row of NN ornamental tree shrubs of various varieties, each tree shrub ii initially having the height height\[i]height\[i], 1iN1 ≤ i ≤ N. Depending on the soil in which it is planted and the weather, the shrub ii grows daily with height dailyGrowth\[i]dailyGrowth\[i].

Every day the town hall gardener adjusts the height of the tree shrubs by cutting them with scissors. However, the gardener is limited by the quality of the scissors. Thus, with one cut they can cut off exactly xx centimeters from the height of a shrub tree if the height is at least xx centimeters (note that the tree shrub may reach height 00 after a cut). In order not to get tired, the gardener can perform at most kk cuts in a day. The gardener can make several cuts on the same tree shrub in one day.

The mayor organizes an artistic event after MM days and wants to know what is the minimum possible height of the tallest tree shrub after the MM days.

Note! Every day, the trees grow first, and then the cuts are done.

입력

The first line contains NN, MM, kk and xx. Of the following NN lines, the iith contains height\[i]height\[i] and dailyGrowth\[i]dailyGrowth\[i], separated by a single space.

출력

Output a non-negative integer, representing the minimum height of the tallest tree shrub, after the MM days.

제한

  • 1k1,0001 ≤ k ≤ 1\\,000
  • 1x10,0001 ≤ x ≤ 10\\,000
  • 0height\[i]10,0000 ≤ height\[i] ≤ 10\\,000
  • 0dailyGrowth\[i]10,0000 ≤ dailyGrowth\[i] ≤ 10\\,000

힌트

The gardener cuts the trees in 33 days, making 44 cuts every day. At each cut they can remove 33 centimeters from the height of one tree. The following table summarises the optimal way to make the cuts.

DayTreeOperations
11112+57342 \xrightarrow{+5} 7 \xrightarrow{-3} 4
223+253 \xrightarrow{+2} 5
330+440 \xrightarrow{+4} 4
442+8103734312 \xrightarrow{+8} 10 \xrightarrow{-3} 7 \xrightarrow{-3} 4 \xrightarrow{-3} 1
22114 +59 36 334 \xrightarrow{+5} 9 \xrightarrow{-3} 6 \xrightarrow{-3} 3
225 +275 \xrightarrow{+2} 7
334 +484 \xrightarrow{+4} 8
441 +89 36 331 \xrightarrow{+8} 9 \xrightarrow{-3} 6 \xrightarrow{-3} 3
33113 +583 \xrightarrow{+5} 8
227 +29 367 \xrightarrow{+2} 9 \xrightarrow{-3} 6
338 +412 39 368 \xrightarrow{+4} 12 \xrightarrow{-3} 9 \xrightarrow{-3} 6
443 +811 383 \xrightarrow{+8} 11 \xrightarrow{-3} 8