# Finger Counting

Your little brother is counting numbers with his left hand. Starting with his thumb and going toward his pinky, he counts each finger in order. After counting his pinky, he reverses direction and goes back toward his thumb. He repeats this process until he reaches his target number. He never skips a finger. For example, to count to ten, he would count: thumb, index, middle, ring, pinky, ring, middle, index, thumb, index.

Sadly, one of his fingers hurts and he can only count on it a limited number of times. His fingers are numbered 1 through 5 from thumb to pinky. You are given an Integer

`weakFinger`

, the finger that hurts, and an Integer `maxCount`

, the maximum number of times he can use that finger.Print the largest number he can count to. If he cannot even begin counting, Print 0.
**Input**

First line contains T denoting Number of Test cases.

Each of the next T lines contains two integers denoting weakFinger and maxCount Respectively.

**Output**

For every test case print one Integer Denoting the maximum number which can be counted given the above constraints.

If he cannot even begin counting print 0.

**Constraints**

T=111

1<=weakFinger<=5

0<=maxCount<=100000

**Sample Input**

```
```

3

2 3

1 0

5 0

**Sample Input**

```
```

15

0

4

*Problem Setter : Arjun Singh Bhatia*

**Languages:**Brain,C,C++,Java,C#,JavaScript,Pascal,Perl,PHP,Python,Ruby,Text