Bessie has an array a_1,…,a_N, where 1≤N≤300 and 0≤a_i≤109 for all i. She won't tell you a itself, but she will tell you the range of each subarray of a. That is, for each pair of indices i≤j, Bessie tells you r_i,j=maxa\[i…j]−mina\[i…j]. Given these values of r, please construct an array that could have been Bessie's original array. The values in your array should be in the range \[−109,109].
The first line contains N.
Another N lines follow. The ith of these lines contains the integers r_i,i,r_i,i+1,…,r_i,N.
It is guaranteed that there is some array a with values in the range \[0,109] such that for all i≤j, r_i,j=maxa\[i…j]−mina\[i…j].
Output one line containing N integers b_1,b_2,…,b_N in the range \[−109,109] representing your array. They must satisfy r_i,j=maxb\[i…j]−minb\[i…j] for all i≤j.