N = int(input()) for _ in range(N): a,b = map(int,input().split()) ans = b+a*b print(ans)