Chef's professor is planning to give his class a group assignment. There are
students in the class, with distinct roll numbers ranging from to . Chef's roll number is.
The professor decided to create
groups of students each. The groups were created as follows: the first group consists of roll numbers and , the second group of roll numbers and , and so on, with the final group consisting of roll numbers and.
Chef wonders who his partner will be. Can you help Chef by telling him the roll number of his partner?
Input Format
- The first line of input will contain an integer
- , denoting the number of groups that will be formed, and Chef's roll number.
Output Format
For each test case, output the roll number of the student that will be Chef's partner.
Constraints
Sample Input 1
3
2 2
3 1
3 4
Sample Output 1
3
6
3
Explanation
Test case
: The groups will be . Chef's roll number is , so his partner's roll number will be.
Test case
: The groups will be . Chef's roll number is , so his partner's roll number will be.
Test case
: The groups will be . Chef's roll number is , so his partner's roll number will be .
No comments:
Post a Comment