from sys import stdin TT = int(stdin.readline()) for loop in range(TT): A,B = map(int,stdin.readline().split()) print (B + A * B)