def solve(): a, b = map(int, input().split()) print(b * (a + 1)) for _ in range(int(input())): solve()