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 N=2n−1 storehouses, together with N−1 bidirectional roads. The i-th road connects the (i+1)-th storehouse and the ⌈2i⌉-th storehouse.
These storehouses will be built on an uneven piece of land. For each i∈\[⌈2N⌉,N], the altitude of the i-th storehouse is known to be a_i. 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. ans=min_a_1,…,a_⌊2N⌋∈R∑_i=1N−1(a_i+1−a_⌈2i⌉)2
Due to the geological movement, the altitude of the last ⌈2N⌉ storehouses often changes. Lucky, it is free for Rikka to change the altitude of the first ⌊2N⌋ storehouses at any time.
Your task is to help Rikka to find out the optimal plan after each change.
The first line contains two integers n,m (2≤n≤18,0≤m≤2×105).
The second line contains ⌈2N⌉ integers h_i (1≤h_i≤108), representing a_⌈2N⌉,…,a_N in order, where N=2n−1.
Then m lines follow, each line with two integers x_i,w_i (⌈2N⌉≤x_i≤n,1≤w_i≤108), representing the altitude of the x_i-th storehouse is changed to w_i during the i-th movement.
Output m+1 lines, each with a single number: the initial value of ans followed by the value of ans after each movement.
Writing a special judge is a tiring task. Therefore, you are required to output the answer module 998244353. Formally, if the simplest fraction representation of ans is yx, you need to output x×y998244351 mod 998244353.
For the first sample, one optimal solution is a_1=2 and the value of ans is (2−1)2+(2−3)2=2.