Chandler has a list of non zero positive integers with him. He made a very interesting observation about the list. He noticed that the number of unique integers in an array of size $N$ is in the range $L$ to $R$ (both inclusive) and every element was either 1 or an even number x, in which case x/2 was also definitely present in the array. 
Chandler has misplaced the list of integers but he wants to impress Monica with his problem solving skills by finding out the minimum and maximum possible sum of all elements of the list of integers.
Can you also help him solve the problem so that he can win over Monica?

-----Input:-----
- First line will contain $T$, the number of testcases. 
- The first line of each test case contains integers $N$, $L$, and $R$. 

-----Output:-----
For each test case print 2 space-separated integers, the minimum and the maximum possible sum of N elements based on the above facts.

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq N \leq 1000$
- $1 \leq L \leq R \leq min(N,20)$

-----Sample Input:-----
2

4 2 2

5 1 5

-----Sample Output:-----
5 7

5 31

-----EXPLANATION:-----
- 
Example 1: For an array of size 4, with minimum 2 unique integers and maximum 2 unique integers, the possible arrays are (1,1,1,2), (1,1,2,2), (1,2,2,2)
Out of these, the minimum possible sum of elements is 5(1+1+1+2) and maximum possible sum is 7(1+2+2+2)
- 
Example 2: For an array of size 5, with minimum 1 unique integer and maximum 5 unique integers, minimum possible sum of elements is 5(1+1+1+1+1) and maximum possible sum is 31(1+2+4+8+16)

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
for _ in range(int(input())):
 n,l,h=list(map(int,input().split()))
 print(n-l+1+2**(l)-2,1+2**(h)-2+2**(h-1)*(n-h))


# cook your dish here
for i in range(int(input())):
 n, l, r = list(map(int, input().split()))
 mins = 0
 maxs = 0
 start = 1
 end = 2 ** (min(r,n) - 1)
 cend = end
 reached = True
 add=True
 for j in range(n):
  mins +=start
  if j + 1 == l:
   reached = False
   start = 1
  elif reached:
   start *= 2

 reached = True
 for j in range(n):
  maxs += end
  if j + 1 == r:
   reached = False
   end = cend
  elif reached:
   end = end // 2
 print(mins, maxs)



for _ in range(int(input())):
 n,l,r=list(map(int,input().split()))
 s=0
 mi=0
 ma=0
 for i in range(l):
  mi+=pow(2,i)
 mi+=n-l
 for i in range(r):
  ma+=pow(2,i)
 ma+=(n-r)*(pow(2,r-1))
 print(mi,ma)



for _ in range(int(input())):
 n,l,r=list(map(int,input().split()))
 s=0
 mi=0
 ma=0
 for i in range(l):
  mi+=pow(2,i)
 mi+=n-l
 for i in range(r):
  ma+=pow(2,i)
 ma+=(n-r)*(pow(2,r-1))
 print(mi,ma)



for _ in range(int(input())):
 n,l,r = map(int,input().split())
 mi = n-l+1
 p = 1
 for x in range(n-mi):
  mi = mi + (2**p)
  p+=1
 
 p1 = 0
 t = 0
 for y in range(r-1):
  p1+=1
  t = t + (2**p1)
 t = t + ((n-r)*(2**p1))
 
 print(mi,t+1)

t=int(input())
for q in range(t):
 n,l,r=map(int,input().split())
 s=[]
 t1=0
 for i in range(n):
  s.append(1<<i) 
 for i in range(l):
  t1=t1+s[i]
  
 for i in range(n-1,r-1,-1):
  s.pop()
 print(t1+min(s)*(n-l),end=' ')
 maxres=sum(s)

 for i in range(n-len(s)):
  maxres+=max(s)
 print(maxres)
 

t=int(input())
for _ in range(t):
 n,l,r=list(map(int,input().split()))
 lr=[1]
 ll=[1]
 for i in range(1,r):
  lr.append(2**i)
 for i in range(1,l):
  ll.append(2**i)
 if(len(lr)!=n):
  for i in range(n-r):
   lr.append(lr[-1])
 if(len(ll)!=n):
  for i in range(n-l):
   ll.append(ll[0])
 print(sum(ll),sum(lr))


for _ in range(int(input())):
 n,l,r=[int(x) for x in input().split()]
 s1,s2=[1]*n,[]
 l-=1
 # r-=1
 x=2
 for _ in range(l):
  s1[_]=x
  x=x*2
 x1=sum(s1)
 s=1
 for _ in range(r):
  s2.append(s)
  s=s*2
 s=s//2
 for _ in range(r,n):
  s2.append(s)
 x2=sum(s2)
 print(x1,x2)
 


t=int(input())
for jkl in range(t):
 n, l, r = list(map(int,input().split(" ")))
 min_su = 0
 stoped = 0
 for i in range(0, l):
  min_su = min_su + (2 ** i)
  stoped = i
 max_su = min_su
 for i in range(l, r):
  max_su = max_su + (2 ** i)
  stoped = i
 for i in range(n - l):
  min_su = min_su + 1
 for i in range(n - r):
  max_su = max_su + (2 ** stoped)
 print(min_su, max_su)


# cook your dish here
from sys import stdin, stdout
input = stdin.readline
print2 = stdout.write
def get_ints(): return map(int, stdin.readline().split())
def get_list(): return list(map(int, stdin.readline().split()))
for _ in range(int(input())):
 n, l, r = get_ints()
 numsR = [2**i for i in range(r)]
 if l != r:
  numsL = [2**i for i in range(l)]
 else: numsL = numsR
 ma = sum(numsR) + (n - r) * numsR[-1]
 mi = sum(numsL) + n - l
 print(mi, ma)

