The inner product of two integer sequences (or vectors) of the same length is defined as follows:
<A, B> =A[1]*B[1] + A[2]*B[2] + ... + A[n]*B[n]
You are going to calculate the inner product of two variable integer sequences. At the beginning, all elements of both sequences are zeros. Then several operations are applied to the sequences in turn. There are three types of operations:
SET X i j k
This operation sets X[i], X[i+1] ... X[j] to k. 1<= i, j <= n, 0 <= k <=1000000000.
ADD X i j k
This operation adds k to each of X[i], X[i+1] ... X[j]. 1<= i, j <= n, 0 <= k <=1000000000.
SWAP i j
This operations waps A[t] and B[t], t = i, i+1 ... J. 1<= i, j <= n.
Please calculate the inner product of A and B after every operation.
5 5 ADD A 1 2 3 SET B 2 3 4 SWAP 3 5 ADD B 3 4 5 SET A 4 5 1
0 12 12 32 37