T = int(input())


for case in range(T):
    #ストレス増加と何日まで働くか
    A,B = map(int,input().split())
    #ストレス量
    stress = A*B
    #ストレス0にするにはstress日必要
    print(stress+B)