for u in range(int(input())):
 n,x,y=list(map(int,input().split()))
 a,b=0,0
 a=(n-x)
 for i in range(x):
  a+=2**i
 for i in range(y):
  b+=2**i
 b+=((n-y)*(2**(y-1)))
 print(a,b)


for _ in range(int(input())):
 def n_th_term(r):
  return 2**(r-1)
 p=list(map(int,input().split()))
 n=p[0]
 l=p[1]
 r=p[2]
 maximum=2**(r)-1+(n-r)*n_th_term(r)
 minimum=2**(l)-1+(n-l)
 print(f"{minimum} {maximum}")
 


l=[1]
for i in range(1,21):
 x=2**i
 l.append(x)
#print(l,len(l))
for _ in range(int(input())):
 n,a,r=list(map(int,input().split()))
 tmi=n
 tma=n
 miv=0
 mav=0
 while(tmi!=0):
  if(a==1):
   miv=l[0]*n
   tmi=0
  else:
   #print(l[:a])
   miv=sum(l[:a])
   tmi=tmi-a
   miv=miv+tmi*l[0]
   tmi=0
 x=l[:r]
 ll=len(x)
 while(tma!=0):
  if(r==1):
   mav=l[0]*n
   tma=0
  else:
   mav=mav+sum(l[:r])
   #print(mav)
   tma=tma-r
   mav=mav+tma*(x[ll-1])
   tma=0
 print(min(mav,miv),max(miv,mav))


# cook your dish here
t=int(input())
powers=[1]
for _ in range(20):
 powers.append(powers[-1]*2)
for _ in range(t):
 n, l, r = map(int, input().split())
 print(sum(powers[:l])+(n-l), sum(powers[:r])+(n-r)*powers[r-1])

for _ in range(int(input())):
 n,l,r=map(int,input().split())
 print(n-l+pow(2,l)-1,pow(2,r)-1+(n-r)*pow(2,r-1))

# cook your dish here
for _ in range(int(input())):
 mini,maxi=0,0
 n,l,r=map(int,input().split())
 o=n-l+1
 t=n-r+1
 for i in range(1,n-o+1):
  mini=mini+2**i
 maxi=maxi+t*(2**(r-1))
 for j in range(r-2,r-2-(n-t),-1):
  maxi=maxi+2**j
 print(mini+o,maxi)

for t in range(int(input())):
 n,l,r = map(int, input().split())
 max1 = [2**i for i in range(r)]
 if r < n:
  ls = [max1[-1]]*(n-r)
  max1.extend(ls)
 max1 = sum(max1)
 min1 = [2**i for i in range(l)]
 if l < n:
  ls = [1]*(n-l)
  min1.extend(ls)
 min1 = sum(min1)
 print(min1, max1)

for _ in range(int(input())):
 n, l, r = map(int, input().split(" "))
 ans_min = ((2 ** l) - 1) + (n - l)
 ans_max = ((2 ** r) - 1) + (n - r) * (2 ** (r - 1))
 print(ans_min, ans_max)

def solve(n,l,r):
 ans = [0,0]
 a, b = [], []
 """if n==r and l==1:
     ans[-1] = 2**n-1
     ans[0] = n
    else:"""
 x, c, z = 1, r, l
 while c>0:
  a.append(x)
  x = x*2
  c -= 1
 x = 1
 while z>0:
  b.append(x)
  z -= 1
  x *= 2
 ans[0] = sum(b)+min(b)*(n-l)
 ans[-1] = sum(a)+max(a)*(n-r)
 return ans
def __starting_point():
 t = int(input())
 while t>0:
  t -= 1
  n, l, r = list(map(int,input().split()))
  a = solve(n,l,r)
  print(*a,sep=" ")

__starting_point()

def get_sum(k):
 if k == 1:
  return 1
 
 return 2**(k-1) + get_sum(k-1)


t = int(input())

for _ in range(t):

 n, l, r = map(int, input().split())

 minimum = (n - l) + get_sum(l)
 maximum = get_sum(r) + (n - r) * int(2**(r - 1))

 print('{} {}'.format(minimum, maximum))

minm = 0
maxm = 0
minmlist = []
maxmlist = []
t = int(input())
for _ in range(t):
 n,l,r = map(int,input().split())
 for i in range(l):
  a = 2**(i)
  minm+=a
 minm+=n-l
 for j in range(r):
  b = 2**(j)
  maxm+=b
 maxm+=(n-r)*(2**(r-1))
 minmlist.append(minm)
 maxmlist.append(maxm)
 #print(minm,maxm)
 minm=0
 maxm=0
for k in range(t):
 print(minmlist[k],maxmlist[k])

for _ in range(int(input())):
 n,l,r =list(map(int,input().split()))
 temp =[1]
 temp1=[1]
 t=1
 m= 1
 count =1
 for i in range(n-1):
  if count < l:
   m = m*2
   temp.append(m)
  else :
   temp.append(1)
  if count < r:
   t = t*2
   temp1.append(t)
  else:
   temp1.append(max(temp1))
  count=count+1
 print(sum(temp),sum(temp1))
 #print(temp , temp1)
  


# cook your dish here
num=[]
for i in range(20):
  num.append(2**i)
for _ in range(int(input())):
  n,l,r=list(map(int,input().split()))
  minset=num[:l]
  maxset=num[:r]
  ans1=0
  ans2=0
  ml=len(minset)
  mal=len(maxset)
  ans1=sum(minset)+(n-ml)*minset[0]
  ans2=sum(maxset)+(n-mal)*maxset[-1]
  
  print(ans1,ans2)