You are given a pair of non-negative integers $W, S$.
Puffin Pataro is playing a card game by himself. There are two types of cards: card w and card s.
Initially, Pataro has $W$ cards of type w and $S$ cards of type s, and his score is $0$. He repeatedly consumes one card from the cards he has until all cards are consumed. When the $i$-th consumed card is a card s, the following effect occurs:
- Among the $(i - 1)$-th, $(i - 2)$-th, and $(i - 3)$-th consumed cards, let $x$ be the number of cards that are card
w. He gains a score of $27 \times \left(\frac{4}{3}\right)^x$.
For convenience, assume that cards consumed at positions $0$ or earlier are not card w.
Find the maximum possible total score that Pataro can obtain by consuming the cards in an appropriate order. It can be proven that the required answer is always an integer.
Solve the above problem for $T$ test cases.
Input
The input is given in the following format:
T case1 case2 : caseT
Each test case is given in the following format:
W S
- $1 \le T \le 10^4$
- $0 \le W, S \le 10^{16}$
- All input values are integers.
Output
Print $T$ lines. The $i$-th line should contain the answer for the $i$-th test case.
Example
Input 1
3 5 3 12 9 2026 328
Output 1
160 484 20992
Note
In the first example, it is optimal for Pataro to consume the cards in the order w, w, s, s, w, w, w, s.
- The $3$-rd consumed card is a card
s. Among the $2$-nd, $1$-st, and $0$-th consumed cards, there are $2$ cards of typew, so he gains a score of $27 \times \left(\frac{4}{3}\right)^2 = 48$. - The $4$-th consumed card is a card
s. Among the $3$-rd, $2$-nd, and $1$-st consumed cards, there are $2$ cards of typew, so he gains a score of $27 \times \left(\frac{4}{3}\right)^2 = 48$. - The $8$-th consumed card is a card
s. Among the $7$-th, $6$-th, and $5$-th consumed cards, there are $3$ cards of typew, so he gains a score of $27 \times \left(\frac{4}{3}\right)^3 = 64$.
Therefore, the total score Pataro can obtain is $160$. No matter how the cards are consumed, it is not possible to obtain a score greater than $160$, so the answer is $160$.