There are houses on a number line. House is located at coordinate .
Santa Claus wants to choose some houses and build a chimney at each of them. Building a chimney at house costs , and the total cost is the sum of these costs over the chosen houses.
A chimney at house allows gifts to be delivered to every house satisfying , including house itself.
Find the minimum total cost needed to ensure that every house can receive gifts.
The input is given in the following format:
Print the minimum total chimney cost that allows every house to receive gifts.
The first line contains the number of houses and the delivery distance . The second line contains the chimney costs . Numbers on the same line are separated by spaces.
| 4 | 47 | No additional constraints. |