.Now he wants to ask q questions where the i-th question is to compute the sum of ali , ali+1, . . . , ari . Unfortunately,
the only tool which Bobo can utilize is an old broken 4-bit counter. While trying to answer the i-th
question, Bobo will set the counter to 0, and add numbers to the counter in the order of ali , ali+1, . . . , ari .
As the counter is broken, adding the number a to a counter holding value x yields [(x⊕wi) + a] mod 16.
Note that “⊕” stands for bitwise exclusive or (XOR).
Bobo would like to know the final result.
Special Note: The time limit is tight so that some optimization might be necessary. Try to solve the problem
as late as possible.