Seán is debugging his own code. He first creates an array seq of N integers and fills it with zeros. He then calls the following C++ function several times.
void something( int jump ) {
int i = 0;
while( i < N ) {
seq[i] = seq[i] + 1;
i = i + jump;
}
}
The function adds 1 to every element whose index is a multiple of jump. Index 0 is a multiple of every jump, so seq[0] grows by 1 on every call.
Seán calls the function exactly K times and passes X1,X2,…,XK in that order.
Once the calls are done, Seán picks Q parts of the array he wants to check. Each part is given by its left bound L and its right bound R (L≤R). For each part, compute seq[L] + seq[L+1] + ... + seq[R].