Room Temperature
문제
President K is taking on the role of adjusting the room temperature of the officers’ room. He wants to make the officers as comfortable as possible.
Now there are officers in the room. Each officer is numbered from to , and the appropriate temperature for officers (1 ≤ i ≤ N) is degrees when (s)he is not wearing jackets. For each officer, the appropriate temperature drops by degrees every time (s)he wears a jacket. In other words, when the officer is wearing jackets, her/his appropriate temperature is A_i − kT degrees.
When the room temperature is degrees and the appropriate temperature of a certain officer is degrees, the discomfort index of the officer is expressed as |x − y|. Note that represents the absolute value of . Each officer wears the appropriate number of jackets of or more to minimize discomfort index, depending on the room temperature.
Here, president K decided to call the maximum discomfort index among all officers as room’s unpleasantness, and set the room temperature so that the room’s unpleasantness was minimized. Note that the room temperature must be an integer.
Write a program which, given information about the officers and the appropriate temperature, calculates the minimum room’s unpleasantness.
입력
Read the following data from the standard input.
출력
Write one line to the standard output. The output should contain the minimum room’s unpleasantness.
예제
예제 1
2 4 19 24
1
예제 2
3 1 21 19 23
0
예제 3
6 8 24 22 21 25 29 17
2