On activities held by Algorithm Association, lemon teas are provided to the participants almost infinitely. To store such a large number of lemon teas, Rikka wants to build some storehouses.
Rikka plans to build

storehouses, together with N-1 bidirectional roads. The i-th road connects the (i+1)-th storehouse and the

-th storehouse.
These storehouses will be built on an uneven piece of land. For each

, the altitude of the i-th storehouse is known to be

. Rikka can choose the altitudes for other storehouses arbitrarily. (The value of altitude can be any real number).
Carrying lemon teas on a steep hill is difficult. Rikka wants to make the road system as convenient as possible. Therefore, Rikka wants to minimize the square sum of the altitude difference of each road, i.e.
%5E2)
Due to the geological movement, the altitude of the last

storehouses often changes. Lucky, it is free for Rikka to change the altitude of the first

storehouses at any time.
Your task is to help Rikka to find out the optimal plan after each change.