"Metro"
Bunny McRabbit, mayor of Rabbitville, has decided that the city needs an underground metro system. The system will consist of a single line and the line will go straight from one side of Rabbitville to the opposite side of the city. There will not be bends of any kind, mayor insists. Furthermore, there will be underground stations at a few precisely specified locations on the line. Each station will have a single street-level entrance located along the metro line (above the tunnel or beyond it, but on the same line with the tunnel anyway). Entrance to the station cannot be too far from the station itself. In fact, distance along the line between a station and its entrance can be at most d (but can be less than that or even equal 0). Please help Mr. McRabbit to choose locations for the entrances in such a way that distances between any two consecutive stations’ entrances will be the same.
Input
We consider both metro stations and their entrances to be points on the line containing the tunnel. In the first line of the input there are two integers: n, the total number of metro stations (2 ≤ n ≤ 1000), and d, the maximum distance allowed between a station and its entrance (0 ≤ d ≤ 10 000). The second line of the input contains n distinct integers, in ascending order, with absolute values not exceeding 10^9. These are the coordinates of the first, second, …, last stations on the line.
Output
Output n integers which are coordinates of entrances to the first, second, …, last metro stations respectively. No two entrances can be located at the same point. If there are multiple solutions, you can output any one of them. If there are no integral solutions, output 0.