Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.

The park is a rectangular table with n rows and m columns, where the cells of the table are squares, and the boundaries between the cells are streets. External borders are also streets. Every street has length 1. For example, park with n=m=2 has 12 streets.

You were assigned to develop a plan for lighting the park. You can put lanterns in the middle of the streets. The lamp lights two squares near it (or only one square if it stands on the border of the park).

<image> The park sizes are: n=4, m=5. The lighted squares are marked yellow. Please note that all streets have length 1. Lanterns are placed in the middle of the streets. In the picture not all the squares are lit.

Semyon wants to spend the least possible amount of money on lighting but also wants people throughout the park to keep a social distance. So he asks you to find the minimum number of lanterns that are required to light all the squares.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of test cases in the input. Then t test cases follow.

Each test case is a line containing two integers n, m (1 ≤ n, m ≤ 10^4) — park sizes.

Output

Print t answers to the test cases. Each answer must be a single integer — the minimum number of lanterns that are required to light all the squares.

Example

Input


5
1 1
1 3
2 2
3 3
5 3


Output


1
2
2
5
8

Note

Possible optimal arrangement of the lanterns for the 2-nd test case of input data example: <image>

Possible optimal arrangement of the lanterns for the 3-rd test case of input data example: <image>
#qn given an arr of size n for every  i position find a min j such that j>i and arr[j]>arr[i]
#it prints the position of the nearest .
import sys
input = sys.stdin.readline
 #qn given an arr of size n for every  i position find a min j such that j>i and arr[j]>arr[i]
#it prints the position of the nearest .
# import sys
import heapq 
import copy
import math
#heapq.heapify(li) 
#
#heapq.heappush(li,4) 
#
#heapq.heappop(li)
#
# &	Bitwise AND Operator	10 & 7 = 2
# |	Bitwise OR Operator	10 | 7 = 15
# ^	Bitwise XOR Operator	10 ^ 7 = 13

# <<	Bitwise Left Shift operator	10<<2 = 40
# >>	Bitwise Right Shift Operator
'''############ ---- Input Functions ---- #######Start#####'''
def inp():
	return(int(input()))
def inlt(): 
	return(list(map(int,input().split())))
def insr():
	s = input()
	return(list(s[:len(s) - 1]))
def invr():
	return(map(int,input().split()))
 ############ ---- Input Functions ---- #######End
 # #####   

class Node:
    def _init_(self,val):
        self.data = val
        self.left = None
        self.right = None
##to initialize wire : object_name= node(val)##to create a new node
## can also be used to create linked list
class fen_tree:
    """Implementation of a Binary Indexed Tree (Fennwick Tree)"""
    
    #def __init__(self, list):
    #    """Initialize BIT with list in O(n*log(n))"""
    #    self.array = [0] * (len(list) + 1)
    #    for idx, val in enumerate(list):
    #        self.update(idx, val)

    def __init__(self, list):
        """"Initialize BIT with list in O(n)"""
        self.array = [0] + list
        for idx in range(1, len(self.array)):
            idx2 = idx + (idx & -idx)
            if idx2 < len(self.array):
                self.array[idx2] += self.array[idx]

    def prefix_query(self, idx):
        """Computes prefix sum of up to including the idx-th element"""
        # idx += 1
        result = 0
        while idx:
            result += self.array[idx]
            idx -= idx & -idx
        return result
    def prints(self):
        print(self.array)
        return
        # for i in self.array:
        #     print(i,end = " ")
        # return 
    def range_query(self, from_idx, to_idx):
        """Computes the range sum between two indices (both inclusive)"""
        return self.prefix_query(to_idx) - self.prefix_query(from_idx - 1)

    def update(self, idx, add):
        """Add a value to the idx-th element"""
        # idx += 1
        while idx < len(self.array):
            self.array[idx] += add
            idx += idx & -idx


def pre_sum(arr):
	#"""returns the prefix sum inclusive ie ith position in ans  represent sum from 0 to ith position"""
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def pre_back(arr):
	#"""returns the prefix sum inclusive ie ith position in ans  represent sum from 0 to ith position"""
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p
def bin_search(arr,l,r,val):#strickly greater
	if arr[r] <= val:
		return r+1	
	if r-l < 2:
		if arr[l]>val:
			return l
		else:
			return r
	mid = int((l+r)/2)
	if arr[mid] <= val:
		return bin_search(arr,mid,r,val)
	else:
		return bin_search(arr,l,mid,val)
def search_leftmost(arr,val):
	def helper(arr,l,r,val):
		# print(arr)
		print(l,r)
		if arr[l] == val:
			return l
		if r -l <=1:
			if arr[r] == val:
				return r
			else:
				print("not found")
				return
		mid = int((r+l)/2)
		if arr[mid] >= val:
			return helper(arr,l,mid,val)
		else:
			return helper(arr,mid,r,val)
	return helper(arr,0,len(arr)-1,val)
def search_rightmost(arr,val):
	def helper(arr,l,r,val):
		# print(arr)
		print(l,r)
		if arr[r] == val:
			return r
		if r -l <=1:
			if arr[l] == val:
				return r
			else:
				print("not found")
				return
		mid = int((r+l)/2)
		if arr[mid] > val:
			return helper(arr,l,mid,val)
		else:
			return helper(arr,mid,r,val)
	return helper(arr,0,len(arr)-1,val)
def preorder_postorder(root,paths,parent,left,level):
	# if len(paths[node]) ==1 and node !=1 :
	# 	return [parent,left,level]
	l = 0
	queue = [root]
	while(queue!=[]):
		node = queue[-1]
		# print(queue,node)
		flag = 0
		for i in paths[node]:
			if i!=parent[node] and level[i]== sys.maxsize:
				parent[i] = node
				level[i] = level[node]+1
				flag = 1
				queue.append(i)
		if flag == 0:
			left[parent[node]] +=(1+left[node])
			queue.pop()
	# 		[parent,left,level] = helper(i,paths,parent,left,level)
	# 		l = left[i] + l +1
	# left[node] = l
	return [parent,left,level]

def pr_list(a):
	print(*a, sep=" ")
def main():
	tests =  inp()
	# tests = 1
	mod = 1000000007

	limit = 10**18
	for test in range(tests):
		[n,m] = inlt()
		if n%2 == 1 and m%2 ==1:
			ans = math.ceil(m*n/2)
		else:
			ans = (n*m)//2
		print(ans)
		
		




if __name__== "__main__":
  main()