for t in range(int(input())): A,B=map(int,input().split()) print(B*(A+1))