N friends are playing a game. The game is played on a row of L squares, numbered from 0 to L−1, where squares i and i+1 are adjacent to each other. At most one friend stand on each square at any given time. In each step of the game, one friend jumps from its current square to a new (non-occupied) square.
In any moment of the game, the score of a friend is the length of the longest contiguous segment of friends it is part of. This means that if a friend stands on some position x, and there are friends on positions a,a+1,...,x−1,x,x+1,...,b−1,b, the score of the friend is b−a+1.
The total score of the game is the sum of scores for all friends. At various times during the game, the friends wonder what their current total score is.
The sample judge reads input in the following format:
N L QP[0] P[1] .. P[N - 1]0 A B, a jump from A to B is to be made, and if the line is 1 a scoring question is to be made.For each scoring question, the judge writes a line with the return value of score().