Peter and the Textbook

Simulate a textbook where tearing out page i also removes page n-i+1, and answer which page sits at position p among the pages still present.

Easy3SimulationImplementationArrayInterviewNo attempts yetTime limit2sMemory limit256 MB

Problem

Peter was cleaning his room today and found his old English literature textbook. He does not like the subject, so he decided to take the book apart and started tearing out the pages one at a time.

The textbook has nn pages, numbered from 1 to nn. Because of the way the book is bound, page ii is printed on the same sheet as page ni+1n - i + 1. When Peter tears out one page, the other page on the same sheet comes away with it. Between tears Peter sometimes wants to know this: if the pages still left in the book are listed in increasing order of page number, what is the number of the pp-th one? Answer his questions.

Input

The input contains several test cases. The first line contains the number of test cases tt (1t10001 \le t \le 1000).

Each of the tt test cases is given in the following format. The first line of a test case contains two integers nn and qq (2n1002 \le n \le 100, nn is even, 1q1001 \le q \le 100), the number of pages in the textbook and the number of queries. Each of the next qq lines contains one query.

  • - i: Peter tears out page ii, and the page on the same sheet comes away with it.
  • ? p: Peter asks for the number of the pp-th page among those still remaining.

For a tear query the page is still in the textbook, and for a page number query the textbook still holds at least pp pages.

Output

For each ? query, print the number of the requested page on its own line.