This is a simple data structure problem.
In this problem, you need to maintain a sequence of numbers. Each position of the sequence has two parameters $a$ and $b$.
Now there are $m$ operations, and these operations can be divided into four types.
Type 1: Given interval $(l, r)$ and $x$, and mark 0/1 represents $a$ parameter or $b$ parameter, for each position in the interval, add $x$ to the $a$ parameter or $b$ parameter at this position.
Type 2: Given interval $(l, r)$, for each position in the interval, the $a$ parameter of this position becomes $3a+2b$, and the $b$ parameter becomes $3a-2b$.For example, originally $a=1$, $b=2$, after the operation becomes $a=7$, $b=-1$.
Type 3: Given interval $(l, r)$, for each position in the interval, exchange the two parameters $a$, $b$ corresponding to this position.
Type 4: Given interval $(l,r)$, query$\sum_{i=l}^ra_i*b_i$
This question is very simple, can you finish it?