It is dinner time for your pet fox. His meal consists of N crackers, and the i-th cracker has a temperature of Ti degrees Celsius. He also has a large dish of water whose temperature is W degrees Celsius.
After taking an initial sip of water, your fox begins his meal. Every time he eats a cracker, its tastiness is the absolute difference between its temperature and the temperature of the last thing he ate or drank. That last thing is either the previous cracker he ate or a sip of water, whichever he consumed most recently. He can drink some water whenever he wants, and he can eat the crackers in any order.
Depending on the order in which your fox eats and drinks, the total tastiness of the crackers he consumes may vary. Find the minimum and the maximum value of this total.