import sys
tests = int(sys.stdin.neadline().split()[0])
for test in range(tests):
    numbers = int [(i) for i in sys.stdin.readline().split()]
    n, m = numbers[0],numbers[1]
    if(n % 2 == 0) or (n%2 == 0):
       print (n*m //2)
    else:
        print ((n*m+1)//2)
