def main(): for _ in range(int(input())): A, B = map(int, input().split()) print(B + A*B) if __name__ == "__main__": main()