solusi anak anjing dan sum codechef

t=int(input())
for i in range(t):
  d,n=map(int,input().split())
  for i in range(d):
    b=n*(n+1)/2
    n=b
   print(int(b))
Homeless Hawk