We useto represent the answer of the last
operation and initialize
.
The first line contains two integers(
) and
(
), which represent the number of bases and the number of instructions that the commander-in-chief will give you.
Nextlines, each line contains one instruction. There are four types of instructions:
- `1 x y` Our side added a wormhole connectingand
.
- `2 x y` The enemy destroyed a wormhole connectingand
. It is guaranteed that this wormhole existed before this operation.
- `3 x c` Baseincreased
(
) troops.
- `4 x` Find the sum of troops that can be reached from basethrough at most one wormhole.
You need to transform the inputinto
to get the real data, where
means binary XOR.
For eachoperation, output a line representing the answer.