B. Family Tree 

“Important families are like potatoes.
The best parts are underground.”
Francis Bacon

Context

A family tree is a chart representing family relationships in a conventional tree structure. The more detailed family trees used in medicine, genealogy, and social work are known as genograms. Several genealogical numbering systems have been widely adopted for presenting family trees. Some of them are ascending numbering systems.

Ahnentafel, also known as the Eytzinger Method, Sosa Method, and Sosa-Stradonitz Method, allows for the numbering of ancestors beginning with a descendant. This system allows one to derive an ancestor's number without compiling the list, and allows one to derive an ancestor's relationship based on their numbers.

The number of a person's father is the double of his own number, and the number of a person's mother is the double of his own plus one. For instance, if the number of John Smith is 10, his father is 20, and his mother is 21.

The first 15 numbers, identifying individuals in 4 generations, are as follows:

(First Generation)
 1  Subject

(Second Generation)
 2  Father
 3  Mother

(Third Generation)
 4  Father's father
 5  Father's mother
 6  Mother's father
 7  Mother's mother

(Fourth Generation)
 8  Father's father's father
 9  Father's father's mother
10  Father's mother's father
11  Father's mother's mother
12  Mother's father's father
13  Mother's father's mother
14  Mother's mother's father
15  Mother's mother's mother

It is possible (and usual) that two or more individuals are the same, and so are the ancestors.

Complete binary tree for four generations

The Problem

We have built our complete family tree, including until the N-th generation. But we have found out that two of our ancestors are brothers (they have the same parents).

We want to know the amount of different people of our family tree (including us).

The Input

The first line of the input contains an integer T indicating the number of test cases. For each test case, there is a line with three positive integer numbers N, A and B, separated by blanks, (4<=N<=20), where N is the number of generations, and A and B are brothers with the same parents.

The Output

For each test case, the output should consist of one integer indicating the amount of different people of our family tree (including us).

Sample Input

3
4 4 12
4 4 6
5 2 3

Sample Output

15
13
17

OMP'09
Facultad de Informatica
Universidad de Murcia (SPAIN)