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 \le t \le 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 \le n, m \le 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]

Difficulty: EASY

Solutions:
import math
el = int(input())
for k in range(el):
	ar = []
	for i in input().split(' '):
		ar.append(int(i))
	print(int(math.ceil(ar[0] * ar[1] / 2)))


import sys
import math
input = sys.stdin.readline
t = int(input())
for q in range(t):
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(math.ceil(n * m / 2))


def solve():
	(n, m) = map(int, input().split())
	d = n * m
	if d & 1:
		print(d + 1 >> 1)
	else:
		print(d >> 1)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	squares = n * m
	if squares == 1:
		print(1)
	elif squares == 0:
		print(0)
	else:
		rem = squares % 2
		sets = squares // 2
		lamps = rem + sets
		print(lamps)


from math import ceil
from functools import reduce
list(map(lambda _: print(ceil(reduce(lambda x, y: x * y / 2, map(int, input().split())))), range(int(input()))))


n = int(input())
for _ in range(n):
	(r, c) = map(int, input().split())
	if r * c % 2 == 0:
		print(r * c // 2)
	else:
		print((r * c + 1) // 2)


from math import ceil
for i in range(int(input())):
	(n, m) = map(int, input().split())
	if m > n:
		(m, n) = (n, m)
	print(ceil(n * m / 2))


arr = []
for i in range(int(input())):
	(n, m) = map(int, input().split())
	lamp = n * m // 2 + n * m % 2
	arr.append(lamp)
print(*arr, sep='\n')


t = int(input())
while t:
	t -= 1
	(n, m) = list(map(int, input().split()))
	ans = (n * m + 1) // 2
	print(ans)


import sys

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q)):
		n = q[i][0]
		m = q[i][1]
		if n * m % 2 == 0:
			print(int(n * m / 2))
		else:
			print(int((n * m - 1) / 2 + 1))
main()


import math
t = int(input())
k = []
for i in range(t):
	(n, m) = list(map(int, input().split()))
	k.append(math.ceil(n * m / 2))
print(*k, sep='\n')


def Count(row, col):
	if col % 2 == 0:
		return (col + 1) // 2 * row
	else:
		return col // 2 * row + (row + 1) // 2
n = int(input())
for _ in range(n):
	(row, col) = map(int, input().split())
	print(Count(row, col))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ans = n * m
	if ans % 2 == 0:
		print(int(ans / 2))
	else:
		print(int((ans + 1) / 2))


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if m == 1 == n:
		print(1)
	elif n % 2 != 0 and m % 2 != 0:
		l = [m, n]
		l.sort()
		a = l[1]
		b = l[0]
		rem = a * b - (a - 1) * b
		print((a - 1) * b // 2 + rem // 2 + 1)
	else:
		print(n * m // 2)


t = int(input())
while t != 0:
	t -= 1
	(n, m) = map(int, input().split())
	(n, m) = (min(n, m), max(n, m))
	if n == 1 and m == 1:
		print(1)
	elif n == 1:
		print((m + 1) // 2)
	else:
		ans1 = n // 2 * m + n % 2 * ((m + 1) // 2)
		ans2 = m // 2 * n + m % 2 * ((n + 1) // 2)
		print(min(ans1, ans2))


t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split(' ')))
	if n % 2 == 0 and m % 2 == 0:
		print(n // 2 * m)
	elif n % 2 == 0 and m % 2 != 0:
		print(n // 2 * m)
	elif n % 2 != 0 and m % 2 == 0:
		print(m // 2 * n)
	else:
		print(min((m - 1) // 2 * n + (n // 2 + 1), (n - 1) // 2 * m + (m // 2 + 1)))


import math

def sol(n, m):
	if n % 2 == 0:
		return n // 2 * m
	else:
		t1 = n // 2 * m
		t2 = math.ceil(m / 2)
		return t1 + t2
t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	v = sol(l[0], l[1])
	print(v)


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		print(int(n * m / 2))
	else:
		y1 = n * (m - 1) / 2 + int((n + 1) / 2)
		y2 = m * (n - 1) / 2 + int((m + 1) / 2)
		print(int(min(y1, y2)))


import sys
import math
t = int(sys.stdin.readline().strip())
for i in range(t):
	(n, m) = list(map(int, sys.stdin.readline().strip().split(' ')))
	r = n * (m // 2)
	if m % 2 == 1:
		if n % 2 == 0:
			r += n // 2
		else:
			r += n // 2 + 1
	print(r)


tests = int(input())
for i in range(tests):
	numbers = input().split()
	n = int(numbers[0])
	m = int(numbers[1])
	park = n * m
	if park % 2 == 0:
		print(park // 2)
	else:
		print((park + 1) // 2)


import math
a = int(input())
for i in range(0, a):
	(row, column) = map(int, input().split())
	print(math.ceil(row * column / 2))


import os
import sys
from io import BytesIO, IOBase

def readvars():
	k = map(int, input().split())
	return k

def readlist():
	li = list(map(int, input().split()))
	return li

def anslist(li):
	ans = ' '.join([str(v) for v in li])
	return ans

def main():
	t = 1
	t = int(input())
	for xx in range(t):
		(n, m) = readvars()
		l = max(m, n)
		h = min(m, n)
		if l % 2 == 0 and h % 2 == 0:
			print(l // 2 * h)
		elif l % 2 == 1 and h % 2 == 0:
			print(h // 2 * l)
		elif l % 2 == 0 and h % 2 == 1:
			print(h * (l // 2))
		else:
			ans = min((h - 1) // 2 * l + l // 2 + 1, (l - 1) // 2 * h + h // 2 + 1)
			print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	k = n * m
	if k % 2 == 0:
		print(k // 2)
	else:
		print(k // 2 + 1)


n = int(input())
for i in range(n):
	(n, m) = map(int, input().split())
	res = (n * m + 1) // 2
	print(res)


import math as ty
for qty in range(int(input())):
	(m, n) = map(int, input().split())
	if m < 2:
		print(ty.ceil(n / 2))
	elif m % 2 == 0:
		print(n * (m // 2))
	else:
		print(n * (m // 2) + ty.ceil(n / 2))


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if m == 1 and n == 1:
		print(1)
	elif m == 1:
		print(int(math.ceil(n / 2)))
	elif n == 1:
		print(int(math.ceil(m / 2)))
	elif m % 2 == 0:
		print(m // 2 * n)
	else:
		print(m // 2 * n + int(math.ceil(n / 2)))


d = int(input())
fon = 0
for i in range(d):
	raz = input().split()
	r1 = int(raz[0])
	r2 = int(raz[1])
	if r1 % 2 == 0 and r2 % 2 == 0:
		fon = r1 * r2 // 2
	if r1 % 2 == 1 and r2 % 2 == 0:
		fon = r2 * r1 // 2
	if r1 % 2 == 0 and r2 % 2 == 1:
		fon = r1 * r2 // 2
	if r1 % 2 == 1 and r2 % 2 == 1:
		fon = r1 * r2 // 2 + 1
	print(fon)
	fon = 0


t = int(input())
for i in range(t):
	x = input()
	x1 = x.split()
	n = int(x1[0])
	m = int(x1[1])
	if m % 2 == 0 or n % 2 == 0:
		print(int(m * n / 2))
	else:
		print(int((n + m) / 2 + (n - 1) * (m - 1) / 2))


import math
for i in range(int(input())):
	(n, m) = list(map(int, input().split()))
	print(math.ceil(n * m / 2))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x * y / 2 == x * y // 2:
		print(x * y // 2)
	else:
		print(x * y // 2 + 1)


import math
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	s = n * m
	print(math.ceil(s / 2))


test_case = int(input())
for i in range(test_case):
	value = list(map(int, input().split(' ')))
	if value[0] * value[1] % 2 == 0:
		print(value[0] * value[1] // 2)
	else:
		print(value[0] * value[1] // 2 + 1)


import math
t = int(input())
i = 1
for i in range(t):
	(n, m) = map(int, input().split())
	x = n * m
	if x % 2 == 0:
		print(int(x / 2))
	else:
		print(math.floor(x / 2) + 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(int(a * b / 2) + a * b % 2)


t = int(input())

def light(m, n):
	if n % 2 == 0 or m % 2 == 0:
		return m * n // 2
	else:
		return m * n // 2 + 1
for i in range(t):
	a = list(map(int, input().split()))
	m = max(a)
	n = min(a)
	print(light(m, n))


s0 = int(input())
for _ in range(s0):
	[a, b] = list(map(int, input().split()))
	print((a * b + 1) // 2)


t = int(input())
count = 0
while count < t:
	count += 1
	l = list(map(int, input().split(' ')))
	n = l[0]
	m = l[1]
	if n % 2 == 0 or m % 2 == 0:
		print(int(m * n / 2))
	else:
		print(n * int(m / 2) + int(n / 2 + 1))


import sys
import math
math.ceil
cases = int(input())
for c in range(cases):
	(n, k) = map(int, input().split())
	print(math.ceil(n * k / 2))


def getMin(n, m):
	if n == m == 1:
		return 1
	if n % 2 == 0:
		ans = n // 2 * m
	elif m % 2 == 0:
		ans = m // 2 * n
	else:
		ans = float('inf')
		if n > 1:
			ans = min(ans, n // 2 * m + getMin(1, m))
		if m > 1:
			ans = min(ans, m // 2 * n + getMin(1, n))
	return ans
t = int(input())
for _ in range(t):
	(n, m) = [int(x) for x in input().split()]
	print(getMin(n, m))


import math
t = int(input())
while t:
	(a, b) = map(int, input().split())
	print(math.ceil(a * b / 2))
	t -= 1


class A:

	def solve(self):
		t = int(input())
		for c in range(t):
			[n, m] = [int(x) for x in input().split(' ')]
			total_lights = n // 2 * m
			if n % 2 == 1:
				total_lights += m // 2
				if m % 2 == 1:
					total_lights += 1
			print(total_lights)
A().solve()


def noLight(n, m):
	return (n * m + 1) // 2
t = int(input())
for t_itr in range(t):
	(n, m) = map(int, input().split())
	result = noLight(n, m)
	print(result)


T = int(input())
for t in range(T):
	(n, m) = map(int, input().split())
	if n * m / 2 > n * m // 2:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)


def main():
	(n, m) = map(int, input().split())
	s = n * m
	print(s // 2 + s % 2)
for _ in range(int(input())):
	main()


for _ in range(int(input())):
	(row, col) = map(int, input().split())
	if col % 2 == 0:
		print(row * (col // 2))
	else:
		ans = row * (col // 2)
		if row % 2 == 0:
			print(ans + row // 2)
		else:
			print(ans + row // 2 + 1)


from collections import defaultdict
import sys
import math
sys.setrecursionlimit(1000000)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')
p2S = lambda x: print(*x, sep=' ')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		(a, b) = MI()
		print(math.ceil(a * b / 2))
main()


for __ in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	print((n * m + 1) // 2)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = a * b
	if k % 2 == 0:
		print(k // 2)
	else:
		print((k + 1) // 2)


from math import *
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	print(ceil(a * b / 2))


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	(n, m) = map(int, readline().split())
	Ans[qu] = -(-n * m // 2)
print('\n'.join(map(str, Ans)))


t = int(input())
for i in range(t):
	string = input()
	counter = 0
	(n1, m1) = ('', '')
	(n, m) = (0, 0)
	for p in string:
		if p != ' ' and counter == 0:
			n1 = n1 + p
		elif p == ' ':
			counter = 2
		else:
			m1 = m1 + p
	n = int(n1)
	m = int(m1)
	k = 0
	if n % 2 == 0 or m % 2 == 0:
		k = n * m / 2
		print(int(k))
	else:
		k = int(n * m / 2)
		print(k + 1)


for z in range(int(input())):
	(n, m) = map(int, input().split())
	sq = n * m
	ans = sq // 2 + sq % 2
	print(ans)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 0 or m % 2 == 0:
		if n % 2 == 0:
			print(n // 2 * m)
			continue
		else:
			print(m // 2 * n)
	elif n == 1:
		print((m + 1) // 2)
		continue
	elif m == 1:
		print((n + 1) // 2)
	else:
		ans = (m - 1) // 2 * n + (n + 1) // 2
		print(ans)


t = int(input())
a = []
while t > 0:
	a.append([int(i) for i in input().split(' ')])
	t -= 1
for pair in a:
	if pair[1] == 1 and pair[0] == 1:
		print(1)
		continue
	if pair[0] % 2 == 0:
		print(pair[0] // 2 * pair[1])
	elif pair[1] % 2 == 0:
		print((pair[0] - 1) // 2 * pair[1] + pair[1] // 2)
	else:
		print((pair[0] - 1) // 2 * pair[1] + (pair[1] - 1) // 2 + 1)


for t in range(int(input())):
	(x, y) = map(int, input().split())
	print((x * y + 1) // 2)


amount = int(input())
lst = []
results = []
while amount != 0:
	couples = [int(i) for i in input().split()]
	lst.append(couples)
	amount -= 1
for i in lst:
	k = i[0] * i[1]
	if k % 2 != 0:
		k = k / 2 + 0.5
	else:
		k = k / 2
	results.append(k)
for i in results:
	print(int(i))


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		x = m // 2
		print(int(n * x))
	else:
		x = m // 2
		print(x * n + int(math.ceil(n / 2)))


import math
t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	c = n // 2 * m + n % 2 * int(math.ceil(m / 2))
	c = min(c, m // 2 * n + m % 2 * int(math.ceil(n / 2)))
	print(c)


t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	s = n * m
	print(s // 2 + s % 2)


t = int(input())
for i in range(t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	raw_n = n - n % 2
	raw_m = m - m % 2
	count = raw_m * raw_n // 2
	left = n * (m % 2) + m * (n % 2)
	count += left // 2
	if left % 2 == 1:
		count += 1
	print(count)


def light(n, m):
	a = n * m
	res = a // 2 + a % 2
	return res
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(light(n, m))


import math
for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
	else:
		d = n // 2 * m
		m = math.ceil(m / 2)
		print(d + m)


import math
tc = int(input())
while tc > 0:
	tc = tc - 1
	(m, n) = [int(x) for x in input().split()]
	park_lightings = 2
	cnt = 1
	total = m * n
	if total % 2 == 0:
		print(total // 2)
	else:
		print((total + 1) // 2)


testy = int(input())
import math
results = []
for i in range(testy):
	wejscie = list(map(int, input().split()))
	results.append(math.ceil(wejscie[0] * wejscie[1] / 2))
for result in results:
	print(result)


from sys import stdout, stdin
(_input, _print) = (stdin.buffer.readline, stdout.write)
(_int, _range) = (int, range)

def solution():
	for _ in _range(_int(_input())):
		(r, c) = [_int(i) for i in _input().split()]
		ans = r * c // 2 if r * c % 2 == 0 else r * c // 2 + 1
		print(ans)
solution()


import math

def main():
	for q in range(int(input())):
		(N, M) = map(int, input().split())
		m = min(N, M)
		n = max(N, M)
		ans = n // 2 * m
		if n % 2 == 1:
			ans += m // 2 + m % 2
		print(ans)
main()


import sys
t = int(input())
for _ in range(t):
	(n, m) = list(map(int, sys.stdin.readline().split()))
	if n * m % 2 == 0:
		ans = n * m // 2
	else:
		ans = n * m // 2 + 1
	print(ans)


from math import ceil
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n < m:
		(n, m) = (m, n)
	ans = m * (n // 2) + n % 2 * ceil(m / 2)
	print(ans)


def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		if n < m:
			(n, m) = (m, n)
		ans = m // 2 * n
		if m % 2:
			ans += (n + 1) // 2
		print(ans)
	return
main()


import sys
input = lambda : sys.stdin.readline().strip()
import math as m
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(m.ceil(a * b / 2))


t = int(input())
while t > 0:
	l = list(map(int, input().split()))
	mul = l[0] * l[1]
	d = mul // 2
	r = mul % 2
	print(d + r)
	t -= 1


def solve():
	(rows, cols) = list(map(int, input().strip().split(' ')))
	perrow = cols // 2
	if cols % 2 == 1:
		count = perrow * rows
		count += rows // 2
		if rows % 2 == 1:
			count += 1
		print(count)
	else:
		count = perrow * rows
		print(count)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


from math import ceil
import sys
input = sys.stdin.readline
from collections import defaultdict as dd
t = int(input())
while t:
	(n, m) = map(int, input().split())
	lol = 0
	if m % 2:
		lol = 1
	mm = m // 2
	ans = mm * n
	if lol:
		ans += ceil(n / 2)
	print(ans)
	t -= 1


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	(d, r) = divmod(m, 2)
	print(d * n + r * sum(divmod(n, 2)))


from sys import stdin, stdout
T = int(stdin.readline())
for x in range(T):
	(n, m) = list(map(lambda x: int(x), stdin.readline().split()))
	stdout.write(str((n * m + 1) // 2) + '\n')


for T in range(int(input())):
	(a, b) = list(map(int, input().split()))
	r = b // 2
	q = b % 2
	res = r * a
	if q == 1:
		temp = a // 2 + a % 2
		print(res + temp)
	else:
		print(res)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print(-(-n * m // 2))


import math
import random
mod = 1000000007
r1 = lambda : int(input())
rm = lambda : map(int, input().split())
rls = lambda : list(rm())
test = int(input())
while test:
	test -= 1
	(n, m) = rm()
	n = n * m
	ans = n // 2
	if n % 2 == 1:
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	sq = n * m
	if sq % 2 == 1:
		sq = sq + 1
	print(sq // 2)


def call():
	(n, m) = map(int, input().split())
	print((n * m + 1) // 2)
t = int(input())
for _ in range(t):
	call()


import sys
input = sys.stdin.readline
for t in range(int(input())):
	(n, m) = map(int, input().split())
	r = m * n // 2 + int(bool(n * m % 2))
	print(r)


import math
t = int(input())
out = []
for i in range(t):
	(n, m) = input().split()
	out.append(math.ceil(int(n) * int(m) / 2))
for i in range(t):
	print(out[i])


range_ = int(input())
ploice_mans = ''
for i in range(0, range_):
	input_ = input()
	n = int(input_.split()[0])
	m = int(input_.split()[1])
	num = (n * m + 1) // 2
	ploice_mans += str(num) + '\n'
print(ploice_mans)


I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(a, b) = sorted(I())
	ans = a // 2 * b
	if a % 2:
		ans += b // 2 + b % 2
	print(ans)


t = int(input())
for loop in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 0 or m % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	k = a * b
	if k % 2:
		print(int(k / 2) + 1)
	else:
		print(int(k / 2))
	t = t - 1


N = int(input())
for n in range(N):
	(x, y) = map(int, input().split())
	if x % 2 == 0 or y % 2 == 0:
		print(x * y // 2)
	else:
		print(x * y // 2 + 1)


t = int(input())
ans = []
for i in range(t):
	(n, m) = map(int, input().split())
	ans.append((n * m - 1) // 2 + 1)
for i in ans:
	print(i)


t = int(input())
for i in range(0, t, 1):
	(a, b) = map(int, input().split())
	h = a * b
	import math
	num = math.ceil(h / 2)
	print(num)


t = int(input())
for _ in range(t):
	(r, c) = map(int, input().split())
	sum = r * c // 2 + r * c % 2
	print(sum)


from sys import stdin
for _ in range(int(stdin.readline())):
	(n, m) = map(int, stdin.readline().split())
	x = n // 2 * m
	if n % 2 != 0:
		x += m // 2 + (m % 2 != 0)
	print(x)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n > m:
		(n, m) = (m, n)
	if n % 2:
		ans = n // 2 * m + (m + 1) // 2
	elif m % 2:
		ans = m // 2 * n + (n + 1) // 2
	else:
		ans = n // 2 * m
	print(ans)


n = int(input())
for i in range(n):
	dimensions = [int(n) for n in input().split()]
	n = dimensions[0]
	m = dimensions[1]
	mul = n * m
	if mul % 2 == 0:
		print(mul // 2)
	else:
		print((mul >> 1) + 1)


n = int(input())
while n:
	a = list(map(int, input().split()))
	if a[0] * a[1] % 2 == 1:
		print(a[0] * a[1] // 2 + 1)
	else:
		print(a[0] * a[1] // 2)
	n = n - 1


testcases = int(input())
for i in range(testcases):
	l = list(map(int, input().strip().split(' ')))
	(n, m) = (l[0], l[1])
	if n * m % 2 == 0:
		print(int(n * m / 2))
	else:
		print(int((n * m + 1) / 2))


import math
t = int(input())
while t:
	inp1 = list(map(int, input().strip().split()))[:2]
	(m, n) = (inp1[0], inp1[1])
	if m == n == 1:
		print(1)
	elif m == 1:
		if n % 2:
			print(n // 2 + 1)
		else:
			print(n // 2)
	elif n == 1:
		if m % 2:
			print(m // 2 + 1)
		else:
			print(m // 2)
	elif m % 2:
		val = (m - 1) // 2 * n + math.ceil(n / 2)
		print(val)
	else:
		val = m // 2 * n
		print(val)
	t -= 1


t = int(input())
for test in range(t):
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	temp1 = min(n, m) // 2
	part1 = temp1 * max(n, m)
	temp2 = max(n, m) / 2
	if temp2 > int(temp2):
		temp2 = int(temp2) + 1
	temp2 = int(temp2)
	part2 = temp2 * (min(n, m) - temp1 * 2)
	print(part1 + part2)


t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	squares = n * m
	if squares % 2 == 0:
		squares = squares // 2
	else:
		squares = squares // 2 + 1
	print(squares)


t = int(input())
while t > 0:
	[x, y] = [int(x) for x in input().split()]
	if x == 1 and y == 1:
		print(1)
		t -= 1
		continue
	if x == 1 and y == 2:
		print(1)
		t -= 1
		continue
	if x == 2 and y == 1:
		print(1)
		t -= 1
		continue
	if x == 1 and y == 3:
		print(2)
		t -= 1
		continue
	if x == 3 and y == 1:
		print(2)
		t -= 1
		continue
	(i, j) = (x, y)
	two_by_two_x = two_by_two_y = 0
	if i % 2 == 0:
		two_by_two_x += i / 2
		i = 0
	else:
		two_by_two_x += (i - 1) / 2
		i = i - 2 * two_by_two_x
	if j % 2 == 0:
		two_by_two_y += j / 2
		j = 0
	else:
		two_by_two_y += (j - 1) / 2
		j -= 2
	ans = 0
	total = two_by_two_x * two_by_two_y
	ans = 2 * int(total)
	if i == 0 and j == 0:
		print(ans)
		t -= 1
		continue
	if i != 0:
		temp = 0
		temp = y // 2
		ans += temp + 1
	if j != 0:
		temp = 0
		temp = x // 2
		ans += temp + 1
	print(ans - 1)
	t -= 1


t = int(input())
for i in range(t):
	[n, k] = [int(j) for j in input().split()]
	print((n * k + 1) // 2)


import sys
input = sys.stdin.readline
t = int(input())
import math
for t1 in range(t):
	(n, m) = list(map(int, input().split(' ')))
	ans = 0
	if m % 2 == 0:
		ans += n * (m // 2)
	else:
		if m - 1 > 0:
			ans += n * ((m - 1) // 2)
		ans += math.ceil(n / 2)
	print(ans)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = n * m
	if a & 1:
		print(a // 2 + 1)
	else:
		print(a // 2)


import sys
import math
q = int(sys.stdin.readline())
for _ in range(q):
	(n, m) = map(int, sys.stdin.readline().split())
	res = n * (m // 2)
	if m % 2 != 0:
		if n % 2 == 0:
			res += n // 2
		else:
			res += n // 2 + 1
	print(res)


for i in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n & 1 == 0 and m & 1 == 0:
		print(n * m // 2)
	elif n & 1 == 0 and n & 1 != 0:
		print(n * m // 2)
	else:
		print((n * m + 1) // 2)


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(1, ntc + 1):
		(n, m) = (next(ints) for i in range(2))
		ans = (m * n + 1) // 2
		print(ans)
	return
main()


for i in range(int(input())):
	(n, m) = map(int, input().split())
	nn = n
	if n % 2 != 0:
		n = n - 1
	anss = n // 2
	anss = anss * m
	if nn % 2 != 0:
		if m % 2 == 0:
			anss = anss + m // 2
		else:
			anss = anss + (m + 1) // 2
	print(anss)


N = int(input())
for i in range(N):
	(a, b) = map(int, input().split())
	print((a * b + 1) // 2)


for u in range(int(input())):
	(n, m) = map(int, input().split())
	s = n * m
	if s % 2 == 0:
		print(s // 2)
	else:
		print(s // 2 + 1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	total_square = n * m
	lights = total_square // 2
	lights += total_square % 2
	print(lights)


n = int(input())
list1 = []
list2 = []
for i in range(n):
	a = input()
	arr = a.split(' ')
	list1.append(int(arr[0]))
	list2.append(int(arr[1]))
for i in range(n):
	if list1[i] == 1 and list2[i] == 1:
		print('1')
	elif list2[i] % 2 == 0 or list1[i] % 2 == 0:
		a = list1[i] * list2[i] // 2
		print(a)
	elif list1[i] % 2 != 0 and list2[i] % 2 != 0:
		a = (list1[i] * list2[i] + 1) // 2
		print(a)


import math
n = int(input())
while n > 0:
	(a, b) = map(int, input().split())
	res = math.ceil(a * b / 2)
	print(res)
	n = n - 1


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(math.ceil(a * b / 2))


test_cases = int(input())
for z in range(test_cases):
	(n, m) = list(map(int, input().split()))
	if n * m % 2 == 0:
		print(m * n // 2)
	else:
		print(int((m * n + 1) // 2))


from itertools import permutations
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	if n * x % 2 == 0:
		print(n * x // 2)
	else:
		print((n * x + 1) // 2)


import math
t = int(input())
for w in range(t):
	(n, m) = (int(i) for i in input().split())
	s = n // 2 * m
	if n % 2 == 1:
		if m % 2 == 0:
			s += m // 2
		else:
			s += m // 2 + 1
	print(s)


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	print(l * r // 2 + l * r % 2)


n = int(input())
s = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a * b % 2 == 0:
		s.append(a * b // 2)
	else:
		s.append(a * b // 2 + 1)
for i in range(len(s)):
	s[i] = str(s[i])
print('\n'.join(s))


for _ in range(int(input())):
	(y, b) = map(int, input().split())
	print(y * b // 2 + y * b % 2)


def solution():
	(n, m) = list(map(int, input().split()))
	print(n * m // 2 + n * m % 2)
T = int(input())
for t in range(T):
	solution()


t = int(input())
l = []
for i in range(t):
	p = input()
	p = p.split()
	n = int(p[0])
	m = int(p[1])
	sq = n * m
	num_of_light = int(sq / 2) + sq % 2
	l.append(num_of_light)
for i in range(t):
	print(l[i])


test = int(input())
for t in range(test):
	a = input().split()
	n = int(a[0])
	m = int(a[1])
	if n % 2 == 0:
		print(n * m // 2)
	elif m % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt

def solve():
	(n, m) = read()
	print(math.ceil(n * m / 2))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve()


t = int(input())
if 1 <= t <= 10 ** 4:
	for i in range(t):
		(n, m) = input().split()
		n = int(n)
		m = int(m)
		p = m * n / 2
		q = m * n // 2
		p = int(p)
		q = int(q)
		if m * n % 2 == 0:
			print(p)
		else:
			r = q + 1
			print(r)


import math
tc = int(input())
for x in range(tc):
	(m, n) = map(int, input().split())
	a = math.ceil(m * n / 2)
	print(a)


def main():
	n = int(input())
	given_park = []
	for i in range(0, n):
		(row, col) = input().split()
		row = int(row)
		col = int(col)
		area = row * col
		given_park.append(area)
	for i in range(0, n):
		if given_park[i] / 2 > given_park[i] // 2:
			print(given_park[i] // 2 + 1)
		else:
			print(given_park[i] // 2)
main()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	print(a * b // 2 + a * b % 2)


T = int(input())
for i in range(T):
	sm = [int(x) for x in input().split()]
	n = sm[0]
	m = sm[1]
	if m % 2 == 0:
		print(m // 2 * n)
	elif n % 2 == 0:
		print(m // 2 * n + n // 2)
	else:
		print(m // 2 * n + n // 2 + 1)


import math
t = int(input())
for _ in range(t):
	a = list(map(int, input().split()))
	n = a[0]
	m = a[1]
	ans = math.ceil(n * m / 2)
	print(ans)


t = int(input())
for test in range(t):
	(n, m) = map(int, input().split())
	ans = (n * m + 1) // 2
	print(ans)


ll = lambda : list(map(int, input().split()))
s = lambda : input()
v = lambda : map(int, input().split())
ii = lambda : int(input())
import math
for _ in range(int(input())):
	(n, m) = v()
	a = n * m
	print(math.ceil(a / 2))


import math
t = input()
for i in range(int(t)):
	nm = input().split(' ')
	n = int(nm[0])
	m = int(nm[1])
	print(math.ceil(n * m / 2))


import math
for i in range(int(input())):
	(k, j) = map(int, input().split())
	l = math.ceil(k * j / 2)
	print(l)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
		continue
	if m % 2 == 0:
		print(m // 2 * n)
		continue
	print(n * (m // 2) + (n // 2 + 1))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	(n, k) = map(int, input().split())
	from math import ceil
	print(max(1, ceil(n * k / 2)))


t = int(input())
while t:
	(n, m) = map(int, input().split())
	if n * m % 2 != 0:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)
	t -= 1


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		q = max(n, m)
		if q % 2 == 0:
			print(q // 2)
		else:
			print(q // 2 + 1)
	elif n % 2 == 0 or m % 2 == 0:
		if n % 2 == 0:
			print(m * (n // 2))
			pass
		elif m % 2 == 0:
			print(n * (m // 2))
			pass
	elif n % 2 == 1:
		print(n // 2 * m + m // 2 + 1)
		pass
	elif m % 2 == 1:
		print(m // 2 * n + n // 2 + 1)
		pass


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s = a * b
	if s % 2 == 0:
		print(s // 2)
	else:
		print(s // 2 + 1)


def light_num(m, n):
	if m % 2 == 0 or n % 2 == 0:
		return int(m * n / 2)
	else:
		return int((m * n + 1) / 2)
n = int(input())
for i in range(n):
	[m, n] = input().split(' ')
	m = int(m)
	n = int(n)
	print(light_num(m, n))


from collections import defaultdict as dfd
import math
import sys
import heapq

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def main():
	for _ in range(int(input())):
		(n, m) = MI()
		if m % 2 == 0:
			print(m // 2 * n)
		else:
			print(m // 2 * n + math.ceil(n / 2))
main()


from sys import stdin, stdout, maxsize
import math
t = int(stdin.readline().strip())
for _ in range(t):
	(n, m) = map(int, stdin.readline().strip().split())
	z = int(math.ceil(n * m / 2))
	stdout.write(str(z) + '\n')


def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		res = 0
		if n == 1 and m == 1:
			res = 1
		elif m % 2 == 0:
			res = n * (m // 2)
		elif m == 1:
			if n % 2 == 0:
				res = n // 2
			else:
				res = n // 2 + 1
		else:
			res = n * (m // 2)
			if n % 2 == 0:
				res += n // 2
			else:
				res += n // 2 + 1
		print(res)
main()


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(n, m) = map(int, input().split())
		print((n * m + 1) // 2)
	q = int(input())
	for _ in range(q):
		solve()
main()


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if m > n:
		temp = n
		n = m
		m = temp
	result = 0
	if m % 2 == 0:
		result = max(n, m) * int(m / 2)
	elif n % 2 == 0:
		result = m * int(n / 2)
	else:
		result = int(m / 2) * n + int(n / 2) + 1
	print(result)


for i in range(int(input())):
	(row, col) = map(int, input().split())
	print((row * col + 1) // 2)


test_case = int(input())
for _ in range(test_case):
	(n, m) = map(int, input().split())
	print((n * m + 1) // 2)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a * b % 2 == 0:
		print(a * b // 2)
	else:
		print((a * b + 1) // 2)


import math
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 0 and m % 2 == 0:
		print(n // 2 * m)
	elif n % 2 == 0:
		print(n // 2 * m)
	elif m % 2 == 0:
		print(m // 2 * n)
	else:
		print(math.ceil(min(m, n) / 2 * max(m, n)))


t = int(input())
for i in range(t):
	p = input().split()
	a = int(p[0])
	b = int(p[1])
	if a % 2 == 0 and b % 2 == 0:
		print(int(a * b / 2))
	elif a % 2 != 0 and b % 2 != 0:
		print(int((a - 1) * b / 2 + (b - 1) / 2 + 1))
	elif a % 2 == 0:
		print(int(a * (b - 1) / 2 + a / 2))
	else:
		print(int(b * (a - 1) / 2 + b / 2))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	if a >= b:
		if a % 2 == 0 and b % 2 == 0:
			ans = a // 2 * b
		elif a % 2 != 0 and b % 2 == 0:
			ans = a // 2 * b + b // 2
		elif a % 2 == 0 and b % 2 != 0:
			ans = a // 2 * b
		else:
			ans = a // 2 * b + b // 2 + 1
	print(ans)


import math
for _ in range(int(input())):
	(m, n) = map(int, input().split())
	print(math.ceil(m * n / 2))


inp = int(input())
result = []
while inp:
	(x, y) = input().split()
	if int(x) * int(y) % 2 == 0:
		res = int(x) * int(y)
		result.append(res // 2)
	else:
		res = int(x) * int(y)
		res += 1
		result.append(res // 2)
	inp -= 1
for i in result:
	print(i)


tests = int(input())
for _ in range(tests):
	(n, m) = map(int, input().split())
	ans = n * (m // 2)
	if m % 2 == 1:
		ans += (n + 1) // 2
	print(ans)


import math as m
num_iter = int(input())
for num in range(num_iter):
	(a, b) = map(int, input().split())
	p = m.ceil(a * b / 2)
	print(p)


import math

def compute(number_of_row: int, number_of_column: int) -> int:
	total_s = number_of_row * number_of_column
	return math.ceil(total_s / 2)
number_of_case = int(input())
result = []
for i in range(0, number_of_case):
	n_m = input().split()
	n = int(n_m[0])
	m = int(n_m[1])
	result.append(compute(n, m))
for i in result:
	print(i)


a = input('')
t = int(a)
while t > 0:
	n = input('').split()
	m = []
	m.append(int(n[0]))
	m.append(int(n[1]))
	ans = (m[0] * m[1] + 1) / 2
	print(int(ans))
	t -= 1


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	(n, m) = (min(m, n), max(n, m))
	print(n // 2 * m + (n % 2 * m + 1) // 2)


from sys import stdin
for t in range(int(input())):
	(n, m) = map(int, stdin.readline().split())
	print((n * m + 1) // 2)


import math
n1 = int(input())
for x in range(n1):
	n2 = input().split(' ')
	a = int(n2[0])
	b = int(n2[1])
	if a % 2 == 0:
		print(int(a / 2 * b))
	else:
		print(math.ceil(b / 2) + int(a / 2) * b)


import sys
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda : sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
	(n, k) = map(int, input().split())
	print((n * k + 1) // 2)


import math
n = int(input())
while n:
	n = n - 1
	(x, y) = list(map(int, input().split()))
	print(math.ceil(x * y / 2))


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	(n, m) = read_ints()
	print((n * m + 1) // 2)


from sys import stdin, stdout
t = int(stdin.readline())
for q in range(t):
	(n, m) = map(int, stdin.readline().split())
	x = n * m
	if n == m == 1:
		print(1)
	elif n == 3 and m == 1 or (n == 1 and m == 3):
		print(2)
	elif x & 1 == 1:
		x = x // 2 + 1
		print(x)
	else:
		print(x // 2)


import math
for i in range(int(input())):
	inp = [int(i) for i in input().split()]
	print(math.ceil(inp[0] * inp[1] / 2))


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	(n, m) = get_tuple()
	x = m // 2
	ans = n * x
	if m % 2 != 0:
		ans += (n + 1) // 2
	print(ans)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


t = int(input())
for case in range(t):
	(r, c) = list(map(int, input().split()))
	if r * c % 2 == 0:
		print(r * c // 2)
	else:
		print(r * c % 2 + r * c // 2)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(n, m) = (min(n, m), max(n, m))
	ans = n * (m // 2)
	if m % 2 == 1:
		ans += (n - 1) // 2 + 1
	print(ans)


t = int(input())
n = list()
m = list()
for i in range(t):
	inputs = input()
	(ni, mi) = list(map(int, inputs.split(' ')))
	n.append(ni)
	m.append(mi)
for i in range(t):
	if n[i] == 1 and m[i] == 1:
		print(1)
	elif n[i] == 1 and m[i] != 1:
		if m[i] % 2 == 0:
			print(m[i] // 2)
		else:
			print((m[i] + 1) // 2)
	elif m[i] == 1 and n[i] != 1:
		if n[i] % 2 == 0:
			print(n[i] // 2)
		else:
			print((n[i] + 1) // 2)
	elif n[i] % 2 == 0:
		print(n[i] // 2 * m[i])
	elif m[i] % 2 == 0:
		print(m[i] // 2 * n[i])
	else:
		print((n[i] * m[i] + 1) // 2)


import math
t = input()
t = int(t)
for i in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if a * b % 2 == 0:
		print(int(a * b / 2))
	else:
		print(int((a * b - 1) / 2 + 1))


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	(n, m) = map(int, stdin.readline().split())
	if n * m % 2 == 1:
		stdout.write(str(int((m * n + 1) / 2)) + '\n')
	else:
		stdout.write(str(int(m * n / 2)) + '\n')


import math
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	p = x * y
	print(math.ceil(p / 2))


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().strip().split(' ')))
	print(max(a, b) * (min(a, b) // 2) + max(a, b) // 2 * (min(a, b) % 2) + max(a, b) % 2 * (min(a, b) % 2))


from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = ceil(a * b / 2)
	print(ans)


def solve(n, m):
	if n % 2 == 0:
		print(int(m * (n // 2)))
		return
	elif m % 2 == 0:
		print(int((n - 1) // 2 * m + m // 2))
		return
	else:
		print(int((n - 1) // 2 * m + (m - 1) // 2 + 1))
		return
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	solve(n, m)


from sys import stdin, stdout

def park_lighting(n, m):
	return n * m // 2 + n * m % 2
t = int(stdin.readline())
for i in range(t):
	nm = list(map(int, stdin.readline().split()))
	stdout.write(str(park_lighting(nm[0], nm[1])) + '\n')


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if m == 1 and n == 1:
		print(1)
	elif m % 2 == 0:
		print(n * (m // 2))
	else:
		x = n * ((m - 1) // 2)
		if n % 2 == 0:
			print(x + n // 2)
		else:
			print(x + n // 2 + 1)


t = int(input())
n = []
m = []
for _ in range(t):
	(n1, m1) = map(int, input().split())
	n.append(n1)
	m.append(m1)
for i in range(t):
	res = n[i] * m[i] // 2
	if n[i] * m[i] % 2 != 0:
		res += 1
	print(res)


import math
test = int(input())
for _ in range(test):
	(n, m) = map(int, input().split())
	(x, y) = (n, m)
	result = 0
	result = math.ceil(x * y / 2)
	print(result)


t = int(input())
for i in range(t):
	vstup = [int(_) for _ in input().split(' ')]
	n = vstup[0]
	m = vstup[1]
	print(n * m // 2 + n * m % 2)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1:
		print(math.ceil(b / 2))
	elif a % 2 == 0:
		print(b * (a // 2))
	else:
		print((a - 1) // 2 * b + math.ceil(b / 2))


t = int(input())
while t:
	t -= 1
	(x, y) = map(int, input().split())
	res = x * y
	if res % 2 == 0:
		print(res // 2)
	else:
		print(res // 2 + 1)


import math
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	m = int(l[1])
	print(math.ceil(n * m / 2))


from math import ceil

def solve():
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		result = n * (m // 2)
	else:
		result = n * (ceil(m / 2) - 1) + ceil(n / 2)
	print(result)

def main():
	for _ in range(int(input())):
		solve()
main()


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if x * y % 2 == 0:
		print(x * y // 2)
	else:
		print(x * y // 2 + 1)


import math as ma
t = int(input())
while t > 0:
	t -= 1
	(n, m) = map(int, input().split())
	k = ma.ceil(n * m / 2)
	print(int(k))


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split(' '))
	d = n * m
	c = 0
	c = c + d // 2 + d % 2
	print(c)


from sys import stdin
from math import ceil
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(n, m) = [int(x) for x in inp().split()]
	print(ceil(n * m / 2))


def solve(n, m):
	res = 0
	if n % 2 == 0:
		res = n // 2 * m
	elif m % 2 == 0:
		res = m // 2 * n
	else:
		res1 = (n - 1) // 2 * m + m // 2 + 1
		res2 = (m - 1) // 2 * n + n // 2 + 1
		res = min(res1, res2)
	print(res)
	return
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	solve(n, m)


import sys
import math
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for test in range(t):
	(r, c) = [int(x) for x in input().split()]
	ans = 0
	if r % 2 == 0:
		if c % 2 == 0:
			ans = r // 2
			ans *= c
		else:
			ans += r // 2
			c -= 1
			delta = ans * c
			ans += delta
	elif c % 2 == 0:
		ans += c // 2
		r -= 1
		delta = ans * r
		ans += delta
	else:
		ans = math.ceil(r / 2)
		c -= 1
		delta = c // 2
		delta *= r
		ans += delta
	print(ans)


t = int(input())
while t != 0:
	ans = 0
	t = t - 1
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1:
		if n == 1:
			ans = int(m / 2) + m % 2
		if m == 1:
			ans = int(n / 2) + n % 2
	else:
		ans = n * int(m / 2)
		if m % 2 == 1:
			ans = ans + int(n / 2) + n % 2
	print(ans)


import math
case = int(input())
for caseNum in range(0, case):
	(x, y) = [int(x) for x in input().split()]
	answer = math.ceil(x * y / 2)
	print(answer)


for _ in range(int(input().strip())):
	(n, m) = map(int, input().strip().split())
	ans = 0
	if n % 2 == 0 or m % 2 == 0:
		ans = n * m // 2
	else:
		(n, m) = (max(n, m), min(n, m))
		ans = (m - 1) * n // 2 + (n + 1) // 2
	print(str(ans))


def solve():
	(n, m) = list(map(int, input().split()))
	cells = n * m
	if cells % 2 == 0:
		print(cells // 2)
	else:
		cells += 1
		print(cells // 2)

def main():
	T = int(input())
	while T:
		solve()
		T -= 1
main()


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().strip().split())
	print((a * b + 1) // 2)


import math
test = int(input())
for tes in range(test):
	(n, m) = list(map(int, input().split()))
	rows = m // 2
	tots = rows * n
	if m % 2 == 1:
		tots += math.ceil(n / 2)
	print(tots)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 != 0 and b % 2 != 0:
		print(a * b // 2 + 1)
	else:
		print(a * b // 2)


import math as m
for i in range(int(input())):
	(a, b) = input().split()
	print(int(m.ceil(int(a) * int(b) / 2)))


import math
t = int(input())
for _ in range(t):
	(r, c) = map(int, input().split())
	if r == 1:
		print(math.ceil(c / 2))
	elif r == 2:
		print(c)
	elif r % 2 == 0:
		print(r // 2 * c)
	else:
		print(r // 2 * c + math.ceil(c / 2))


for __ in range(int(input())):
	(n, m) = map(int, input().split())
	print(n * m // 2 + n * m % 2)


t = int(input())
for i in range(t):
	a = []
	a = list(map(int, input().split()))
	b = a[0] // 2 * a[1]
	if a[0] % 2 == 1:
		b += a[1] // 2 + a[1] % 2
	print(b)


import sys
input = iter(sys.stdin.read().splitlines()).__next__
TC = int(input())
for tc in range(TC):
	(R, C) = map(int, input().split())
	res = (R * C + 1) // 2
	print(res)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [-1 for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == -1:
			for i in range(p * p, n + 1, p):
				prime[i] = p
		p += 1
	l1 = []
	for i in range(2, n + 1):
		if prime[i] == -1:
			l1.append(i)
	return l1

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, val, ans):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		v = val ** 5 - mid ** 5
		print(v)
		if v == ans:
			print('HOHOHOH')
			return mid
		elif v < ans:
			return binary(mid + 1, r, val, ans)
		else:
			return binary(l, mid - 1, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v

def stairs(n, m, val, c, l):
	if val > n:
		return 100000
	elif val == n:
		if l[val] != -1:
			return l[val]
		elif c % m == 0:
			l[val] = c
			return l[val]
		else:
			l[val] = 100000
			return l[val]
	else:
		l[val] = min(stairs(n, m, val + 1, c + 1, l), stairs(n, m, val + 2, c + 1, l))
		return l[val]

def fact(n):
	if n == 0 or n == 1:
		return 1
	else:
		return n * fact(n - 1)

def some(n):
	s = 0
	while n != 0:
		s += fact(n % 10)
		n //= 10
	return s

def bin(ll, l, r, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] <= val:
			ans = mid
			return bin(ll, mid + 1, r, val, ans)
		else:
			return bin(ll, l, mid - 1, val, ans)

def fn(n):
	c = -1
	for i in range(2, int(sqrt(n)) + 1):
		if n % 2 == 0:
			c = i
			break
	if c == -1:
		c = n
	return c

def check(n):
	val = 0
	while n != 0:
		if n % 10 > 1:
			val = -1
			break
		n = n // 10
	return val

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split(' '))
	v = n * m
	if v % 2 == 0:
		print(v // 2)
	else:
		print(v // 2 + 1)


t = int(input())
out = []
for i in range(t):
	(n, m) = map(int, input().split())
	if n * m % 2 != 0:
		out.append(n * m // 2 + 1)
	else:
		out.append(n * m // 2)
for ans in out:
	print(ans)


t = int(input())
for k in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 0 and m % 2 == 0:
		print(m * n // 2)
	elif n % 2 == 1 or m % 2 == 1:
		if n % 2 == 1 and m % 2 == 1:
			if m >= n:
				print(m * (n // 2) + m // 2 + 1)
			elif m < n:
				print(n * (m // 2) + n // 2 + 1)
		elif n % 2 == 0 and m % 2 == 1:
			print(n * (m // 2) + n // 2)
		elif m % 2 == 0 and n % 2 == 1:
			print(m * (n // 2) + m // 2)


def f(x, y):
	if x * y % 2 == 0:
		return x * y // 2
	else:
		return (x * y + 1) // 2
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	print(f(x, y))


v = int(input())
for i in range(v):
	a = [int(x) for x in input().split()]
	c = a[0] * a[1]
	if c % 2 == 1:
		c += 1
	print(int(c / 2))


t = int(input())
for k in range(t):
	a = list(map(int, input().split(' ')))
	r = a[0]
	c = a[1]
	x = r * c
	if x % 2 == 0:
		res = x // 2
	else:
		res = x // 2 + 1
	print(res)


import math

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
t = inp()
while t:
	(a, b) = invr()
	res = int(math.ceil(a * b / 2))
	print(res)
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = a * b / 2
	if ans * 10 % 10 == 5:
		ans = int(ans) + 1
	else:
		ans = int(ans)
	print(ans)


import math
n = int(input())
for x in range(n):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	tiles = a * b
	ans = math.ceil(tiles / 2)
	print(ans)


def single_integer():
	return int(input())

def multi_integer():
	return map(int, input().split())

def string():
	return input()

def multi_string():
	return input().split()
t = single_integer()
for i in range(t):
	(n, m) = multi_integer()
	if n * m > max(n, m):
		if m % 2 == 0:
			print(n * (m // 2))
		else:
			print(n * (m // 2) + n // 2 + n % 2)
	elif n * m == max(n, m):
		max_value = max(n, m)
		min_value = min(n, m)
		print(max_value // 2 + max_value % 2)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	if a % 2 == 0:
		print(a // 2 * b)
	elif b % 2 == 0:
		print(b // 2 * a)
	else:
		r = max(a, b)
		d = min(a, b)
		sum = r // 2 + 1
		d = d - 1
		print(sum + d // 2 * r)
	t = t - 1


a = input()
l = []
for i in range(int(a)):
	k = input()
	l += k.split()
for i in range(0, 2 * int(a), 2):
	print((eval(l[i]) * eval(l[i + 1]) + eval(l[i]) % 2 * (eval(l[i + 1]) % 2)) // 2)


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def fun(a, b):
	count = 0
	if a % 2 == 0:
		count += a // 2
		print(count * b)
	else:
		count += (a - 1) // 2
		count = count * b
		if b % 2 == 0:
			print(count + b // 2)
		else:
			print(count + (b + 1) // 2)

def main():
	for _ in range(inin()):
		(n, m) = map(int, input().split())
		if m > n:
			(m, n) = (n, m)
		fun(n, m)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def chet(x):
	if x % 2 == 1:
		return True
	else:
		return False
for i in range(int(input())):
	(n, m) = map(int, input().split())
	print(m // 2 * n + chet(m) * ((n - 1) // 2 + 1))


import math
m = int(input())
for _ in range(m):
	(a, b) = map(int, input().split())
	p = a * b
	c = math.ceil(p / 2)
	print(c)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 and b == 1:
		print('1')
	elif max(a, b) >= 2 and min(a, b) < 2:
		print(math.ceil(max(a, b) / 2))
	else:
		print(min(a, b) // 2 * max(a, b) + math.ceil(min(a, b) % 2 * max(a, b) / 2))


t = int(input())
l = []
for i in range(t):
	v = input()
	v = v.split(' ')
	l.append(v)
for i in range(len(l)):
	l[i][0] = int(l[i][0])
	l[i][1] = int(l[i][1])
for i in l:
	if i[0] % 2 == 1 and i[1] % 2 == 1:
		r1 = (i[0] + 1) * (i[1] + 1) / 4 + (i[0] - 1) * (i[1] - 1) / 4
		print(int(r1))
	else:
		r2 = i[0] * i[1] / 2
		print(int(r2))


def solve(a, b):
	if b % 2 == 0:
		return b // 2 * a
	else:
		return a * (b - 1) // 2 + a // 2 + int(a % 2)
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	if a < b:
		(a, b) = (b, a)
	print(solve(a, b))


t = int(input())
parks = []
for i in range(t):
	(n, m) = map(int, input().split())
	parks.append((n, m))
for park in parks:
	(n, m) = (park[0], park[1])
	if n * m % 2 == 0:
		lanterns = n * m // 2
		print(lanterns)
	else:
		lanterns = (n * m + 1) // 2
		print(lanterns)


for _ in range(int(input())):
	(m, n) = [int(i) for i in input().split()]
	a = m * n
	print(a // 2 if a % 2 == 0 else a // 2 + 1)


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for _ in range(test):
		l = [int(i) for i in input().split(' ')]
		n = l[0]
		m = l[1]
		if m % 2 == 0 and n % 2 == 0:
			print(m // 2 * n)
		elif m % 2 == 0:
			print(m // 2 * n)
		elif n % 2 == 0:
			print(n // 2 * m)
		else:
			print(m * n // 2 + 1)
main()


t = int(input())
for o in range(t):
	(n, m) = map(int, input().split())
	x = 0
	x += n // 2 * m
	x += n % 2 * m // 2
	x += n % 2 * m % 2
	print(x)


t = int(input())
while t:
	(n, m) = [int(i) for i in input().split()]
	mul = n * m
	if mul % 2 == 1:
		mul += 1
	print(mul // 2)
	t -= 1


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	(n, m) = map(int, stdin.readline().strip().split())
	if n % 2 == 0:
		print(m * (n // 2))
	else:
		ans = m * (n // 2)
		if m % 2 == 0:
			ans += m // 2
		else:
			ans += m // 2 + 1
		print(ans)


t = int(input())
for i in range(t):
	(n, m) = (int(i) for i in input().split())
	print((n * m + 1) // 2)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7
T = int(stdin.readline())
for _ in range(T):
	(n, m) = list(map(int, stdin.readline().split()))
	ans = m * n // 2 + m * n % 2
	print(ans)


import math

def lights(a, b):
	return math.ceil(a * b / 2)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(lights(a, b))


import math
try:
	t = int(input())
	for i in range(t):
		(n, m) = map(int, input().split())
		print(math.ceil(n * m / 2))
except EOFError:
	pass


for _ in range(int(input())):
	l = list(input().split(' '))
	n = int(l[0])
	m = int(l[1])
	if n % 2 == 0 or m % 2 == 0:
		print(int(n * m / 2))
	elif n >= m:
		ans = m * (n // 2) + m // 2 + 1
		print(ans)
	else:
		ans = n * (m // 2) + n // 2 + 1
		print(ans)


n = int(input())
for i in range(n):
	count = 0
	(a, b) = map(int, input().split())
	s = a * b
	if a % 2 == 0 and b % 2 == 0:
		print(a * b // 2)
	elif a % 2 != 0 and b % 2 != 0:
		count = (a - 1) // 2 + (b - 1) // 2
		d = s - count * 2
		if d % 2 == 0:
			count += d // 2
		else:
			count += d // 2 + 1
		print(count)
	else:
		if a % 2 == 0:
			count = b * (a // 2)
		else:
			count = a * (b // 2)
		print(count)


import math
t = int(input())
ans = []
for i in range(t):
	l = [int(i) for i in input().split()]
	ans.append(math.ceil(l[0] * l[1] / 2))
for i in ans:
	print(i)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
testcases = int(input())
for j in range(testcases):
	(n, m) = map(int, input().split())
	lants = 0
	if m % 2 == 0 or n % 2 == 0:
		if m % 2 == 0:
			print(n * (m // 2))
		elif n % 2 == 0:
			print(m * (n // 2))
	elif m % 2 == 1 and n % 2 == 1:
		lants += n * (m // 2)
		lants += math.ceil(n / 2)
		print(lants)


t = int(input())
count = 0
while True:
	(n, m) = map(int, input().split())
	count += 1
	total_light = (n * m + 1) // 2
	print(total_light)
	if count == t:
		break


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	p = ceil(a * b / 2)
	print(p)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
for i in range(n):
	(n, m) = sorted(I())
	print(m // 2 * n + (n // 2 + n % 2) if m % 2 else m // 2 * n)


from math import ceil as c
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	print(c(n * k / 2))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, m) = get_ints()
	a = n * m
	if a % 2 == 0:
		c = a // 2
	else:
		c = a // 2 + 1
	print(c)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
mod = 1000000007

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def printIn(ob):
	return stdout.write(str(ob))

def powerLL(n, p):
	result = 1
	while p:
		if p & 1:
			result = result * n % mod
		p = int(p / 2)
		n = n * n % mod
	return result

def myCode():
	(n, m) = In()
	total_sq = n * m
	if total_sq == 1:
		print(1)
	elif total_sq % 2 == 0:
		print(total_sq // 2)
	else:
		print((total_sq + 1) // 2)

def main():
	for t in range(I()):
		myCode()
main()


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, m) = map(int, stdin.readline().split())
	stdout.write(str(m * n + 1 >> 1) + '\n')


INF = 1 << 60
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 0 and m % 2 == 0:
		ans = n * m // 2
		print(ans)
	elif n % 2 == 0:
		ans = n * (m - 1) // 2 + n // 2
		print(ans)
	elif m % 2 == 0:
		ans = (n - 1) * m // 2 + m // 2
		print(ans)
	else:
		ans = (n - 1) * (m - 1) // 2 + (n - 1) // 2 + (m - 1) // 2 + 1
		print(ans)


import math

def check(n, k):
	return n // 2 * k + math.ceil(k / 2) * (n % 2)

def solution():
	(n, k) = map(int, input().split())
	print(min(check(n, k), check(k, n)))
for _ in range(int(input())):
	solution()


for _ in range(int(input())):
	(a, b) = input().split()
	print((int(a) * int(b) + 1) // 2)


testcases = int(input())
ans = []
for i in range(testcases):
	lenheight = input()
	xy = lenheight.split(' ')
	size = int(xy[0]) * int(xy[1])
	if size % 2 == 0:
		ans.append(size // 2)
	else:
		ans.append(size // 2 + 1)
for i in ans:
	print(i)


from collections import defaultdict

def solve():
	(n, m) = [int(x) for x in input().split()]
	print(n * m // 2 + n * m % 2)
t = int(input())
for _ in range(t):
	solve()


import math
t = int(input())
for j in range(t):
	(n, m) = tuple(map(int, input().split()))
	print(math.ceil(n * m / 2))


n = int(input())
for i in range(0, n):
	x = list(map(int, input().split()))
	y = x[0] * x[1]
	ans = 0
	if y % 2 == 0:
		ans = int(y / 2)
	elif y % 2 == 1:
		ans = int(y / 2) + 1
	print(ans)


from math import log
for i in range(int(input())):
	(n, m) = map(int, input().split())
	x = n * m
	if x % 2 == 0:
		print(int(x / 2))
	else:
		print(int(int(x / 2) + 1))


import math
for _ in range(int(input())):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	ans = math.floor((n * m + 1) / 2)
	print(ans)


def park(n, m):
	if n % 2 == 0 and m % 2 != 0:
		return n // 2 * m
	elif n % 2 != 0 and m % 2 == 0:
		return m // 2 * n
	elif n % 2 == 0 and m % 2 == 0:
		return n // 2 * m
	else:
		return park(n - 1, m) + m // 2 + 1
t = int(input())
while t > 0:
	t = t - 1
	a = input()
	A = list(map(int, list(a.split())))
	print(park(A[0], A[1]))


t = int(input())
for _ in range(t):
	(n, m) = [int(i) for i in input().split()]
	ans = n // 2 * m
	if n % 2 == 0:
		print(ans)
	else:
		temp = m // 2
		if m % 2 != 0:
			temp += 1
		print(ans + temp)


tc = int(input())
for i in range(tc):
	lst = input().split()
	a = int(lst[0])
	b = int(lst[1])
	squares = a * b
	if squares % 2 == 0:
		print(int(squares / 2))
	else:
		print(squares // 2 + 1)


from math import ceil
for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	count = 0
	while a > 0:
		if a % 2 == 0:
			count += b
			a -= 2
		else:
			count += ceil(b / 2)
			a -= 1
	print(count)


T = int(input())
for t in range(T):
	(N, M) = [int(s) for s in input().split()]
	print((N * M + 1) // 2)


from math import ceil
x = int(input())
for i in range(x):
	y = list(map(int, input().split()))
	print(ceil(y[0] * y[1] / 2))


def parkLight(n):
	if n[0] * n[1] % 2 == 0:
		return n[0] * n[1] // 2
	else:
		return n[0] * n[1] // 2 + 1
tc = int(input())
for i in range(tc):
	n = list(map(int, input().split()))
	print(parkLight(n))


t = int(input())
for i in range(t):
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	prod = n * m
	if prod % 2 == 0:
		total = prod / 2
	else:
		total = prod // 2 + 1
	print(int(total))


test_cases = int(input())
for tt in range(test_cases):
	temp = input()
	(m, n) = [int(a) for a in temp.split(' ')]
	if m * n % 2 == 0:
		print(m * n // 2)
	else:
		print(m * n // 2 + 1)


import sys
input = lambda : sys.stdin.readline().rstrip()
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	print((a * b + 1) // 2)


import sys
import math
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	(n, m) = [int(c) for c in input().split()]
	k = n * m
	print(math.ceil(k / 2))


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	if a == 1:
		if b % 2 == 0:
			print(b // 2)
		else:
			print(b // 2 + 1)
	elif a % 2 == 0:
		print(a // 2 * b)
	elif b % 2 == 0:
		print(a // 2 * b + b // 2)
	else:
		print(a // 2 * b + b // 2 + 1)


for u in [*open(0)][1:]:
	(n1, m) = map(int, u.split())
	print(n1 * m + 1 >> 1)


def returnCount(r, c):
	if c % 2 == 0:
		return r * (c / 2)
	if r % 2 == 0:
		return r * ((c - 1) / 2) + r / 2
	return r * ((c - 1) / 2) + r // 2 + 1
n = int(input())
while n > 0:
	(r, c) = list((int(x) for x in input().strip().split()))[:2]
	print(int(returnCount(r, c)))
	n -= 1


import bisect
import sys
import math
input = sys.stdin.readline
from collections import defaultdict

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())

def solve(case):
	[n, m] = inlt()
	if n == 1:
		return m // 2 + m % 2
	if m == 1:
		return n // 2 + n % 2
	if n % 2 == 0:
		return n // 2 * m
	if m % 2 == 0:
		return m // 2 * n
	return n // 2 * m + m // 2 + 1
T = inp()
for i in range(T):
	res = solve(i + 1)
	print(str(res))


import math
t = int(input())
while t:
	t = t - 1
	(n, m) = map(int, input().split())
	ans = math.ceil(n * m / 2)
	print(ans)


t = input('')
lst = list()
i = 1
while i <= int(t):
	(n, m) = input('').split()
	val = (int(n), int(m))
	lst.append(val)
	i = i + 1
for (a, b) in lst:
	print(int((a * b + 1) / 2))


import sys
inp = [int(x) for x in sys.stdin.readline().split()]
t = inp[0]
for i in range(t):
	cur = [int(x) for x in sys.stdin.readline().split()]
	n = cur[0]
	m = cur[1]
	val = n * m
	res = val // 2
	if val % 2 == 1:
		res += 1
	print(res)


def solve(a, b):
	if (a * b + 1) % 2 == 0:
		print((a * b + 1) // 2)
	else:
		print(a * b // 2)
t = int(input())
while t != 0:
	(n, m) = map(int, input().split(' '))
	solve(n, m)
	t -= 1


import math
t = int(input())
listnm = list()
for i in range(t):
	listnm.append(list(map(int, input().split())))

def lamps(n, m):
	lamp = math.ceil(n * m / 2)
	return int(lamp)
for (n, m) in listnm:
	print(lamps(n, m))


t = int(input())
p = []
for i in range(t):
	u = list(map(int, input().split()))
	p.append(u)
for i in range(t):
	j = p[i][1] * p[i][0]
	print(j // 2 + j % 2)


from math import ceil
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	(n, m) = mInt()
	print((n * m + 1) // 2)


for _ in range(int(input().strip(' '))):
	c = 0
	(n, m) = tuple(map(int, input().strip(' ').split(' ')))
	total = n * m / 2
	if total * 10 % 10 == 5:
		total = total * 10 + 5
		total = total / 10
	print(int(total))


def brute(R, C):
	marked = [[False for _ in range(C)] for _ in range(R)]
	result = 0
	for r in range(R):
		for c in range(C - 1):
			if not marked[r][c] and (not marked[r][c + 1]):
				result += 1
				marked[r][c] = marked[r][c + 1] = True
	for c in range(C):
		for r in range(R - 1):
			if not marked[r][c] and (not marked[r + 1][c]):
				result += 1
				marked[r][c] = marked[r + 1][c] = True
	numMarked = 2 * result
	result += R * C - numMarked
	return result

def soln(R, C):
	if C % 2 == 0:
		return R * C // 2
	elif R % 2 == 0:
		return C * R // 2
	return 1 + min((C - 1) // 2 * R + R // 2, (R - 1) // 2 * C + C // 2)

def main():
	t = int(input())
	for _ in range(t):
		(R, C) = [int(x) for x in input().split()]
		result = soln(R, C)
		print(result)

def randomTest():
	import random
	t = 10000
	for i in range(1, t + 1):
		R = random.randint(1, 10)
		C = random.randint(1, 10)
		b = brute(R, C)
		f = soln(R, C)
		print(i, R, C)
		if b != f:
			print('Broken!')
			print(b, f)
			return
main()


from math import ceil
t = int(input())
for _ in range(t):
	(n, m) = [int(i) for i in input().split(' ')]
	(pair_n, pair_m) = (n // 2, m // 2)
	mn = pair_m * n + ceil(n / 2) if m % 2 != 0 else pair_m * n
	nm = pair_n * m + ceil(m / 2) if n % 2 != 0 else pair_n * m
	print(min(mn, nm))


T = int(input())
for _ in range(0, T):
	(n, m) = map(int, input().split())
	print((m * n + 1) // 2)


total_case = int(input())
for i in range(total_case):
	line = input().split()
	(m, n) = (int(line[0]), int(line[1]))
	result1 = (m >> 1) * n + (m & 1) * (n + 1 >> 1)
	result2 = m * (n + 1 >> 1) + (n & 1) * (m + 1 >> 1)
	print(min(result1, result2))


for _ in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	a = n * m
	print(a // 2 + a % 2)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = n * (m // 2)
	x = 0
	if n % 2 == 0:
		x = n // 2
	else:
		x = n // 2 + 1
	b = m % 2 * x
	print(a + b)


import math
import sys
input = sys.stdin.readline
output = sys.stdout

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())

def solve(n, m):
	quo = m // 2
	ans = quo * n
	rem = m % 2
	if rem == 1:
		if n % 2 == 0:
			ans += n // 2
		else:
			ans += math.ceil(n / 2)
	output.write(str(ans) + '\n')
n = inp()
for i in range(n):
	num = inlt()
	solve(num[0], num[1])


import math
t = int(input())
for k in range(t):
	(n, m) = map(int, input().split())
	print(n * (m // 2) + m % 2 * math.ceil(n / 2))


import sys
from collections import deque
for _ in range(int(input())):
	(m, n) = map(int, input().split())
	count = 0
	if n % 2 == 0:
		count = m * n // 2
	elif n % 2 == 1 and m % 2 == 0:
		count = n * m // 2
	else:
		count = m * (n // 2) + m // 2 + 1
	print(count)


from sys import stdin
import math

def readline():
	return stdin.readline()
tests = int(readline())

def solve(n, m):
	ans = math.ceil(n * m / 2)
	return ans
for t in range(0, tests):
	(n, m) = map(int, readline().split(' '))
	print(solve(n, m))


def brick(n):
	if n % 2:
		return n // 2 + 1
	else:
		return n // 2
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	x = n * m
	if x % 2 == 0:
		print(x // 2)
	else:
		print((n - 1) * m // 2 + brick(m))


q = int(input())
for i in range(q):
	(a, b) = map(int, input().split())
	x = a * b
	if x % 2 == 0:
		print(x // 2)
	else:
		print(x // 2 + 1)


def ques1(n, m):
	box = n * m
	if box % 2 == 0:
		print(int(box / 2))
	else:
		box += 1
		print(int(box / 2))
t = int(input())
for i in range(t):
	(n, m) = [int(i) for i in input().split()]
	ans = ques1(n, m)
	ans


t = int(input())
while t:
	(n, m) = [int(a) for a in input().split()]
	if n % 2 == 0 or m % 2 == 0:
		print(m * n // 2)
	else:
		print((m - 1) * n // 2 + (n + 1) // 2)
	t -= 1


def ans(n, m):
	if n * m % 2 == 0:
		return n * m / 2
	else:
		return (n * m - 1) / 2 + 1
n = int(input())
l = []
for i in range(n):
	l.append([int(x) for x in input().split()])
for (x, y) in l:
	print(int(ans(x, y)))


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, M):
	return (N * M + 1) // 2
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N, M) = [int(x) for x in input().split()]
	ans = solve(N, M)
	print(ans)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if a % 2 == 1 and b % 2 == 1:
		print(int(a * b / 2) + 1)
	else:
		print(int(a * b / 2))
	t -= 1


from collections import Counter, defaultdict, deque
from math import *
import sys
input = sys.stdin.readline

def solve():
	(a, b) = [int(x) for x in input().split()]
	print((a * b + 1) // 2)
tt = int(input())
for test in range(tt):
	solve()


q = int(input())
import sys
for i in range(q):
	(a, b) = [int(i) for i in sys.stdin.readline().split()]
	print(a * b // 2 + a * b % 2)


T = int(input())
for _ in range(T):
	(N, M) = map(int, input().split())
	a = (N * M + 1) // 2
	print(a)


def ceil(a, b):
	return a // b + bool(a % b)

def solve(n, m):
	return ceil(n * m, 2)
for _ in range(int(input())):
	print(solve(*map(int, input().split())))


import math as m1
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(m1.ceil(n * m / 2))


Test = int(input())
for i in range(Test):
	(N, M) = input().split(' ')
	area = int(N) * int(M)
	if area % 2 == 0:
		print(int(area / 2))
	else:
		ans = int(area / 2)
		print(ans + 1)


def main():
	from sys import stdin
	from sys import stdout
	input = stdin.readline
	print = stdout.write
	t = int(input())
	for _ in range(t):
		(n, m) = list(map(int, input().split()))
		print(f'{n * m // 2 + n * m % 2}\n')
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(N, M) = map(int, input().split())
	x = N * (M - M % 2) // 2 - -N // 2 * (M % 2)
	y = M * (N - N % 2) // 2 - -M // 2 * (N % 2)
	print(max(x, y))


import math
for tc in range(int(input())):
	(n, m) = map(int, input().split())
	ans = max(n, m) // 2 * min(n, m)
	if max(n, m) & 1:
		ans += math.ceil(min(n, m) / 2)
	print(int(ans))


t = int(input())
for ck in range(t):
	(m, n) = map(int, input().split())
	print((m * n + 1) // 2)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial, ceil
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	for _ in range(N()):
		(n, m) = RL()
		r = n // 2
		lst = n % 2
		res = r * m + ceil(m / 2) * lst
		print(res)
main()


for _ in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	nm = n * m
	if nm < 2:
		print(1)
	else:
		print(nm // 2 + nm % 2)


t = int(input())
arr1 = []
for i in range(t):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	if x * y % 2 != 0:
		result = x * y // 2 + 1
	else:
		result = x * y // 2
	arr1.append(result)
for i in arr1:
	print(i)


x = int(input(''))
for i in range(x):
	y = list(input('').split(' '))
	num1 = int(y[0])
	num2 = int(y[1])
	if num1 * num2 % 2 == 0:
		print(num1 * num2 // 2)
	else:
		print(num1 * num2 // 2 + 1)


import math

def solve():
	(A, B) = map(int, input().split())
	print((A * B + 1) // 2)
Testcase = 1
Testcase = int(input())
for _ in range(Testcase):
	solve()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = a * b + 1
	print(k // 2)


for __ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		c = int(n / 2)
		print(c * m)
	else:
		c = int(n / 2)
		d = c + 1
		if n == 1:
			if m % 2 == 0:
				print(int(m / 2))
			else:
				print(int(m / 2) + 1)
		else:
			if m % 2 == 0:
				a = int(n / 2) * m
				a = a + int(m / 2)
			else:
				a = int(n / 2) * m
				a = a + int(m / 2) + 1
			print(a)


import math as m
cases = int(input())
tests = [[0] * 2] * cases
area = [[0]] * cases
for i in range(cases):
	tests[i] = [int(i) for i in input().split()]
	area[i] = tests[i][0] * tests[i][1]
for i in range(cases):
	number = m.ceil(area[i] / 2)
	print(number)


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print(math.floor((n * m + 1) / 2))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
for _ in range(val()):
	(a, b) = li()
	if a < b:
		(a, b) = (b, a)
	if a & 1:
		ans = a // 2 * b + b // 2 + (b & 1)
	else:
		ans = a // 2 * b
	print(ans)


def read():
	return list(map(int, input().split()))
for i in range(int(input())):
	(n, m) = read()
	print((m * n + 1) // 2)


import sys
import string
input = sys.stdin.readline
import math
t = int(input())
for i in range(t):
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	if n * m % 2 == 0:
		print(int(n * m / 2))
	else:
		print(int(math.floor(n * m / 2) + 1))


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		s = n * m
		if n % 2 == 1 and m % 2 == 1:
			ans = s // 2 + 1
		else:
			ans = s // 2
		sys.stdout.write(str(ans) + '\n')
main()


import math
n = int(input())
for x in range(n):
	pair = list(map(int, input().split()))
	if pair[0] * pair[1] % 2 == 0:
		print(int(pair[1] * pair[0] / 2))
	elif pair[0] % 2 == 1 and pair[1] % 2 == 1:
		print(int(pair[1] * int(math.floor(pair[0] / 2)) + math.ceil(pair[1] / 2)))


n = int(input())

def solve(n, m):
	a = m * n // 2 + n % 2
	b = n * m // 2 + m % 2
	c = m * n // 2 + m // 2 + m % 2
	d = n * m // 2 + n // 2 + n % 2
	return min(a, b, c, d)
for _ in range(n):
	(n, m) = list(map(int, input().split()))
	print(solve(n, m))


for i in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n % 2 == 0 or m % 2 == 0:
		print(int(n * m / 2))
	else:
		a = (n - 1) * m / 2 + (m // 2 + 1)
		print(int(a))


from math import ceil
t = int(input())
for c in range(t):
	(n, m) = [int(x) for x in input().split()]
	print(ceil(m * n / 2))


import sys
max_int = 1000000001
min_int = -max_int
t = int(sys.stdin.readline())
for _ in range(t):
	(n, m) = list(map(int, sys.stdin.readline().split()))
	print((n * m + 1) // 2)


t = int(input())
for x in range(t):
	(n, m) = map(int, input().split())
	if n * m / 2 == int(n * m / 2):
		print(int(n * m / 2))
	else:
		print(int(n * m / 2 + 0.5))


def func(x, y):
	return x // 2 * y + x % 2 * (y // 2 + y % 2)
n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	print(func(x, y))


import sys, math, cmath, time
start_time = time.time()
global tt

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	(n, m) = invr()
	if n % 2 == 1 and m % 2 == 1:
		print(math.ceil(n / 2) + m // 2 * n)
	elif n % 2 == 0 and m % 2 == 1:
		print(n // 2 * m)
	elif m % 2 == 0 and n % 2 == 1:
		print(m // 2 * n)
	else:
		print(n * m // 2)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


def solve():
	pippo = input()
	gianni = pippo.split()
	x = int(gianni[0])
	y = int(gianni[1])
	x *= y
	if x % 2 > 0:
		print(int(x / 2) + 1)
	else:
		print(int(x / 2))
n_test = int(input())
while n_test:
	solve()
	n_test -= 1


for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	s = n * m
	if s % 2 == 0:
		light = s // 2
	else:
		light = s // 2 + 1
	print(light)


import math
n = int(input())
while n:
	(a, b) = map(int, input().split(' '))
	if b & 1 == 1:
		if a & 1 == 1:
			temp = a - 1
			total = temp // 2 * b
			print(total + math.ceil(b / 2))
		else:
			print(a // 2 * b)
	else:
		print(a * (b // 2))
	n = n - 1


t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	(n, m) = (max(n, m), min(n, m))
	if n % 2 == 0:
		print(n * m // 2)
	else:
		print((n - 1) * m // 2 + m % 2 + m // 2)


from math import ceil
test = int(input())
for _ in range(test):
	(n, m) = map(int, input().split())
	if not m % 2:
		print(n * (m // 2))
	else:
		print(n * (m // 2) + ceil(n / 2))


n = int(input())
test_cases = [list(map(int, input().split())) for _ in range(n)]
for test_case in test_cases:
	num_squares = test_case[0] * test_case[1]
	print(num_squares // 2 if num_squares % 2 == 0 else num_squares // 2 + 1)


n = int(input())
for i in range(n):
	ar = list(map(int, input().rstrip().split()))
	s = 1
	for i in ar:
		s = s * i
	if s % 2 == 0:
		print(s // 2)
	else:
		print((s + 1) // 2)


tst = input()
tst = int(tst)
while tst > 0:
	val = input()
	val = val.split()
	row = int(val[0])
	col = int(val[1])
	ans = int(row * col / 2)
	if row * col % 2 == 1:
		ans = ans + 1
	print(ans)
	tst = tst - 1


t = int(input())
for i in range(t):
	(m, n) = map(int, input().split())
	if m % 2 == 0:
		count = n * m // 2
	else:
		count = n * (m // 2) + n // 2 + n % 2
	print(count)


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
from math import ceil
for _ in range(int(f_input())):
	(n, m) = map(int, f_input().split())
	f_print(str(ceil(n * m / 2)) + '\n')


t = int(input())
for i in range(t):
	(r, c) = map(int, input().split())
	cells = int(r * c)
	lamps = int(cells / 2)
	if int(cells % 2) == 0:
		print(lamps)
	else:
		print(lamps + 1)


T = int(input().strip())
for t in range(T):
	(n, m) = list(map(int, input().split()))
	if n * m % 2 == 0:
		res = n * m // 2
	else:
		res = (n - 1) * (m - 1) // 2 + (n + m) // 2
	print(res)


def light(n, m):
	if n % 2 == 0 or m % 2 == 0:
		return n * m // 2
	else:
		a = (n - 1) * m // 2 + (m - 1) // 2 + 1
		return a
t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(light(a, b))


import math
for case in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	print(math.ceil(n * m / 2))


for i in range(int(input())):
	(n, m) = map(int, input().split(' '))
	print(n * m // 2 if not n * m % 2 else n * m // 2 + 1)


for _ in range(int(input())):
	(n, m) = [int(num) for num in input().split()]
	k = 0
	k += n // 2 * m
	n -= 2 * (n // 2)
	if m % 2 == 0:
		k += m // 2 * n
	else:
		k += (m // 2 + 1) * n
	print(k)


import sys
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

def solve():
	(n, m) = I()
	ans = m // 2 * n + m % 2 * n // 2 + (n % 2 and m % 2)
	print(ans)
(t,) = I()
while t:
	t -= 1
	solve()


r = []

def init(a):
	for l in range(len(a)):
		a[l] = int(a[l])
	return a
t = int(input())
for i in range(t):
	cnt = 1
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	s = n * m
	if s % 2 == 0:
		r.append(int(s / 2))
	elif s == 1:
		r.append(1)
	else:
		s = (s - 1) / 2 + 1
		r.append(int(s))
for k in range(t):
	print(r[k])


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 and m == 1:
		print(1)
	else:
		c = n * m
		if c % 2 == 0:
			print(c // 2)
		else:
			print(c // 2 + 1)


t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	a = min(m, n)
	b = max(m, n)
	print(min(a // 2 * b + b // 2 + b % 2, (n // 2 + n % 2) * m, n * (m // 2 + m % 2)))


amount = int(input())
arr = []
for _ in range(amount):
	arr.append(list(map(int, input().split())))
for i in range(amount):
	(n, m) = (arr[i][0], arr[i][1])
	print((n * m + 1) // 2)


res = ''
for _ in range(int(input())):
	(r, c) = map(int, input().split())
	res += '%d\n' % ((r * c + 1) // 2)
print(res)


import sys
sys.setrecursionlimit(10000)

class Memoize:

	def __init__(self, f):
		self.f = f
		self.memo = {}

	def __call__(self, *args):
		if not args in self.memo:
			self.memo[args] = self.f(*args)
		return self.memo[args]

class Recurse(Exception):

	def __init__(self, *args, **kwargs):
		self.args = args
		self.kwargs = kwargs

def recurse(*args, **kwargs):
	raise Recurse(*args, **kwargs)

def tail_recursive(f):

	def decorated(*args, **kwargs):
		while True:
			try:
				return f(*args, **kwargs)
			except Recurse as r:
				args = r.args
				kwargs = r.kwargs
				continue
	return decorated
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 0 or m % 2 == 0:
		print(n * m // 2)
	else:
		ans = max((n - 1) * m // 2 + m // 2 + 1, n * (m - 1) // 2 + n // 2 + 1)
		print(ans)


import sys
from math import ceil
input = sys.stdin.readline

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())

def foo():
	(n, m) = invr()
	c = n * m
	print(c % 2 + c // 2)
t = inp()
for i in range(t):
	foo()


T = int(input())
for cs in range(T):
	(n, m) = map(int, input().split())
	if n % 2 == 0 or m % 2 == 0:
		print(n * m // 2)
	else:
		print((n - 1) // 2 * m + (m - 1) // 2 + 1)


for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	temp = n * m
	ans = temp // 2
	if temp % 2 == 1:
		ans += 1
	print(ans)


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		print(int(n * (m / 2)))
	else:
		wwf = math.ceil(n / 2)
		m = m - 1
		wwe = n * (m / 2)
		print(int(wwf + wwe))


t = int(input())
from math import *
for ab in range(t):
	(n, x) = list(map(int, input().split()))
	print(ceil(n * x / 2))


t = int(input())
b = []
for i in range(t):
	(n, m) = map(int, input().split())
	a = n * m
	if a % 2 == 0:
		b.append(a // 2)
	else:
		b.append(a // 2 + 1)
for i in b:
	print(i)


def func():
	(m, n) = map(int, input().split())
	if m % 2 != 0 and n % 2 != 0:
		ans = m * int(n / 2) + int((m + 1) / 2)
	else:
		ans = int(m * n / 2)
	print(ans)
t = int(input())
for _ in range(t):
	func()


from math import ceil

def solution():
	(n, m) = map(lambda x: int(x), input().split())
	print(ceil(n * m / 2))
t = int(input())
for _ in range(t):
	solution()


import math

def rn():
	a = int(input())
	return a

def rl():
	a = list(map(int, input().split()))
	return a
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print((n * m + 1) // 2)


import sys
input = sys.stdin.readline
t = int(input())
res = []
for i in range(t):
	(n, m) = map(int, input().split())
	ans = (n * m + 1) // 2
	res.append(str(ans))
print('\n'.join(res))


import math as mt
import sys, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for i in range(t):
	(n, m) = M()
	p1 = m * (n // 2)
	q1 = m // 2 * n
	if n % 2 == 1:
		p1 += (m + 1) // 2
	if m % 2 == 1:
		q1 += (n + 1) // 2
	print(min(p1, q1))


t = int(input())
for x in range(t):
	[n, m] = list(map(int, input().strip().split(' ')))
	if n % 2 == 1 and m % 2 == 1:
		print(int(n * m / 2) + 1)
	else:
		print(int(n * m / 2))


for _ in range(int(input())):
	(n, m) = list(map(int, input().split(' ', 1)))
	area = n * m
	res = int(area / 2)
	if area % 2 == 0:
		print(res)
	else:
		print(res + 1)


t = int(input())
while t > 0:
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	ans = 0
	if n % 2 == 0 and m % 2 == 0:
		ans = n * m // 2
	elif n % 2 == 1 and m % 2 == 1:
		ans = m // 2 * n + n // 2 + 1
	elif n % 2 == 0 and m % 2 == 1:
		ans = m // 2 * n + n // 2
	else:
		ans = n * m // 2
	print(ans)
	t = t - 1


t = int(input())
for i in range(t):
	mn = input()
	mn = mn.split()
	m = int(mn[0])
	n = int(mn[1])
	if m * n % 2 == 0:
		print(m * n // 2)
	else:
		print(m * n // 2 + 1)


t = int(input())
for i in range(t):
	array = list(map(int, input().split()))
	n = array[0]
	m = array[1]
	if n % 2 == 0:
		l = n * m / 2
	elif m % 2 == 0:
		l = n * m / 2
	else:
		l = (n * m + 1) / 2
	print(int(l))


from collections import Counter
from math import ceil
t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	if n % 2 == 0 or m % 2 == 0:
		print(int(n * m * 0.5))
	else:
		t = n * (m - 1)
		t //= 2
		t += ceil(n / 2)
		print(t)


n = int(input())
x = 0
Ans = []
for i in range(0, n):
	A = [int(i) for i in input().split()]
	Ans.append((A[0] * A[1] + 1) // 2)
print(*Ans, sep='\n', end='')


from math import *
import sys
input = sys.stdin.buffer.readline
a = int(input())
for _ in range(a):
	(b, c) = map(int, input().split())
	print(ceil(b * c / 2))


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	(n, m) = (min(n, m), max(n, m))
	c = 0
	if n == m:
		if n == 1:
			print(1)
		elif n % 2 == 0:
			print(n * n // 2)
		else:
			a = n * (m - 1)
			c = c + a // 2
			c = c + m // 2
			c = c + 1
			print(c)
	elif m * n % 2 == 0:
		print(m * n // 2)
	else:
		a = n * (m - 1)
		c = c + a // 2
		c = c + n // 2
		if n % 2 != 0:
			c += 1
		print(c)


for ttt in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 + m % 2 == 2:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)


import math
for _ in range(int(input())):
	(r, c) = [int(s) for s in input().split()]
	if r % 2 == 0:
		ans = r / 2 * c
	else:
		ans = (r - 1) / 2 * c
		ans = ans + math.ceil(c / 2)
	print(int(ans))


from math import ceil

def list_input():
	return list(map(int, input().split()))

def multiple_input():
	return map(int, input().split())
for _ in range(int(input())):
	(a, b) = multiple_input()
	print(ceil(a * b / 2))


from math import ceil

def solve():
	(n, m) = [int(v) for v in input().split()]
	rowans = int(ceil(n / 2) * m)
	colans = int(ceil(m / 2) * n)
	if n > 1 and m > 1:
		if n % 2 > 0:
			rowans -= m
			rowans += ceil(m / 2)
		if m % 2 > 0:
			colans -= n
			colans += ceil(n / 2)
	print(min(rowans, colans))
t = int(input())
for _ in range(t):
	solve()


T = int(input())
import math
for _ in range(T):
	(a, b) = map(int, input().split())
	print(math.ceil(a * b / 2))


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	k = n % 2
	l = n // 2 * m
	o = k * m % 2
	p = k * m // 2
	print(l + o + p)


import sys
from math import ceil, sqrt, sin, pi, tan
from collections import defaultdict
read = sys.stdin.buffer.readline
import heapq
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
primes = []

def ps(sm):
	if sm < 0:
		return 1
	sq = int(sqrt(sm))
	if sq * sq == sm:
		return 0
	return 1

def check(s, d):
	for el in s:
		if int(el) in d:
			return False
	return True
for _t in range(cin()):
	(n, m) = mi()
	print(ceil(m * n / 2))


from math import *
t = int(input())
while t != 0:
	t = t - 1
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
	else:
		print(n // 2 * m + ceil(m / 2))


t = int(input())
for test in range(t):
	(n, m) = [int(x) for x in input().split()]
	a = max(n, m)
	b = min(n, m)
	if a % 2 == 0:
		ans = a // 2
		ans *= b
	else:
		ans = (a - 1) // 2
		ans *= b
		ans += (b + 1) // 2
	print(ans)


a = int(input())
for _ in range(a):
	(n, m) = [int(x) for x in input().split()]
	if n % 2 == 0 or m % 2 == 0:
		print(m * n // 2)
	else:
		print((m * n + 1) // 2)


def func(nm):
	(n, m) = list(map(int, nm.split()))
	area = n * m
	if area % 2 == 0:
		return area // 2
	else:
		return area // 2 + 1

def main():
	t = int(input())
	for i in map(func, [input() for i in range(t)]):
		print(i)
main()


def solve():
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	flat_lights = (n / 2 if n % 2 == 0 else (n - 1) / 2) * m
	tall_lights = 0 if n % 2 == 0 else (m + 1) // 2
	return int(flat_lights + tall_lights)
cases = int(input())
ans = []
for case in range(cases):
	ans.append(solve())
for el in ans:
	print(el)


t = int(input())
for tc in range(t):
	(n, m) = [int(i) for i in input().split()]
	p = n * m
	if p % 2 == 0:
		print(p // 2)
	else:
		print(p // 2 + 1)


def answer(r, c):
	if c % 2 == 0:
		return c // 2 * r
	if r % 2 == 0:
		return r // 2 * c
	if r == 1:
		return c // 2 + 1
	if c == 1:
		return r // 2 + 1
	return (c - 1) // 2 * r + r // 2 + 1
testCount = int(input())
for _ in range(testCount):
	(r, c) = map(int, input().split())
	print(answer(r, c))


kl = int(input())
for l in range(kl):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		print(m // 2 * n)
	else:
		print(m // 2 * n + (n + 1) // 2)


m = int(input())
for i in range(m):
	(a, b) = input().split(' ')
	e = int(a) * int(b)
	if e % 2 == 0:
		print(e // 2)
	else:
		print(e // 2 + 1)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	p = a * b
	s = p // 2 + p % 2
	print(s)


def solve(l):
	r = l[0]
	c = l[1]
	if r * c % 2 == 0:
		print(r * c // 2)
	else:
		print((r * c - 1) // 2 + 1)

def main():
	for i in range(int(input())):
		solve([int(x) for x in input().split()])
main()


def nof(a):
	r = a[0]
	c = a[1]
	if r == 1 or c == 1:
		return int(r * c / 2) + r * c % 2
	elif r % 2 == 0:
		return r / 2 * c
	elif c % 2 == 0:
		return c / 2 * r
	else:
		return (r - 1) / 2 * c + (c + 1) / 2
n = int(input())
a = []
b = []
for i in range(n):
	a.append(list(map(int, input().split())))
	b.append(int(nof(a[i])))
for i in range(n):
	print(b[i])


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def main():
	try:
		(n, m) = In()
		if n & 1 != 1 and m & 1 != 1:
			print(n * (m // 2))
		elif n & 1 != 1 and m & 1 == 1:
			print(n * (m // 2) + n // 2)
		elif n & 1 == 1 and m & 1 == 1:
			print(n * (m // 2) + math.ceil(n / 2))
		else:
			print(n * (m // 2))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


for _ in range(int(input())):
	(m, n) = list(map(int, input().split()))
	count = 0
	if m % 2 == 0 or n % 2 == 0:
		count += m * n // 2
	else:
		count += (m * n + 1) // 2
	print(count)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	ans = n * m
	if ans % 2 == 1:
		ans += 1
	print(ans // 2)


import sys
import os

def changeStdioToFile():
	path = os.path.dirname(os.path.abspath(__file__))
	sys.stdin = open(f'{path}/input.txt', 'r')
	sys.stdout = open(f'{path}/output.txt', 'w')
t = 1
t = int(input())
for _ in range(t):
	(n, m) = [int(x) for x in input().split()]
	print(n * m // 2 + n * m % 2)


N_SETS = int(input())
for i in range(N_SETS):
	(a, b) = [int(x) for x in input().split()]
	s = a * b
	print(s // 2 + int(s % 2 != 0))


t = int(input())
while t > 0:
	t -= 1
	d = str(input())
	d1 = d.split()
	n = int(d1[0])
	m = int(d1[1])
	p = n * m
	ans = 0
	if p % 2 == 0:
		ans = p / 2
	else:
		p += 1
		ans = p / 2
	ans = int(ans)
	print(ans)


t = int(input())
for u in range(t):
	(r, c) = [int(x) for x in input().split()]
	l = c * (r // 2)
	if r % 2 != 0:
		l += c // 2
		if c % 2 != 0:
			l += 1
	print(l)


import sys
import math
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	(a, b) = map(int, input().split())
	print((1 + a * b) // 2)


for _ in range(int(input())):
	(r, c) = map(int, input().split())
	(r, c) = (min(r, c), max(r, c))
	cend = c // 2
	crem = c % 2
	lights = cend * r
	if crem == 1:
		lights += r // 2 + 1 * (r % 2)
	print(lights)


N = int(input())
for i in range(N):
	mass = list(map(int, input().split()))
	var1 = mass[0]
	var2 = mass[1]
	if var1 * var2 % 2 == 0:
		print(var1 * var2 // 2)
	else:
		print(var1 * var2 // 2 + 1)


t = int(input())
for x in range(t):
	a = 0
	(N, M) = map(int, input().split())
	i = N * M
	if i % 2 != 0:
		a += i // 2 + 1
	else:
		a += i // 2
	print(a)


try:
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a > b:
			m = a
			n = b
		else:
			m = b
			n = a
		c = 0
		if n % 2 == 0:
			c = m * (n // 2)
		elif m % 2 == 0:
			c = n * (m // 2)
		else:
			c = m * (n // 2)
			c += m // 2 + 1
		print(c)
except:
	print()


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (H, W) in Query:
	if H % 2 == 0:
		ans = H // 2 * W
	elif W % 2 == 0:
		ans = W // 2 * H
	else:
		ans = W * H // 2 + 1
	print(ans)


for _ in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	ans = 0
	if n % 2 == 0:
		ans = n // 2 * m
	elif m % 2 == 0:
		ans = m // 2 * n
	else:
		ans = n // 2 * m + m // 2 + 1
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = a * b
	d = c // 2
	if c % 2 == 0:
		print(d)
	else:
		print(d + 1)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	z = n * m
	if z % 2 != 0:
		print(z // 2 + 1)
	else:
		print(z // 2)


from sys import stdin, stdout
import sys
from math import *
input = stdin.readline
for __ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == m % 2 == 0:
		print(n // 2 * m)
	elif n % 2 == 1 and m % 2 == 1:
		print(m * (n // 2) + ceil(m / 2))
	elif m % 2 == 1:
		print(m * (n // 2))
	elif n % 2 == 1:
		print(n * (m // 2))


import sys
from math import ceil
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(ceil(n * m / 2))


import math

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())

def solve(n, m):
	ji = n * m
	if ji % 2 == 0:
		print(int(ji / 2))
	else:
		print(int(ji / 2 + 0.5))
n = inp()
for i in range(n):
	num = inlt()
	solve(num[0], num[1])


def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	(n, m) = list(map(int, input().split(' ')))
	lights = m * n
	if lights % 2 == 0:
		print(lights // 2)
	else:
		print(lights // 2 + 1)
main()


t = int(input())
anss = [0] * t
for i in range(t):
	(n, m) = map(int, input().split())
	anss[i] = (n * m + 1) // 2
for ans in anss:
	print(ans)


test = int(input())
for i in range(test):
	(rows, cols) = map(int, input().split(' '))
	squares = rows * cols
	if squares % 2 == 0:
		print(int(squares / 2))
	else:
		print(int(squares / 2 + 1))


import math as ma
t = int(input())
for _ in range(t):
	ans = 0
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		ans = int(n / 2) * m
	else:
		ans = int((n - 1) / 2)
		ans = ans * m
		ans += ma.ceil(m / 2)
	print(ans)


x = int(input())
l = []
for i in range(x):
	(n, m) = map(int, input().split(' '))
	temp = int(m / 2)
	temp = temp * n
	if m % 2:
		if n % 2:
			temp = temp + int(n / 2) + 1
		else:
			temp = temp + int(n / 2)
	l.append(temp)
for i in l:
	print(i)


from math import ceil
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l = ceil(x * y / 2)
	print(l)


import math
q = int(input())
while q:
	(n, m) = map(int, input().split())
	print(int(math.ceil(n * m / 2)))
	q -= 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a * b == 1:
		print(1)
	elif a * b % 2 == 0:
		print(a * b // 2)
	elif a * b % 2 != 0:
		print(a * b // 2 + 1)


from math import *

def r1(t):
	return t(input().strip())

def r2(t):
	return [t(i) for i in input().strip().split()]

def r3(t):
	return [t(i) for i in input().strip()]
for _ in range(int(input())):
	(n, m) = r2(int)
	print((n * m + 1) // 2)


test = int(input())

def paridade(x):
	if x % 2 == 0:
		return True
	else:
		return False
for x in range(test):
	(n, m) = map(int, input().split())
	if n == 1:
		if paridade(m):
			print(m // 2)
		else:
			print(m // 2 + 1)
	elif m == 1:
		if paridade(n):
			print(n // 2)
		else:
			print(n // 2 + 1)
	elif paridade(n) or paridade(m):
		if paridade(n):
			par = n
			impar = m
		else:
			par = m
			impar = n
		respostas = par // 2 * impar
		print(respostas)
	elif not paridade(n) and (not paridade(m)):
		resposta = n // 2 * m + m // 2 + 1
		print(resposta)


import math
_ = int(input())
for a in range(_):
	(x, y) = map(int, input().split())
	print(math.ceil(x * y / 2))


for _ in range(0, int(input())):
	(n, m) = map(int, input().split())
	a = n * m
	b = int(a / 2)
	c = a % 2
	print(b + c)


from math import ceil
for t in range(int(input())):
	(n, m) = [int(j) for j in input().split()]
	print(ceil(n * m / 2))


from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def is_it_local():
	script_dir = str(os.getcwd()).split('/')
	username = 'dipta007'
	return username in script_dir

def READ(fileName):
	if is_it_local():
		sys.stdin = open(f'./{fileName}', 'r')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if not is_it_local():
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')

def input1(type=int):
	return type(input())

def input2(type=int):
	[a, b] = list(map(type, input().split()))
	return (a, b)

def input3(type=int):
	[a, b, c] = list(map(type, input().split()))
	return (a, b, c)

def input_array(type=int):
	return list(map(type, input().split()))

def input_string():
	s = input()
	return list(s)

def main():
	t = input1()
	for ci in range(t):
		(n, m) = input2()
		if m > n:
			(n, m) = (m, n)
		res = 0
		if n == 1:
			res = 1
		else:
			rem = n % 2
			res = n // 2 * m
			res += n % 2 * (m // 2)
			res += n % 2 * (m % 2)
		print(res)
	pass
main()


def park_lighting():
	rows_columns = list(map(int, input().split()))
	cells = rows_columns[0] * rows_columns[1]
	if cells % 2 == 0:
		number_of_lights = cells / 2
	else:
		number_of_lights = (cells + 1) / 2
	print(int(number_of_lights))

def main():
	for case in range(int(input())):
		park_lighting()
main()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	sum1 = a * b
	lamps = sum1 // 2 + sum1 % 2
	print(lamps)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	a = m // 2
	b = m % 2
	ans = n * a
	if b > 0:
		c = n // 2
		d = n % 2
		if d > 0:
			c += 1
		ans += c
	print(ans)


import math
I = input
t = int(I())
while t > 0:
	t -= 1
	(n, m) = [int(x) for x in I().strip().split()]
	print(math.ceil(n * m / 2))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	x = n * m
	ans = x // 2 + x % 2
	print(ans)


test = int(input())
while test > 0:
	(n, m) = map(int, input().split(' '))
	if m % 2 == 0:
		print(n * (m // 2))
	elif n % 2 == 0:
		print(n * (m // 2) + n // 2)
	else:
		print(n * (m // 2) + n // 2 + 1)
	test -= 1


import math
T = int(input())
while T != 0:
	(n, m) = map(int, input().split())
	if n == 1:
		answer = math.ceil(m / 2)
	elif m == 1:
		answer = math.ceil(n / 2)
	else:
		answer = math.ceil(m * n / 2)
	print(answer)
	T -= 1


def lanterns(row_col):
	(row, col) = (row_col[0], row_col[1])
	lanterns = col // 2 * row
	if col % 2 != 0:
		lanterns += row // 2
		if row % 2 != 0:
			lanterns += 1
	return lanterns

def main(t, row_col):
	for i in range(t):
		print(lanterns(row_col[i]))
t = int(input())
row_col = []
for i in range(t):
	r_c = input()
	r_c = r_c.split()
	r_c = [int(v) for v in r_c]
	row_col.append(r_c)
main(t, row_col)


def last_fun(m):
	t = 0
	for i in range(1):
		if m % 2 != 0:
			x = m - 1
			t = t + x // 2 + 1
		else:
			x = m
			t = t + x // 2
	return t
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1:
		t = 0
		for i in range(n):
			if m % 2 != 0:
				x = m - 1
				t = t + x // 2 + 1
			else:
				x = m
				t = t + x // 2
	elif n % 2 != 0:
		n1 = n - 1
		fac = n1 // 2
		t = fac * m
		t = fac * m + last_fun(m)
	else:
		fac = n // 2
		t = fac * m
	print(t)


n = int(input())
for i in range(n):
	(x, y) = list(map(int, input().split()))
	cnt = 0
	t = x * y
	cnt = t // 2
	cnt += t % 2
	print(cnt)


import sys
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	(n, m) = Ri()
	if n == 1 and m == 1:
		print(1)
	elif n * m % 2 == 1:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)


import sys
input = sys.stdin.readline
print = sys.stdout.write
for _ in range(int(input())):
	(n, m) = map(int, sys.stdin.readline().split())
	if int(n * m / 2) * 2 != n * m:
		print(str(int(n * m / 2) + 1) + '\n')
	else:
		print(str(int(n * m / 2)) + '\n')


from sys import stdin
input = lambda : stdin.readline().rstrip('\r\n')
from collections import deque as que, defaultdict as vector
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
from types import GeneratorType
Testcase = inin()
for _ in range(Testcase):
	(n, m) = inar()
	a = n * m
	print(a // 2 + a % 2)


t = int(input())
count = 0
numbs = []
while t > 0:
	(n, m) = map(int, input().split())
	if n % 2 == 0 and m % 2 == 0:
		count += n * m // 2
		numbs.append(count)
	elif n % 2 != 0 and m % 2 != 0:
		count += (n - 1) * m // 2 + (m + 1) // 2
		numbs.append(count)
	elif n % 2 != 0 or n % 2 != 0:
		count += (n * m + 1) // 2
		numbs.append(count)
	else:
		count += n * m // 2
		numbs.append(count)
	count = 0
	t -= 1
for i in numbs:
	print(i)


t = int(input())
while t > 0:
	t -= 1
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	r = n * m
	if r % 2 == 0:
		print(int(r / 2))
	else:
		g = int(r / 2) + 1
		print(g)


for _ in range(int(input())):
	(n, m) = [int(i) for i in input().split()]
	if m % 2 == 0:
		k = m // 2
		cnt = n * k
	else:
		k = m // 2
		cnt = n * k
		if n % 2 == 0:
			cnt = cnt + n // 2
		else:
			cnt = cnt + n // 2 + 1
	print(cnt)


import math
import os
import random
import re
import sys
t = int(input())
arr = []
for i in range(t):
	inp = list(map(int, input().rstrip().split()))
	m = inp[0]
	n = inp[1]
	if m % 2 != 0 and n % 2 != 0:
		mx = max(m, n)
		mn = min(m, n)
		arr.append(int((mx + 1) / 2 * mn - mn // 2))
	elif m % 2 == 0 and n % 2 != 0:
		arr.append(int(m / 2 * n))
	elif m % 2 != 0 and n % 2 == 0:
		arr.append(int(n / 2 * m))
	else:
		arr.append(int(n * m / 2))
for j in range(t):
	print(str(arr[j]))


for _ in range(int(input())):
	(r, c) = list(map(int, input().split()))
	ans = r * c
	print((ans + 1) // 2)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 1 and m % 2 == 1:
		print(int((m - 1) / 2) * n + int(int(n / 2) + 1))
	else:
		print(int(n * m / 2))


inp = input
for _ in range(int(inp())):
	(n, m) = map(int, inp().strip().split(' '))
	if n == 1 or m == 1:
		mx = max(n, m)
		ans = mx // 2
		if mx % 2 == 1:
			ans += 1
		print(ans)
	elif n % 2 == 0 and m % 2 == 0:
		blc = n * m // 4
		print(blc * 2)
	elif n % 2 == 0:
		blc = n * (m - 1) // 4
		ans = blc * 2 + n // 2
		print(ans)
	elif m % 2 == 0:
		blc = (n - 1) * m // 4
		ans = blc * 2 + m // 2
		print(ans)
	else:
		blc = (n - 1) * (m - 1) // 4
		ans = blc * 2 + n // 2 + m // 2 + 1
		print(ans)


n = int(input())
lst = []
for i in range(n):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	if a % 2 == 0:
		lst.append((a // 2 + a % 2) * b)
	elif b % 2 == 0:
		lst.append((b // 2 + b % 2) * a)
	else:
		lst.append((a - 1) * (b - 1) // 2 + a // 2 + b // 2 + 1)
for i in lst:
	print(i)


a = []
for i in range(int(input())):
	(m, n) = map(int, input().split())
	a.append(int(m * n / 2) + m * n % 2)
for i in a:
	print(i)


def parse():
	tests = int(input())
	for t in range(tests):
		(n, m) = [int(num) for num in input().split()]
		total = 0
		if m % 2 == 0:
			total += n * (m // 2)
		else:
			total += n * (m // 2)
			total += n // 2
			if n % 2 != 0:
				total += 1
		print(total)
parse()


import math
t = int(input())
while t > 0:
	t -= 1
	(n, m) = map(int, input().split())
	print(math.floor((n * m + 1) / 2))


import math
for ii in range(int(input())):
	(n, m) = map(int, input().split())
	x = math.ceil(n * m / 2)
	print(x)


import math
t = input()
t = int(t)
for i in range(t):
	row = input()
	(n, m) = row.split()
	print(math.ceil(int(n) * int(m) / 2))


for s in [*open(0)][1:]:
	(n, m) = map(int, s.split())
	print(0 - -n * m // 2)


for i in range(int(input())):
	a = list(map(int, input().split()))
	aux = a[0] * a[1]
	if aux % 2 == 0:
		print(int(aux / 2))
	else:
		print(int((aux - 1) / 2 + 1))


x = int(input())
for num in range(0, x):
	grid = input().split()
	total = 0
	if int(grid[0]) * int(grid[1]) % 2 == 0:
		total = int(grid[0]) * int(grid[1]) / 2
	else:
		total = int(int(grid[0]) * int(grid[1]) / 2 + 0.5)
	print(int(total))


from math import ceil
for k in range(int(input())):
	(x, y) = map(int, input().split())
	res = min(x, y) * (max(x, y) // 2) + max(x, y) % 2 * ceil(min(x, y) / 2)
	print(res)


for j in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	m = n * m
	n = 1
	if n == 1:
		print(m - m // 2)


for t in range(int(input())):
	(n, m) = map(int, input().split(' '))
	lamps = 0
	if m % 2 == 0:
		lamps += m // 2
		lamps *= n
		print(lamps)
	else:
		lamps += (m - 1) // 2 * n
		if n % 2 == 0:
			lamps += n // 2
		else:
			lamps += n // 2 + 1
		print(lamps)


def read_ints():
	return [int(i) for i in input().strip().split()]
t = int(input())
for i in range(t):
	(n, m) = read_ints()
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


t = int(input())
c = 0
while t > 0:
	(n, m) = input().split(' ')
	n = int(n)
	m = int(m)
	s = n * m
	if s % 2 == 1:
		s + 1
		c = (s + 1) / 2
	else:
		c = s // 2
	print(int(c))
	t -= 1


from math import *
from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
	(n, m) = [int(x) for x in input().split()]
	a = max(n, m)
	b = min(n, m)
	if b % 2 == 0:
		ans = a * (b // 2)
	else:
		ans = a * ((b - 1) // 2) + (a + 1) // 2
	print(ans)
	t -= 1


def solve(row, col):
	prod = row * col
	if prod % 2 == 0:
		return prod / 2
	else:
		return prod // 2 + 1
testCases = int(input())
while testCases:
	(r, c) = map(int, input().split())
	print(int(solve(r, c)))
	testCases -= 1


from sys import stdin
t = int(input())
for _ in range(t):
	(n, m) = list(map(int, stdin.readline().rstrip().split(' ')))
	a = n * m
	lights = a // 2 + a % 2
	print(lights)


def min_lanterns(n, m):
	prod = n * m
	if prod % 2:
		ans = prod // 2 + 1
	else:
		ans = prod // 2
	return ans
t = int(input())
for _ in range(t):
	nm = input().split()
	n = int(nm[0])
	m = int(nm[1])
	print(min_lanterns(n, m))


import math
t = int(input())
for i in range(t):
	(n, m) = [int(i) for i in input().split()]
	if n % 2 and m % 2:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)


n = int(input())
c = []
for i in range(n):
	(a, b) = map(int, input().split())
	x = a * b // 2 + a * b % 2
	c.append(x)
for i in c:
	print(i)


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


t = int(input())
while t != 0:
	(a, m) = map(int, input().split())
	print(int((a * m + 1) / 2))
	t = t - 1


from math import ceil as c
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(c(a * b / 2))


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n < m:
		(n, m) = (m, n)
	answer = n // 2 * m
	if n % 2 != 0:
		answer += m // 2 + m % 2
	print(answer)


from sys import stdin
qwe = int(input())
for zxc in range(qwe):
	(aaf, jkl) = map(int, stdin.readline().split())
	cvb = 0
	for fgh in range(jkl):
		cvb = cvb + aaf
	xcvb = cvb % 2
	if xcvb == 1:
		tgb = cvb // 2 + 1
		print(tgb)
	else:
		print(cvb // 2)


def check(n):
	return n // 2
t = int(input())
while t:
	(m, n) = list(map(int, input().split()))
	print(check(m * n + 1))
	t -= 1


import math
for i in range(int(input())):
	(n, m) = map(int, input().split())
	print(math.floor((n * m + 1) / 2))


for i in range(int(input())):
	(n, m) = map(int, input().split())
	x = n * m
	if n == 1 and m == 1 or (n == 1 and m == 2) or (n == 2 and m == 1):
		print(1)
	elif x % 2 != 0:
		print(x // 2 + 1)
	elif x % 2 == 0:
		print(x // 2)


r = int(input())
for t in range(0, r):
	(n, m) = map(int, input().split())
	n = n * m
	print(n // 2 + n % 2)


import sys
import os
import heapq
import math
try:
	path = './file/input.txt'
	if os.path.exists(path):
		sys.stdin = open(path, 'r')
except:
	pass
t = int(input())

def printd(value):
	pass
for _ in range(t):
	arr = list(map(int, input().split(' ')))
	(n, m) = (arr[0], arr[1])
	result = 0
	if m % 2 == 1:
		result += int(n / 2)
		if n % 2 == 1:
			result += 1
	result += n * int(m / 2)
	print(result)


t = int(input())
(n, m) = (0, 0)
while t >= 1:
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	ans = int(n / 2) * m
	if n % 2:
		ans += int(m / 2)
		ans += int(m % 2 > 0)
	print(int(ans))
	t = t - 1


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	total = 0
	total += m * (n // 2)
	if n % 2:
		total += (m + 1) // 2
	print(total)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ans = m * n // 2
	ans += n & 1 and m & 1
	print(ans)


def Iint():
	return int(input())

def Imap():
	return map(int, input().split())

def main():
	t = Iint()
	for _ in range(t):
		(n, m) = Imap()
		if n % 2 == 0 or m % 2 == 0:
			print(n * m // 2)
		else:
			print(n * m // 2 + 1)
main()


t = int(input())
for tes in range(t):
	(a, b) = map(int, input().split())
	n = a * b
	if n % 2 == 0:
		print(n // 2)
	else:
		print(n // 2 + 1)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log, pi, sin
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(n, m) = sp()
	(n, m) = (min(n, m), max(n, m))
	if n == 1:
		out(ceil(m / 2))
		continue
	answer = n * m // (n * 2) * n
	temp = n * m % (n * 2)
	answer += ceil(temp / 2)
	out(answer)


from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
for CASES in range(int(input())):
	(n, m) = map(int, input().split())
	print((n * m + 1) // 2)


t = int(input())
for q in range(t):
	[m, n] = [int(x) for x in input().split()]
	if m % 2 != 0 or n % 2 != 0:
		c = m * (n - 1) // 2 + m // 2 + m % 2
	else:
		c = m * n // 2
	print(c)


import math
t = int(input())
ans = []
for i in range(t):
	(n, m) = map(int, input().split())
	ans.append(math.ceil(n * m / 2))
for i in range(t):
	print(ans[i])


from math import floor, ceil
test_case = int(input())
my_list = []
for i in range(test_case):
	my_list.append([int(j) for j in input().split()])
	print(ceil(my_list[i][0] * my_list[i][1] / 2))


import sys
lines = sys.stdin.readlines()
T = int(lines[0].strip())
for t in range(1, T + 1):
	(m, n) = map(int, lines[t].strip().split(' '))
	if m % 2 == 0 or n % 2 == 0:
		if m % 2 == 0:
			print(m // 2 * n)
		else:
			print(n // 2 * m)
	else:
		print(1 + m // 2 * n + n // 2)


t = int(input())
for i in range(t):
	(n, m) = [int(s) for s in input().split()]
	if n % 2 == 0:
		print(n // 2 * m)
	elif m % 2 == 0:
		print(m // 2 * n)
	else:
		print((m - 1) // 2 * n + (n // 2 + n % 2))


import math
t = int(input())
while t:
	t -= 1
	data = list(map(int, input().split()))
	print(int(math.ceil(data[0] * data[1] / 2)))


num = int(input())
for i in range(num):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	tmp = n * k
	if tmp % 2 == 0:
		print(int(tmp / 2))
	else:
		print(int(tmp / 2) + 1)


for ii in range(int(input())):
	(n, m) = map(int, input().split())
	print(n * m // 2 + (n % 2 + m % 2) // 2)


import sys
input = sys.stdin.buffer.readline

def print(val):
	sys.stdout.write(str(val) + '\n')
for _ in range(int(input())):
	(m, n) = [int(i) for i in input().split()]
	a = m * n
	print((a + 1) // 2)


import math
T = int(input())
for t in range(T):
	(n, m) = map(int, input().strip().split())
	print(int(math.ceil(n * m / 2)))


def solve():
	t = int(input())
	while t > 0:
		(r, c) = map(int, input().strip().split())
		m = r * c
		print(m // 2 + m % 2)
		t -= 1
solve()


t = int(input())
pivot = 0
rpta = []
for i in range(t):
	n = list(map(int, input().split()))
	pivot = n[0] * n[1]
	if pivot % 2 == 0:
		rpta.append(pivot // 2)
	else:
		rpta.append((pivot + 1) // 2)
for aaa in rpta:
	print(aaa)


T = int(input())
for _ in range(T):
	(n, m) = [int(x) for x in input().split()]
	result = (n * m + 1) // 2
	print(result)


def nod(a, b):
	while a != b:
		(a, b) = (max(a, b), min(a, b))
		if a % b == 0:
			a -= (a // b - 1) * b
		else:
			a -= a // b * b
	return a
for t in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	s = n * m
	print(s // 2 if s % 2 == 0 else s // 2 + 1)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	p = m * n
	if p % 2 == 0:
		print(p // 2)
	else:
		print(p // 2 + 1)


import math
for _ in range(int(input())):
	temp = map(int, input().split())
	(n, m) = temp
	if n % 2 == 0:
		print(int(n / 2) * m)
	elif m % 2 == 0:
		print(int(m / 2) * n)
	else:
		print(int((max(n, m) - 1) / 2) * min(n, m) + math.ceil(min(n, m) / 2))


import math

def lighting(l):
	lights = 0
	if int(l[0]) % 2 != 0:
		lights = int((int(l[0]) - 1) / 2) * int(l[1]) + math.ceil(int(l[1]) / 2)
	else:
		lights = int(int(l[0]) / 2) * int(l[1])
	print(lights)
t = int(input())
l = []
ls = []
for i in range(t):
	l.append(input())
for i in range(t):
	ls.append(l[i].split())
for i in range(t):
	lighting(ls[i])


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	a = [int(x) for x in input().split()]
	if a[0] % 2 == 0 or a[1] % 2 == 0:
		print(a[0] * a[1] // 2)
	else:
		print((a[0] - 1) * (a[1] - 1) // 2 + a[0] // 2 + a[1] // 2 + 1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
		continue
	if m % 2 == 0:
		print(m // 2 * n)
		continue
	print(n // 2 * m + m // 2 + 1)


T = int(input())
for i in range(T):
	(n, m) = map(int, input().split())
	s = int(n * m / 2)
	if n * m % 2 == 0:
		print(s)
	else:
		print(s + 1)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	count = 0
	count += m * (n // 2)
	count += (m + 1) // 2 * (n % 2)
	print(count)


for t in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if m % 2 == 0 and n % 2 == 0 or (m % 2 == 0 and n % 2 != 0):
		ans = n * m // 2
	elif m % 2 != 0 and n % 2 == 0:
		ans = m * (n // 2)
	else:
		ans = (m - 1) // 2 * n + (n - 1) // 2 + 1
	print(ans)


def main():
	times = int(input())
	for i in range(times):
		(x, y) = map(int, input().split())
		s = x * y
		print(s // 2 + s % 2)
main()


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	num = n * m
	ss = num // 2 + (num - num // 2 * 2)
	print(ss)


def ans(a, b):
	return math.ceil(a * b / 2)
import math
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print(ans(a, b))
	t -= 1


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	mi = min(n, m)
	ma = max(n, m)
	if ma % 2 == 0:
		print(mi * (ma // 2))
	else:
		c = mi * (ma // 2) + mi // 2 + mi % 2
		print(c)


n = int(input())
for i in range(n):
	(n, m) = (int(j) for j in input().split())
	if n % 2 == 0 or m % 2 == 0:
		print(m * n // 2)
	else:
		print(m * n // 2 + 1)


t = int(input())
for _ in range(t):
	l1 = input().split(' ')
	n = int(l1[0])
	m = int(l1[1])
	if n % 2 == 0 and m % 2 == 0:
		print(int(m * n * 0.5))
	elif n % 2 == 0 and m % 2 != 0:
		print(int(n * (m - 1) * 0.5) + int(n * 0.5))
	elif n % 2 != 0 and m % 2 == 0:
		print(int(m * (n - 1) * 0.5) + int(m * 0.5))
	else:
		print(int(n * (m - 1) * 0.5) + int((n - 1) * 0.5) + 1)


for i in range(int(input())):
	A = input().split()
	a = int(A[0]) * int(A[1])
	if a % 2 == 0:
		print(a // 2)
	else:
		print(a // 2 + 1)


from math import ceil
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	s = tuple(map(int, input().split()))
	(n, m) = (max(s), min(s))
	cnt = n * (m // 2)
	if m % 2:
		cnt += n // 2 + n % 2
	print(cnt)


import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = a * b / 2
	print(int(math.ceil(c)))


import math as mt

def time(nk):
	return mt.ceil(nk[0] * nk[1] * 0.5)
t = int(input())
ans = []
for i in range(t):
	nk = list(map(int, input().rstrip().split()))
	r = time(nk)
	ans.append(r)
for i in ans:
	print(i)


from sys import stdin
n = int(stdin.readline().strip())
for i in range(n):
	(n, m) = map(int, stdin.readline().strip().split())
	if n % 2 == 0:
		ans = n // 2 * m
		print(ans)
	elif m % 2 == 0:
		ans = m // 2 * n
		print(ans)
	else:
		ans = (n + m) // 2
		ans += (n - 1) // 2 * (m - 1)
		print(ans)


def solve(height, length):
	count = 0
	if height % 2 == 0 or length % 2 == 0:
		count += height * length // 2
	else:
		count += (height * length + 1) // 2
	return count
t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	print(solve(n, m))


t = int(input())
for test in range(1, t + 1):
	(a1, a2) = map(int, input().rstrip().split())
	c = max(a1, a2)
	r = min(a1, a2)
	ans = 0
	if c % 2 == 0:
		ans = c // 2 * r
	else:
		ans = (c - 1) // 2 * r
		if r % 2 == 0:
			ans += r // 2
		else:
			ans += r // 2 + 1
	print(ans)


t = int(input())
while t > 0:
	(n, m) = [int(k) for k in input().split()]
	block = n * m
	if block % 2 != 0:
		light = int(block / 2) + 1
	else:
		light = int(block / 2)
	print(light)
	t = t - 1


from math import *
from copy import *
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	print(ceil(a * b / 2))


import math
T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	if n % 2 == 1:
		ans = m * (n - 1) // 2
		ans += math.ceil(m / 2)
	elif m % 2 == 1:
		ans = n * (m - 1) // 2
		ans += math.ceil(n / 2)
	else:
		ans = n * m // 2
	print(ans)


t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	if n == 1 and m == 1:
		print(1)
	elif n == 1 and m % 2 == 1 or (m == 1 and n % 2 == 1):
		print(max(n, m) // 2 + 1)
	elif n == 1 and m % 2 == 0 or (m == 1 and n % 2 == 0):
		print(max(n, m) // 2)
	else:
		p = max(n, m)
		p1 = min(n, m)
		r = p * (p1 // 2)
		if p1 % 2 == 1 and p % 2 == 1:
			print(p // 2 + 1 + r)
		elif p1 % 2 == 1 and p % 2 == 0:
			print(p // 2 + r)
		elif p1 % 2 == 0:
			print(r)


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	for _ in range(int(input())):
		ans = 0
		(n, m) = map(int, input().split())
		ans += m // 2 * n
		if m % 2 == 1:
			ans += n // 2
			if n % 2 == 1:
				ans += 1
		print(ans)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	squares = a * b
	res = math.ceil(a * b / 2)
	print(res)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(n, m) = iia()
	if n == m == 1:
		print(1)
	else:
		res = m // 2 * n
		if m % 2 != 0:
			print(res + ceil(n / 2))
		else:
			print(res)


def solve():
	arr = list(map(int, input().split()))
	m = arr[0]
	n = arr[1]
	ans = int((m * n + 1) / 2)
	print(ans)
T = int(input())
while T:
	solve()
	T = T - 1


t = int(input())
for case in range(t):
	(n, m) = map(int, input().split(' '))
	if m % 2 == 0:
		print(n * (m // 2))
	elif n % 2 == 0:
		print(n * (m // 2) + n // 2)
	elif n % 2 == 1:
		print(n * (m // 2) + 1 + n // 2)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	small = min(n, m)
	large = max(n, m)
	ans = small // 2 * large + (large // 2 + large % 2) * (small % 2)
	print(ans)


import math
k = int(input())
for i in range(k):
	(a, b) = map(int, input().split())
	op = a * b
	kop = math.ceil(op / 2)
	print(kop)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, functools

def solve(line):
	(n, m) = map(int, line.split())
	if n % 2 == 0:
		return m * (n // 2)
	if m % 2 == 0:
		return n * (m // 2)
	return n // 2 * m + m // 2 + 1
T = int(sys.stdin.readline())
t = 0
while True:
	line = sys.stdin.readline().rstrip()
	if not line:
		break
	print(solve(line))
	t += 1


import math
for _ in range(int(input())):
	nums = list(map(int, input().split()))
	nm = nums[0] * nums[1]
	print(math.ceil(nm / 2))


import math
for i in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	if m == 1:
		print(math.ceil(n / 2))
	elif m == 2:
		print(n)
	else:
		a = m // 2
		b = m % 2
		z = a * n + b * math.ceil(n / 2)
		print(z)


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	sum = 0
	sum = a * b
	if sum % 2 == 0:
		print(sum // 2)
	else:
		sum1 = sum // 2
		sum2 = sum % 2
		print(sum1 + sum2)


t = int(input())
for i in range(t):
	(r, c) = map(int, input().split())
	print((r * c + 1) // 2)


def park_lights(n, m):
	row_cell = 0
	res = 0
	sin_cell = 0
	col_cell = 0
	if n % 2 == 1:
		sin_cell = m % 2
		col_cell = m // 2
		row_cell = col_cell + sin_cell
	res = n // 2 * m + row_cell
	return res
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print(park_lights(n, m))


for run in range(int(input())):
	(n, m) = map(int, input().split())
	print(int((n * m + 1) / 2))


from sys import stdin
import math
a = int(stdin.readline())
for b in range(0, a):
	A = stdin.readline().split()
	J = int(A[0]) * int(A[1])
	print(int(math.ceil(J / 2)))


import math

def solve(m, n):
	return int(math.ceil(m * n / 2.0))

def main():
	t = int(input())
	while t > 0:
		t -= 1
		(m, n) = map(int, input().split())
		print(solve(m, n))
main()


from math import ceil, sqrt, log2, floor, pi
for _ in range(int(input())):
	(A, B) = map(int, input().split())
	print(int(ceil(A * B / 2)))


t = int(input())
for i in range(t):
	nm = list(map(int, input().split()))
	n = nm[0]
	m = nm[1]
	o = (n * m + 1) // 2
	print(o)


def solve():
	ans = n * m // 2 + n * m % 2
	print(ans)
	return
t = int(input())
for tt in range(1, t + 1):
	(n, m) = [int(i) for i in input().split(' ')]
	solve()


for i in range(int(input())):
	a = list(map(int, input().strip().split()))[:2]
	c = a[0] * a[1]
	if c % 2 == 0:
		print(int(c / 2))
	else:
		c = int(c / 2) + 1
		print(c)


import os
import sys
import io
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for t in range(int(input())):
	(a, b) = map(int, input().split())
	print(math.ceil(a * b / 2))


for t in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print((a * b + 1) // 2)


import math
c = int(input())
a = []
b = []
for i in range(c):
	(n, m) = input().split(' ')
	a.append(int(n))
	b.append(int(m))
for i in range(c):
	if a[i] * b[i] % 2 == 0:
		print(int(a[i] * b[i] / 2))
	else:
		print(int(math.ceil(a[i] * b[i] / 2)))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = a * b
	if c % 2 == 1:
		c += 1
	print(c // 2)


import math
t = int(input())
for u in range(t):
	(n, k) = list(map(int, input().split()))
	print(math.ceil(n * k / 2))


k = int(input())
for i in range(k):
	(n, m) = map(int, input().split())
	print(m * n // 2 + m * n % 2)


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque

def solution(n, m):
	return (n * m + 1) // 2

def main():
	T = read_int()
	for i in range(T):
		(n, m) = read_int_array()
		x = solution(n, m)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


r = int(input())
for i in range(r):
	(m, n) = map(lambda x: int(x), input().split())
	if m % 2 != 0 and m % 2 != 0 and (m * n != 1):
		print(int((m * n + 1) / 2))
	elif m * n == 1:
		print(1)
	else:
		print(int(m * n / 2))


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	mx = 0
	mn = 0
	lights = 0
	mx = max(n, m)
	mn = min(m, n)
	if mx % 2 == 0:
		lights = int(mx / 2) * mn
	elif mn % 2 == 0:
		lights = int(mx / 2) * mn + int(mn / 2)
	else:
		lights = int(mx / 2) * mn + int(mn / 2) + 1
	print(int(lights))


for _ in range(0, int(input())):
	nm = list(map(int, input().split()))
	n = nm[0]
	m = nm[1]
	if n % 2 == 0 or m % 2 == 0:
		print(round(n * m / 2))
	else:
		if m < n:
			temp = m
			m = n
			n = temp
		ans = (m - 1) * n / 2 + (n - 1) / 2 + 1
		print(round(ans))


x = int(input())
for _ in range(x):
	(a, b) = map(int, input().split())
	small = lambda x, y: x if x < y else y
	s = small(a, b)
	if s >= 2:
		print(s // 2 * a * b // s + (s % 2 * (a * b // s) // 2 + s % 2 * (a * b // s) % 2))
	else:
		print(a * b // s // 2 + a * b // s % 2)


tc = int(input())
from math import ceil
for _ in range(tc):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
	else:
		print((n - 1) // 2 * m + ceil(m / 2))


import sys
t = int(input())
for i in range(t):
	(x, y) = map(int, sys.stdin.readline().strip().split())
	if x * y % 2 == 0:
		print(int(x * y / 2))
	else:
		print(int(x * y / 2 + 1))


from sys import stdin, stdout
import collections
import heapq
import itertools
import functools
import math
import operator
import string
ALPHABET = string.ascii_lowercase
DIGITS = string.digits

def read_line():
	return stdin.readline().strip()

def read_int():
	return int(read_line())

def read_arr():
	return read_line().split(' ')

def read_int_arr():
	return [int(x) for x in read_arr()]

def query_interactive(s):
	print(s)
	stdout.flush()

def solve():
	(n, m) = read_int_arr()
	(en, em) = (n - n % 2, m - m % 2)
	opt_e = en * em // 2
	opt_o = (n % 2 * m + m % 2 * n) // 2
	print(opt_e + opt_o)

def main():
	T = 1
	T = read_int()
	for _ in range(T):
		solve()
main()


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	if m * n % 2 == 0:
		print(m * n // 2)
	else:
		print(m * n // 2 + 1)
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
tc = int(input())
for zzz in range(tc):
	(n, m) = map(int, input().split())
	l = n * m
	if l % 2 == 0:
		print(l // 2)
	else:
		print(l // 2 + 1)


def solve():
	(x, y) = map(int, input().split())
	print((x * y + 1) // 2)
for i in range(int(input())):
	solve()


t = int(input())
for tc in range(t):
	(n, m) = map(int, input().split())
	x = n * m + 1
	print(x // 2)


import sys, heapq
from collections import *
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split(' '))
		total = n * m
		print(total // 2 + (total & 1))
main()


n = int(input())
for n_r in range(n):
	mn = input().split()
	m = int(mn[0])
	n = int(mn[1])
	print(m * n // 2 + (m * n % 2 > 0))


t = int(input())
while t > 0:
	[a, b] = list(map(int, input().split()))
	print((a * b + 1) // 2)
	t -= 1


def rnum():
	return map(int, input().split())

def solve():
	(a, b) = rnum()
	print(a * b // 2 + a * b % 2)

def main():
	t = int(input())
	for i in range(t):
		solve()
main()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	r = a // 2
	ans = r * b
	if a % 2 == 1:
		ans += b // 2
		if b % 2 == 1:
			ans += 1
	print(ans)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = max(n, m)
	b = min(n, m)
	p = a * (b // 2)
	if b % 2 == 1:
		p += math.ceil(a / 2)
	print(p)


T = int(input())
for t in range(T):
	(N, M) = list(map(int, input().split()))
	r = M // 2
	res = r * N
	if M % 2 == 1:
		l = N // 2
		res += l
		if N % 2 == 1:
			res += 1
	print(res)


n = int(input())
for i in range(n):
	k = input()
	h = k.split(' ')
	g = int(h[0]) * int(h[1])
	if g % 2 == 0:
		print(g // 2)
	else:
		print((g + 1) // 2)


import math
t = int(input())
for dud in range(t):
	(n, m) = [int(x) for x in input().split()]
	print(math.ceil(n * m / 2))


import math
for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	m1 = max(n, m)
	n1 = min(n, m)
	n = n1
	m = m1
	print(math.floor(m / 2) * n + (m - math.floor(m / 2) * 2) * math.ceil(n / 2))


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	(n, m) = num_input()
	print(math.ceil(n * m / 2))
t = int(input())
for _ in range(t):
	solve()


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ntest = int(stdin.readline())
	for testcase in range(ntest):
		(n, m) = [int(x) for x in stdin.readline().split()]
		stdout.write('%d\n' % ((n * m + 1) // 2))
	return 0
main()


import sys
tests = int(sys.stdin.readline().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 m % 2 == 0:
		print(n * m // 2)
	else:
		print((n * m + 1) // 2)


import math

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		print(math.ceil(n * m / 2))
main()


t = int(input())
s = 0
for i in range(t):
	(n, m) = map(int, input().split())
	s = (n * m + 1) // 2
	print(s)


for T in range(int(input())):
	(n, m) = map(int, input().split())
	x = n * m
	if x % 2 == 0:
		print(x // 2)
	else:
		print(x // 2 + 1)


from math import *
from collections import *
from operator import itemgetter
import bisect
from heapq import *
i = lambda : input()
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for _ in range(t):
	(n, m) = iia()
	x = n // 2 * m
	y = n * (m // 2)
	if n % 2:
		x += ceil(m / 2)
	if m % 2:
		y += ceil(n / 2)
	print(min(x, y))


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline

def I():
	return list(map(int, inp().split()))
for _ in range(I()[0]):
	(n, m) = I()
	z = m // 2 * n
	y = m % 2
	z += y * n // 2 + n % 2 * y
	print(z)


import math
for ttt in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(math.ceil(a * b / 2))


def solve(m, n):
	ans = 0
	if m % 2 == 1 and n % 2 == 1:
		ans = n * (m // 2) + n // 2 + 1
	elif m % 2 == 1:
		ans = n // 2 * m
	else:
		ans = m // 2 * n
	return ans
t = int(input())
for ___ in range(t):
	inp_arr = input().split(' ')
	(m, n) = [int(k) for k in inp_arr]
	if m % 2 == 1:
		(m, n) = (n, m)
	answer = solve(m, n)
	print(answer)


tc = int(input())
la = []
for i in range(tc):
	(n, m) = map(int, input().split())
	dim = n * m
	if dim % 2 == 1:
		la.append(int((dim + 1) / 2))
	else:
		la.append(int(dim // 2))
print(*la, sep='\n')


n = int(input())
for x in range(0, n):
	(a, b) = map(int, input().split(' '))
	if a % 2 == 0:
		print(b * (a // 2))
	elif b % 2 == 0:
		print(a // 2 * b + b // 2)
	else:
		print(a // 2 * b + (b // 2 + 1))


from math import ceil
t = int(input())
l = []
for i in range(t):
	l.append(list(map(int, input().split())))
for i in l:
	prod = 1
	for j in i:
		prod = j * prod
	print(ceil(prod / 2))


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 1 and m % 2 == 1:
		ans = min(m * (n - 1) / 2 + math.ceil(m / 2), n * (m - 1) / 2 + math.ceil(n / 2))
	else:
		ans = m * n / 2
	print(int(ans))


cases = int(input())
for i in range(cases):
	(n, m) = map(int, input().split())
	squares = n * m
	if squares % 2 == 0:
		print(squares // 2)
	else:
		print(squares // 2 + 1)


t = int(input())
for q in range(t):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		print(n * (m // 2))
	else:
		ans = n * (m - 1) // 2 + n // 2
		if n % 2 != 0:
			ans += 1
		print(ans)


from math import ceil
for k in range(int(input())):
	(n, m) = list(map(int, input().split()))
	print(ceil(n * m / 2))


import sys
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print((n * m - 1) // 2 + 1)


from math import ceil
t = int(input())
A = []
for i in range(0, t):
	s = input()
	split = s.split(' ')
	split2 = [int(i) for i in split]
	A.append(split2)
for i in range(0, t):
	n = A[i][0]
	m = A[i][1]
	print(int(ceil(m * n / 2)))


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = n * m
	c = a // 2
	if a % 2 != 0:
		c += 1
	print(c)


def ParkLighting(n, m):
	if n % 2 != 0 and m % 2 != 0:
		return int((n * m + 1) / 2)
	else:
		return int(n * m / 2)
Lista = []
total = int(input())
for i in range(total):
	All = [int(i) for i in input().split()]
	Lista.append(All)
for j in Lista:
	print(ParkLighting(j[0], j[1]))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	(x, y) = map(int, stdin.readline().split())
	mul = x * y
	if mul % 2 == 0:
		r = int(mul / 2)
	else:
		r = int(mul / 2) + 1
	print(r)


a = int(input())
q = []
for b in range(a):
	(n, m) = map(int, input().split())
	s = n * m
	d = (s + 1) // 2
	q.append(d)
for f in q:
	print(f)


a = int(input())
for _ in range(a):
	(r, c) = map(int, input().split())
	b = r * c
	rem = b % 2
	val = b // 2 + rem
	print(val)


import math as mt
import sys
from collections import *
inf = float('inf')

def ii():
	return int(input())

def mii():
	return map(int, input().split())

def lii():
	return list(map(int, input().split()))

def gmat(n, m):
	return [[0] * m for _ in range(n)]

def imat(n):
	return [list(mii()) for _ in range(n)]
try:
	sys.stdin = open('data\\a.in', 'r')
	input = sys.stdin.readline
except:
	pass
for _ in range(ii()):
	(a, b) = mii()
	print(mt.ceil(a * b / 2))


import sys
input = sys.stdin.readline

def solve(n, m):
	return (m * n + 1) // 2
t = int(input())
for _ in range(t):
	[n, m] = map(int, input().split())
	print(solve(n, m))


import sys
input = sys.stdin.readline
for f in range(int(input())):
	(n, m) = map(int, input().split())
	x = n * m
	x += 1
	x //= 2
	print(x)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		(a, b) = LI()
		ans.append((a * b + 1) // 2)
	for x in ans:
		print(x)
main()


try:
	z = int(input())
	for i in range(z):
		(n, m) = map(int, input().split())
		p = n * m
		if p == 1:
			print('1')
		elif p % 2 == 0:
			print(int(p / 2))
		elif p % 2 != 0:
			y = int(p / 2)
			y1 = y + 1
			print(y1)
except:
	pass


from collections import defaultdict as dd
import math
import sys
import string
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
q = nn()
for _ in range(q):
	(n, m) = mi()
	print((n * m + 1) // 2)


tc = int(input())
for i in range(tc):
	x = list(map(int, input().split()))
	prod = x[0] * x[1]
	print(int(prod / 2) + int(prod % 2))


import math
t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	if a * b % 2:
		print(a * b // 2 + 1)
	else:
		print(a * b // 2)


t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	prod = int(m * n)
	print(int((prod + prod % 2) / 2))


number_of_tests = int(input())
for i in range(number_of_tests):
	(x, y) = [int(i) for i in input().split()]
	if x * y % 2 == 0:
		print(x * y // 2)
	else:
		print(x * y // 2 + 1)


import math
t = int(input())
while t != 0:
	(n, m) = map(int, input().split())
	p = n * m
	if p % 2 == 0:
		print(p // 2)
	else:
		print((p + 1) // 2)
	t -= 1


import sys
import heapq
import random
import collections

def solve(a, b):
	console('----- solving ------')
	if a % 2 == 0 and b % 2 == 0:
		return a * b // 2
	if a % 2 == 1 and b % 2 == 1:
		return a * (b - 1) // 2 + a // 2 + 1
	else:
		return a * b // 2

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
for case_num in range(int(input())):
	(a, b) = list(map(int, input().split()))
	res = solve(a, b)
	print(res)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	p = max(n, m)
	q = min(n, m)
	if p % 2 == 0:
		print(p // 2 * q)
	else:
		print(p // 2 * q + (q + 1) // 2)


t = int(input())
for _ in range(t):
	(row, col) = map(int, input().rstrip().split())
	if row == col == 1:
		print(1)
		continue
	if col == 1 and row > 1:
		(row, col) = (col, row)
	if row % 2 == 0:
		print(row // 2 * col)
	else:
		ans = (row - 1) // 2 * col
		if col % 2 == 0:
			ans += col // 2
		else:
			ans += (col + 1) // 2
		print(ans)


(T, *NM) = map(int, open(0).read().split())
for (n, m) in zip(*[iter(NM)] * 2):
	print(-(-n * m // 2))


import sys
import math
t = int(input())
for test in range(1, t + 1):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
		continue
	if m % 2 == 0:
		print(m // 2 * n)
		continue
	print(m * (n - 1) // 2 + m // 2 + 1)


def totalLights(n, m):
	if n % 2 == 0 and m % 2 == 0:
		return n // 2 * m
	else:
		if n % 2 != 0 and m % 2 == 0:
			return n * (m // 2)
		if n % 2 == 0 and m % 2 != 0:
			newM = m - 1
			eveMat = n // 2 * newM
			return eveMat + n // 2
		else:
			subEven = totalLights(n, m - 1)
			return subEven + n // 2 + 1
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(totalLights(n, m))


from sys import stdin
from math import ceil, log
input = stdin.readline

def list_input():
	return list(map(int, input().split()))

def sep_input():
	return map(int, input().split())
for _ in range(int(input())):
	(n, m) = sep_input()
	print(ceil(n * m / 2))


import math
t = int(input())
output = []
for i in range(t):
	(m, n) = [int(q) for q in input().split()]
	output.append(math.ceil(m * n / 2))
for i in output:
	print(i)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	mul = n * m
	re = mul % 2
	ans = mul // 2 + re
	print(ans)


t = int(input())
ans = []
for i in range(t):
	(n, m) = tuple(map(int, input().split()))
	add = 0
	if n * m % 2 == 0:
		add = n * m // 2
	else:
		add = n * m // 2 + 1
	ans.append(add)
for case in ans:
	print(case)


for i in range(int(input())):
	(n, m) = [int(i) for i in input().split()]
	(n, m) = (max(n, m), min(n, m))
	ans = 0
	if m > 1:
		ans += n * (m // 2)
		m = m % 2
	if m == 1:
		ans += n // 2 + n % 2
	print(ans)


import math as m
try:
	t = int(input())
	for i in range(t):
		b = input().split()
		n = int(b[0])
		m = int(b[1])
		if n % 2 == 0:
			print(int(n / 2) * m)
		elif m % 2 == 0:
			print(int(m / 2) * n)
		else:
			M = max(m, n)
			m = min(m, n)
			print(int((M - 1) / 2) * m + (int(m / 2) + m % 2))
except EOFError:
	exit(0)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, M) = [int(x) for x in input().split()]
		if N % 2 == 0:
			print(M * (N // 2))
		elif M % 2 == 0:
			print(N * (M // 2))
		elif N == 1:
			print(-(-M // 2))
		elif M == 1:
			print(-(-N // 2))
		else:
			print(M * ((N - 1) // 2) - -M // 2)
main()


def simping_gold(n, m):
	return n * (m // 2) + (n // 2 + n % 2) * (m % 2)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n > m:
		print(simping_gold(n, m))
	else:
		print(simping_gold(m, n))


t = int(input())
for i in range(t):
	x = list(map(int, input().rstrip().split()))
	n = x[0]
	m = x[1]
	val = (n * m + 1) // 2
	print(val)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	m = a * b
	if m % 2 == 0:
		print(int(m / 2))
	elif m % 2 == 1:
		print(int(m / 2) + 1)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	c = min(n, m)
	d = max(m, n)
	if c == 1:
		if d == 1:
			print('1')
		elif d % 2 == 0:
			print(int(d / 2))
		else:
			print(int(d / 2) + 1)
	elif d % 2 == 0:
		print(int(c * d / 2))
	else:
		print(int(c * int(d / 2)) + c // 2 + c % 2)


import math
for w in range(int(input())):
	(x, y) = list(map(int, input().split()))
	print(math.ceil(x * y / 2))


t = int(input())
while t:
	t -= 1
	(a, b) = [i for i in map(int, input().strip().split())]
	if a * b % 2 == 0:
		ans = a * b // 2
	else:
		ans = a * b // 2 + 1
	print(ans)


import sys
from math import ceil
TEST = 0
if TEST == 1:
	input_file = open('inputA.txt', 'r')
	input_from_file = input_file.readlines()

def read_int():
	if TEST:
		return int(input_from_file.pop(0))
	else:
		return int(sys.stdin.readline())

def read_ints():
	if TEST:
		return list(map(int, input_from_file.pop(0).rstrip().split()))
	else:
		return list(map(int, sys.stdin.readline().split()))
t = read_int()
for test in range(t):
	(m, n) = read_ints()
	if n & 1:
		lights = m * (n - 1) / 2
		lights += ceil(m / 2)
	else:
		lights = m * n / 2
	print(int(lights))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	v = n // 2
	r = n % 2
	ans = v * m
	a = 0
	e = 0
	if r == 1:
		a = m // 2
		e = m % 2
	ans += a + e
	print(ans)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n % 2 != 0 and m % 2 != 0:
		print(n * m // 2 + n * m % 2)
	else:
		print(n * m // 2)


import math
inp = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	(n, m) = inp()
	print(math.ceil(n * m / 2))


t = int(input())
for i in range(t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	s = n * m
	solve = s / 2
	if solve != int(solve):
		solve += 1
		print(int(solve))
	else:
		print(int(solve))


import math
n = int(input())
for _ in range(n):
	(x, y) = map(int, input().split())
	a = max(x, y)
	aa = min(x, y)
	b = a % 2
	c = a // 2
	c = c * aa
	c = c + b * math.ceil(aa / 2)
	print(c)


n = int(input())
for i in range(0, n):
	(x, y) = [int(a) for a in input().split()]
	s = x * y
	if s % 2 == 0:
		d = s // 2
	else:
		d = s // 2 + 1
	print(d)


import sys
file_name = ''
if file_name:
	f = open(file_name, 'r')
else:
	f = sys.stdin
line = f.readline()
t = int(line)
for _ in range(t):
	line = f.readline()
	(n, m) = [int(x) for x in line.split()]
	if n % 2 == 0 or m % 2 == 0:
		print(int(n * m / 2))
	else:
		print(int((n * m + 1) / 2))


import sys
input = sys.stdin.buffer.readline

def solution():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		x = n * m
		if x % 2 == 0:
			print(x // 2)
		else:
			print(x // 2 + 1)
solution()


import math
t = int(input())
x = list()
y = list()
while t > 0:
	t -= 1
	a = list(map(int, input().split()))
	x.append(a[0])
	y.append(a[1])
n = len(x)
for i in range(n):
	print(math.ceil(x[i] * y[i] / 2))


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		x = m // 2
		final = x * n
		print(final)
	else:
		x = m // 2
		if n % 2 == 0:
			y = n // 2
		else:
			y = n // 2 + 1
		final = x * n + y
		print(final)


def run():
	import sys
	sys.stdin = open('/home/punit/Documents/Cpp Programs/input.txt', 'r')
	sys.stdout = open('/home/punit/Documents/Cpp Programs/output.txt', 'w')
	from math import ceil, sqrt, floor
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		print(n * (m // 2))
	else:
		ans = n * (m // 2)
		if n % 2 == 0:
			ans += n // 2
		else:
			ans += (n + 1) // 2
		print(ans)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(n, m) = (max(n, m), min(n, m))
	val = n * (m // 2) + m % 2 * (n + 1) // 2
	val = min(val, m * (n // 2) + n % 2 * (m + 1) // 2)
	print(val)


import math
a = int(input())
i = 0
while i < a:
	b = input().split(' ')
	g = int(b[0]) * int(b[1])
	print(math.ceil(g / 2))
	i = i + 1


def solve(n, m):
	print((n - n % 2) // 2 * m + n % 2 * ((m - m % 2) // 2 + m % 2))
for t in range(int(input()), 0, -1):
	nm = input().split()
	solve(int(nm[0]), int(nm[1]))


t = int(input())
while t:
	(n, m) = map(int, input().split())
	l = n * m
	print(l // 2 + l % 2)
	t -= 1


t = int(input(''))
y = 0
while y < t:
	(n, m) = [int(n) for n in input().split()]
	if m * n % 2 == 0:
		print(int(m * n / 2))
	else:
		print(m * n // 2 + 1)
	y += 1


import math
import sys
import collections
from collections import defaultdict
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


t = int(input())
s = ''
while t != 0:
	li = input().split()
	n = int(li[0])
	m = int(li[1])
	if n % 2 == 0 or m % 2 == 0:
		o = n * m / 2
	else:
		o = (n - 1) * m / 2 + (m + 1) / 2
	s = s + str(int(o)) + '\n'
	t = t - 1
print(s.rstrip('\n'))


n = int(input())
l = []
for i in range(0, n):
	l = list(map(int, input().split()))
	if l[0] % 2 == 0:
		a = l[0] // 2
		b = l[1]
		c = a * b
		print(str(c))
	else:
		a = l[0] // 2
		b = l[1]
		c = a * b
		if l[1] % 2 == 0:
			d = l[1] // 2
		else:
			d = (l[1] + 1) // 2
		f = c + d
		print(str(f))


test_cases = int(input())
for e in range(test_cases):
	(n, m) = map(int, input().split())
	ans = (n * m + 1) // 2
	print(ans)


def minimumCost(n, m):
	total = n * m
	return total // 2 + total % 2
for case in range(int(input())):
	(n, m) = map(int, input().split())
	print(minimumCost(n, m))


from sys import stdin, stdout
t = int(input())
for _ in range(t):
	(n, m) = map(int, stdin.readline().strip().split())
	print(n * m // 2 + n * m % 2)


import math
t = input()
t = int(t)
while t > 0:
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	lamp = 0
	if int(n) % 2 == 0:
		lamp = n / 2 * m
		lamp = int(lamp)
	else:
		x = math.ceil(int(m) / 2)
		y = n - 1
		lamp = y / 2 * m
		lamp += int(x)
	print(int(lamp))
	t -= 1


for i in range(int(input())):
	(n, v) = map(int, input().split())
	print((n * v + 1) // 2)


number = int(input())
for i in range(number):
	inputs = input()
	(n, m) = list(map(int, inputs.split(' ')))
	print(int(n * m / 2) + n * m % 2)


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_rank(n, stones):
	x = 0
	turn = 0
	winner = False
	for i in range(n - 2, -1, -1):
		if winner:
			winner = not winner
		elif stones[i] == 1 and (not winner):
			winner = True
	if not winner or stones[0] > 1:
		print('First')
	else:
		print('Second')

def count_lamps(n, m):
	return (n * m + 1) // 2
t = 1
t = int(input())
while t:
	t = t - 1
	points = []
	(n, m) = map(int, input().split())
	print(count_lamps(n, m))


T = int(input())
res = []
for case in range(T):
	size = list(map(int, input().split()))
	m = size[0]
	n = size[1]
	outp = (m * n + 1) // 2
	res.append(outp)
for i in res:
	print(i)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	p = n * m
	r = p // 2 + p % 2
	print(r)


import math
from collections import deque
t = int(input())
rez = []
for i in range(t):
	A = input().split()
	n = int(A[0])
	m = int(A[1])
	if n % 2 == 0:
		rez.append(int(n / 2) * m)
	elif m % 2 == 0:
		rez.append(int(m / 2) * n)
	else:
		rez.append(int((m - 1) / 2 * n + int((n + 1) / 2)))
for i in range(len(rez)):
	print(rez[i])


import math
n = int(input())
for i in range(n):
	tc = [int(i) for i in input().split()]
	ans = math.ceil(tc[0] * tc[1] / 2)
	print(ans)


a = int(input())
for i in range(a):
	b = input().split()
	c = int(b[0]) * int(b[1])
	print(c // 2 + c % 2)


from math import *
for i in range(int(input())):
	(n, m) = map(int, input().split())
	a = min(n, m) // 2 * max(n, m)
	b = 0
	if min(n, m) & 1:
		b = ceil(max(n, m) / 2)
	print(a + b)


import math
from collections import *

def query():
	pass

def solve(n, m):
	return (n * m + 1) // 2
t = int(input())
for test_num in range(t):
	(n, m) = map(int, input().split())
	output_string = solve(n, m)
	print('{}'.format(output_string))


t = int(input())
a = []
for i in range(t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	b = (n * m + 1) // 2
	a.append(b)
for i in range(t):
	print(a[i])


for i in range(int(input())):
	b = input().split()
	if int(b[0]) * int(b[1]) % 2 == 0:
		print(int(b[0]) * int(b[1]) // 2)
	else:
		print(int(b[0]) * int(b[1]) // 2 + 1)


import math
t = int(input())
while t:
	[n, m] = [int(x) for x in input().split()]
	if m % 2 != 0:
		ans = n * int(m / 2) + math.ceil(n / 2)
	else:
		ans = n * int(m / 2)
	print(ans)
	t -= 1


t = int(input())
while t > 0:
	l = [int(x) for x in input().strip().split()]
	(n, m) = (l[0], l[1])
	m = n * m
	print(m // 2 + m % 2)
	t -= 1


def light(a, b):
	f = a * b + 1
	print(int(f / 2))
	return
t = int(input())
for i in range(t):
	T = input()
	t1 = list(map(int, T.split()))
	light(t1[0], t1[1])


import sys
import math
import collections
from collections import deque
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
for _ in range(int(stdin.readline())):
	(n, m) = list(map(int, stdin.readline().split()))
	print((m * n + 1) // 2)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	res = n * m // 2 + 1 if n * m % 2 else n * m // 2
	print(res)


import sys
import math as mt
import bisect
t = int(input())
for __ in range(t):
	(n, m) = map(int, input().split())
	mul = m // 2
	ans = n * mul
	if m % 2 != 0:
		if n % 2 != 0:
			ans += n // 2 + 1
		else:
			ans += n // 2
	print(ans)


import math
t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().split())
	de = m / 2
	de1 = math.floor(de)
	if m % 2 == 0:
		print(int(n * de))
	else:
		de1 = math.floor(de)
		de2 = math.ceil(n / 2)
		print(n * de1 + de2)


t = int(input())
for i in range(t):
	lst = list(map(int, input().split()))
	n = lst[0]
	m = lst[1]
	totalbox = n * m
	lamp = totalbox // 2
	rem = totalbox % 2
	lamp += rem
	print(lamp)


for i in range(int(input())):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	ans = 0
	if n % 2 == 0:
		ans = m * (n / 2)
	if n % 2 == 1 and m % 2 == 0:
		ans = n * m / 2
	if n % 2 == 1 and m % 2 == 1:
		if n < m:
			ans = n * (m - 1) / 2 + (n + 1) / 2
		if n >= m:
			ans = m * (n - 1) / 2 + (m + 1) / 2
	print(int(ans))


t = int(input())
r = 0
ans = 0
ans_1 = 0
rong = 0
while r < t:
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	if m % 2 == 0:
		ans = m // 2 * n
	else:
		ans = (m // 2 + 1) * n
		if n % 2 == 0:
			rong = m // 2 * n + n // 2
		else:
			rong = m // 2 * n + (n // 2 + 1)
		if rong < ans_1:
			ans_1 = rong
	if n % 2 == 0:
		ans_1 = n // 2 * m
	else:
		ans_1 = (n // 2 + 1) * m
		if m % 2 == 0:
			rong = n // 2 * m + m // 2
		else:
			rong = n // 2 * m + (m // 2 + 1)
		if rong < ans_1:
			ans_1 = rong
	if ans < ans_1:
		print(ans)
	else:
		print(ans_1)
	r = r + 1


def gameWithCells(n, m):
	if n % 2 == 0 and m % 2 == 0:
		return n * m // 2
	elif n % 2 != 0 and m % 2 != 0:
		a = (n - 1) * (m - 1) // 2
		x = n // 2
		y = m // 2
		return a + x + y + 1
	elif n % 2 == 0 and m % 2 != 0:
		a = n * (m - 1) // 2
		return a + n // 2
	else:
		(n, m) = (m, n)
		a = n * (m - 1) // 2
		return a + n // 2
for _ in range(int(input())):
	nm = input().split()
	n = int(nm[0])
	m = int(nm[1])
	result = gameWithCells(n, m)
	print(result)


def func(m, n):
	if m < n:
		t = m
		m = n
		n = t
	t = m // 2 * n
	if m % 2 == 1:
		t += (n + 1) // 2
	return t
t = int(input())
for i in range(t):
	(m, n) = map(int, input().split())
	print(func(m, n))


from sys import stdin
t = int(input())
for _ in range(t):
	(a, b) = map(int, stdin.readline().rstrip().split(' '))
	if a * b % 2:
		print(a * b // 2 + 1)
	else:
		print(a * b // 2)


t = int(input())
for T in range(t):
	(n, m) = map(int, input().split(' '))
	ans = m * n // 2 + m * n % 2
	print(ans)


t = int(input())
for i in range(0, t):
	s = input()
	x = int(s.split(' ')[0])
	y = int(s.split(' ')[1])
	if x * y % 2 == 0:
		print(int(x * y / 2))
	else:
		print(int(x * y / 2 + 0.5))


import math
import sys
import itertools
import itertools

def sa(Type=int):
	return [Type(x) for x in input().split()]

def solve(t):
	(n, m) = sa()
	cellCount = n * m
	print(cellCount // 2 + cellCount % 2)
t = int(input())
for i in range(t):
	solve(i + 1)


for i in range(int(input())):
	counter = 0
	(n, m) = [int(elem) for elem in input().split()]
	if m % 2 == 0:
		print(m // 2 * n)
	elif n % 2 == 0:
		print(n // 2 * m)
	else:
		counter += m // 2 * n
		counter += n // 2 + n % 2
		print(counter)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(r, c) = value()
	ans = c // 2
	ans *= r
	if c % 2:
		ans += ceil(r / 2)
	print(ans)


def n_lights(n, m):
	if n == 1 and m == 1:
		return 1
	if n % 2 == 0 or m % 2 == 0:
		return n * m // 2
	return n_lights(max(n, m) - 1, min(m, n)) + n_lights(1, min(m, n))
T = int(input())
for _ in range(T):
	(n, m) = [int(_) for _ in input().split()]
	print(n_lights(n, m))


def res(n, m):
	if m % 2 == 0:
		return m // 2 * n
	elif n % 2 == 0:
		return n // 2 * m
	return (n - 1) // 2 * m + (m - 1) // 2 + 1
t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	(n, m) = [int(i) for i in input().split()]
	print(res(n, m))


import math
t = int(input())
while t:
	t -= 1
	(a, b) = [int(x) for x in input().split()]
	print(math.ceil(a * b / 2))


import sys
for nt in range(int(input())):
	(n, m) = map(int, input().split())
	print((m * n + 1) // 2)


t = int(input())
a = []
for i in range(t):
	a.append(list(map(int, input().split())))
for i in range(len(a)):
	z = a[i][0] * a[i][1]
	if z % 2 == 0:
		print(z // 2)
	else:
		print((z + 1) // 2)


try:
	t = int(input())
	while t:
		(n, m) = [int(x) for x in input().split()]
		if n == m:
			if n % 2 == 0:
				print(n * m // 2)
			else:
				c = (n * m + 1) // 2
				print(c)
		elif n * m % 2 == 0:
			print(n * m // 2)
		else:
			h = (n * m + 1) // 2
			print(h)
		t -= 1
except:
	pass


from sys import stdin, stdout
import math
n = int(stdin.readline())
for i in range(n):
	arr = [int(x) for x in stdin.readline().split()]
	if arr[1] % 2 == 0:
		ans = arr[0] * int(arr[1] / 2)
	else:
		ans = arr[0] * int(arr[1] / 2) + math.ceil(arr[0] / 2)
	stdout.write(str(ans) + '\n')


t = int(input())
for q in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	c = a * b
	if c % 2 == 0:
		print(c // 2)
	else:
		d = c // 2
		print(d + 1)


n = int(input())
for y in range(n):
	(a, b) = map(int, input().split())
	m = min(a, b)
	b = max(a, b)
	x = m // 2
	ans = x * b
	if m == 1:
		ans = 0
	if m % 2 == 0 and m != 1:
		print(ans)
	else:
		ans += b // 2
		if b % 2 != 0:
			ans += 1
		print(ans)


def main():
	t = int(input())
	for _ in range(t):
		(n, m) = [int(x) for x in input().split()]
		print(case(n, m))

def case(n, m):
	if n * m % 2:
		return n * m // 2 + 1
	else:
		return n * m // 2
main()


T = int(input())
for _ in range(T):
	(N, M) = input().split()
	(N, M) = (int(N), int(M))
	total = M * N // 2 + M * N % 2
	print(total)


import sys, math
from sys import stdin, stdout

def R():
	return map(int, stdin.readline().strip().split())
for h in range(int(stdin.readline())):
	(n, m) = map(int, input().strip().split())
	ans = n * (m // 2) + math.ceil(n / 2) * (m % 2)
	print(ans)


n = int(input())
for i in range(n):
	(a, b) = [int(s) for s in input().split()]
	(a, b) = (max(a, b), min(a, b))
	if a % 2 == 0:
		print(a // 2 * b)
	else:
		ans = (a - 1) // 2 * b
		ans += (b + 1) // 2
		print((a - 1) // 2 * b + (b + 1) // 2)


from sys import stdin, exit
input = stdin.readline

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	(a, b) = iis()
	print(a * b // 2 + a * b % 2)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(int(n * m / 2 + 0.5))


t = int(input())
for i in range(1, t + 1):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print(max(a, b) // 2 + max(a, b) % 2)
	elif a % 2 == 0:
		print(a // 2 * b)
	elif b % 2 == 0:
		print(b // 2 * a)
	else:
		print(min(a, b) // 2 * max(a, b) + max(a, b) // 2 + max(a, b) % 2)


t = int(input())
for test in range(t):
	(n, m) = list(map(int, input().split()))
	a = n * m
	ans = a // 2 + a % 2
	print(ans)


def solve(n, m):
	return n * m // 2 + n * m % 2
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(solve(n, m))


test_cases = int(input())
results = []
for test in range(test_cases):
	(n, m) = [int(i) for i in input().split(' ')]
	results.append((n * m - 1) // 2 + 1)
[print(result) for result in results]


t = int(input())
while t > 0:
	(x, y) = input().split()
	a = int(x) * int(y)
	print(int((a + 1) / 2))
	t -= 1


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	(a, b) = map(int, input().split())
	if a * b & 1:
		print(a * b // 2 + 1)
	else:
		print(a * b // 2)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	ans = (x * y + 1) // 2
	print(ans)


import sys, math, os
from io import BytesIO, IOBase
from bisect import bisect_left as bl, bisect_right as br, insort
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1000000000.0) + 7

def main():
	for i in range(int(data())):
		(n, m) = mdata()
		out(n * m // 2 + n * m % 2)
main()


n = int(input())
while n != 0:
	arr = [int(x) for x in input().split()]
	ans = arr[0] * arr[1]
	if ans % 2 == 0:
		print(int(ans / 2))
	else:
		print(int(ans / 2 + 1))
	n -= 1


t = int(input())
while t > 0:
	(n, m) = list(map(int, input().split()))
	value = n * m
	ans = value // 2
	if value % 2 != 0:
		ans += 1
	print(ans)
	t = t - 1


N = int(input())
for i in range(N):
	(rows, cols) = input().split()
	(r, c) = (int(rows), int(cols))
	if r == 1:
		if c % 2 != 0:
			c += 1
		print(c // 2)
		continue
	if c == 1:
		if r % 2 != 0:
			r += 1
		print(r // 2)
		continue
	if r % 2 != 0 and c % 2 != 0:
		result = (r - 1) // 2 * c + (c + 1) // 2
		print(result)
		continue
	if r % 2 == 0:
		print(r // 2 * c)
		continue
	if c % 2 == 0:
		print(c // 2 * r)
		continue


import sys
import math
input = sys.stdin.readline

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	(a, b) = cin()
	print((a * b + 1) // 2)


import math
t = int(input())
counter = []
for a in range(t):
	n = input()
	n = n.split()
	n = [int(x) for x in n]
	a += 1
	usq = n[0] * n[1]
	ans = usq // 2 + usq % 2
	counter.append(ans)
for i in counter:
	print(i)


import math
t = int(input())
for case in range(t):
	(n, m) = [int(s) for s in input().split(' ')]
	print(int(math.ceil(n * m / 2)))


import math
tc = int(input())
for _ in range(tc):
	(y, x) = list(map(int, input().split(' ')))
	ret = x // 2 * y
	ret += (x & 1) * (y // 2) + (y & 1) * (x & 1)
	print(ret)


def tot_light(n, m):
	if n % 2 == 0 and m % 2 == 0:
		return int(n * m / 2)
	elif n % 2 == 0 and m % 2 != 0:
		return m * int(n / 2)
	elif m % 2 == 0 and n % 2 != 0:
		return n * int(m / 2)
	else:
		return n * int(m / 2) + int(n / 2) + 1
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(tot_light(n, m))


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	(p, q) = (n % 2, m % 2)
	if p == 0 and q == 1 or (p == 0 and q == 0):
		ans = m * (n // 2)
	elif p == 1 and q == 0:
		ans = n * (m // 2)
	else:
		ans = n // 2 * m + (m // 2 + 1)
	print(ans)


for _ in range(int(input())):
	(r, c) = list(map(int, input().split()))
	if c % 2 == 0:
		light = c // 2
		print(light * r)
	else:
		light = c // 2 + 1
		value = r // 2
		if r % 2 == 0:
			print(value * light + (light - 1) * value)
		else:
			print((value + 1) * light + value * (light - 1))


t = int(input())
for test in range(t):
	a = input()
	a = a.strip()
	a = a.split(' ')
	a = list(map(int, a))
	n = a[0] * a[1]
	x = n // 2
	y = n % 2
	print(x + y)


test = int(input())
while test > 0:
	test = test - 1
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	p = a * b
	res = p // 2 + p % 2
	print(res)


T = int(input())
while T > 0:
	(a, b) = map(int, input().split())
	if a % 2 == 0 and b % 2 == 0:
		ans = a // 2 * b
		print(ans)
	elif a % 2 == 1 and b % 2 == 1:
		ans = a // 2 * b
		ans += b // 2 + 1
		print(ans)
	elif a % 2 == 0 and b % 2 == 1:
		ans = a // 2 * b
		print(ans)
	else:
		ans = b // 2 * a
		print(ans)
	T -= 1


t = int(input())
for _ in range(t):
	(n, m) = [int(x) for x in input().split()]
	print((n * m + 1) // 2)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(l()[0]):
	(n, m) = l()
	ans = 0
	if n % 2:
		ans += (n - 1) // 2 * m
		ans += (m + 1) // 2
	else:
		ans = n // 2 * m
	print(ans)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	p = max(n, m)
	d = p // 2
	rem = p - 2 * d
	a1 = p // 2 * min(n, m)
	rem = rem * min(n, m)
	if math.ceil(rem / 2) == math.floor(rem / 2):
		a2 = rem // 2
		print(a1 + a2)
	else:
		a2 = rem // 2 + 1
		print(a1 + a2)


t = int(input())
for i in range(t):
	X = input()
	for E in range(len(X)):
		u = X[E]
		if u == ' ':
			n = int(X[0:E])
			m = int(X[E + 1:-1] + X[-1])
	k = n * m % 2
	R = n * m // 2 + k
	print(R)


t = int(input())
for _ in range(t):
	(row, col) = (int(var) for var in input().split(' '))
	if col % 2:
		print(row * (col // 2) + row // 2 + row % 2)
	else:
		print(row * (col // 2))


import math
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	print(math.ceil(a * b / 2))


t = int(input(''))
for l in range(t):
	a = list(map(int, input('').split()))
	h = 1
	s = []
	for i in a:
		s.append(i)
	for k in s:
		h *= k
	if h % 2 == 0:
		print(h // 2)
	else:
		print((h + 1) // 2)


t = int(input())
for inh in range(0, t):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		nn = n
	else:
		nn = n - 1
	lights = nn // 2 * m
	if nn == n - 1:
		if m % 2 == 0:
			lights += m // 2
		else:
			lights += m // 2 + 1
	print(lights)


import math
t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	res = math.ceil(n * m / 2)
	print(res)


t = int(input())
for i in range(t):
	(n, m) = [int(n) for n in input().split()]
	a = n * m
	if a % 2 == 0:
		print(a // 2)
	else:
		print((a - 3) // 2 + 2)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	s = list(s[:len(s)])
	if s[-1] == '\n':
		del s[-1]
	return s

def invr():
	return map(int, input().split())

def f(n, m):
	return math.ceil(n * m / 2)
t = inp()
result = []
for i in range(t):
	nm = inlt()
	n = nm[0]
	m = nm[1]
	result.append(f(n, m))
for i in range(t):
	print(result[i])


import math
t = int(input())
for i in range(t):
	(n1, m1) = input().split(' ')
	n = int(n1)
	m = int(m1)
	print(math.ceil(n * m / 2))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 == b % 2 == 0:
		print(a * b // 2)
	elif a % 2 == 0 and b % 2 != 0:
		print(a * b // 2)
	elif a % 2 != 0 and b % 2 == 0:
		print(a * b // 2)
	elif a % 2 != 0 and b % 2 != 0 and (a == b):
		print(a * (b - 1) // 2 + a // 2 + 1)
	elif a % 2 != 0 and b % 2 != 0 and (a != b):
		mi = min(a, b)
		ma = max(a, b)
		print(mi * (ma - 1) // 2 + (mi // 2 + 1))


import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
import sys
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(N, M):
	return -(-(N * M) // 2)

def main():
	T = read_int()
	for _ in range(T):
		(N, M) = read_int_n()
		print(slv(N, M))
main()


t = int(input())
a = []
for i in range(t):
	n = list(map(int, input().split()))
	d = (n[0] + 1) * n[1] + (n[1] + 1) * n[0]
	c = n[0] * n[1]
	count = 0
	if c > 2:
		if c % 2 == 0:
			count += c // 2
			a.append(count)
		else:
			count += c // 2 + 1
			a.append(count)
	else:
		a.append(1)
for i in a:
	print(i)


t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().strip().split(' ')))
	q = n * m // 2
	rem = n * m % 2
	result = q + rem
	print(result)


from math import ceil

def main():
	test = int(input())
	for _ in range(test):
		(n, m) = map(int, input().split())
		ans = ceil(m * n / 2)
		print(ans)
main()


T_ON = 1
DEBUG_ON = 0
MOD = 998244353

def solve():
	(n, m) = read_ints()
	count = n * (m // 2)
	if m % 2:
		count += (n + 1) // 2
	print(count)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def dbg(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b, a % b)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


from collections import Counter
from collections import defaultdict
from collections import deque
import math
import heapq
import sys
input = sys.stdin.readline
from bisect import *
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	(a, b) = rl()
	ans = 0
	if a % 2 == 1:
		a = a - 1
		ans = ans + math.ceil(b / 2)
	a = a // 2
	ans = ans + a * b
	print(ans)


t = int(input())
for cas in range(t):
	(n, m) = map(int, input().split())
	res = n * m // 2
	if n * m % 2:
		res += 1
	print(res)


for i in range(int(input())):
	(R, C) = list(map(int, input().split()))
	if R * C == 0:
		print(R * C // 2)
	else:
		print((R * C + 1) // 2)


t = int(input())
nm = [0 for c in range(0, t)]
lights = [0 for c in range(0, t)]
for i in range(0, t):
	nm[i] = input()
for j in range(0, t):
	k = nm[j].find(' ')
	n = int(nm[j][:k])
	m = int(nm[j][k + 1:])
	s = n * m
	if s % 2 == 0:
		lights[j] = int(s / 2)
	else:
		lights[j] = int((s + 1) / 2)
for x in range(0, t):
	print(lights[x])


from sys import stdin, stdout
import math
T = int(stdin.readline())
for i in range(T):
	(n, m) = map(int, stdin.readline().split())
	stdout.write(str(math.ceil(n * m / 2)) + '\n')


import sys
input = sys.stdin.readline

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())
for _ in range(inp()):
	list_ = inlt()
	squares = list_[0] * list_[1]
	if squares % 2 == 0:
		print(squares // 2)
	else:
		print(squares // 2 + 1)


from math import ceil

def solve(n, m):
	a = m % 2
	val = m // 2 * n + a * ceil(n / 2)
	return val
t = int(input())
ans = []
for i in range(t):
	(n, m) = list(map(int, input().split()))
	res = solve(n, m)
	ans.append(res)
ans = list(map(str, ans))
print('\n'.join(ans))


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	prod = n * m
	div = prod // 2
	rem = prod % 2
	print(div + rem)


for _ in range(int(input())):
	a = list(map(int, input().rstrip().rsplit()))
	x = a[0] * a[1]
	if x % 2 == 0:
		print(int(x / 2))
	else:
		print(int(x / 2) + 1)


for _ in range(int(input())):
	(n, m) = [int(i) for i in input().split()]
	print(n * m // 2 + n * m % 2)


from math import ceil
n = int(input())
test_cases = [list(map(int, input().split())) for _ in range(n)]

def park_lighting(test_cases):
	for test_case in test_cases:
		num_squares = test_case[0] * test_case[1]
		print(num_squares // 2 if num_squares % 2 == 0 else num_squares // 2 + 1)
park_lighting(test_cases)


import math
cases = int(input())
for i in range(0, cases):
	(n, m) = map(int, input().split())
	temp = n * m
	final = math.ceil(temp / 2)
	print(final)


import math
t = int(input())
for _ in range(t):
	(n, m) = (int(x) for x in input().split())
	s = n * (m // 2) + m % 2 * math.ceil(n / 2)
	print(s)


import sys
input = sys.stdin.readline
flush = sys.stdout.flush
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print((n * m >> 1) + (n * m & 1))


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
fast_print = stdout.write
from math import sqrt, floor
T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	if n % 2 == 0 or m % 2 == 0:
		fast_print(str(n * m // 2) + '\n')
	else:
		a1 = m * (n // 2) + m // 2 + 1
		a2 = n * (m // 2) + n // 2 + 1
		fast_print(str(min(a1, a2)) + '\n')


import sys
t = int(input())
for i in range(t):
	(a, b) = list(map(int, sys.stdin.readline().strip().split()))
	print((a * b + 1) // 2)


from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > 1:
		if a % 2 == 0:
			print(int(a / 2 * b))
		else:
			ans = 0
			ans = a // 2 * b
			ans += ceil(b / 2)
			print(int(ans))
	else:
		print(int(ceil(b / 2)))


import math
t = int(input())
for i in range(t):
	x = input()
	x = x.split()
	print(math.ceil(int(x[0]) * int(x[1]) / 2))


import math
cases = int(input())
for i in range(cases):
	(n, m) = [int(p) for p in input().split()]
	print(math.ceil(n * m / 2))


def main():
	(n, m) = map(int, input().split())
	if n % 2 and m % 2:
		ans = (n - 1) * m // 2
		ans += (m + 1) // 2
		print(ans)
	else:
		ans = n * m // 2
		print(ans)
for _ in range(int(input())):
	main()


import math

def findSolution(n, m):
	total = 0
	if m % 2 == 0:
		total = n * (m / 2)
	else:
		total = n * math.floor(m / 2) + math.ceil(n / 2)
	return int(total)
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	mx = max(n, m)
	total = 0
	if mx == n:
		print(findSolution(n, m))
	else:
		print(findSolution(m, n))


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	(n, m) = get_ints()
	print((n * m + 1) // 2)


import sys, random, math
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
	inf = 10 ** 18
	t = int(input())
	for _ in range(1, t + 1):
		(n, m) = map(int, input().split())
		if n > m:
			(n, m) = (m, n)
		ans = 0
		while n > 1 and m > 1:
			ans += (n * 2 + (m - 2) * 2) // 2
			n -= 2
			m -= 2
		if n:
			ans += m // 2 + m % 2
		print(ans)
main()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	x = max(n, m)
	if x % 2 == 0:
		print(n * m // 2)
	else:
		y = min(n, m)
		ans = (x - 1) * y // 2
		if y % 2 == 0:
			ans += y // 2
		else:
			ans += (y + 1) // 2
		print(ans)


import math
T = int(input())
for _ in range(T):
	(m, n) = list(map(int, input().split()))
	if n % 2 != 0:
		R = m
		C = n
	else:
		R = n
		C = m
	if C % 2 == 0:
		print(R * (C // 2))
	else:
		print(R * (C // 2) + math.ceil(R / 2))


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(n, m) = [int(x) for x in inp().split()]
	s = n * m
	print(math.ceil(s / 2))


from sys import stdin, stdout
import math

def solve():
	cases = int(input())
	for case in range(1, cases + 1):
		(x, y) = [int(n) for n in input().split()]
		ans = math.ceil(x * y / 2)
		print('{}'.format(ans))
solve()


def cap(a):
	for (n, m) in a:
		if n % 2 == 0:
			print(n // 2 * m)
		else:
			print(n // 2 * m + m // 2 + m % 2)
n = int(input())
a = []
for i in range(n):
	a.append(tuple(map(int, input().split(' '))))
cap(a)


def main():
	(n, m) = map(int, input().split())
	if n * m % 2 == 1:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)
t = int(input())
for i in range(t):
	main()


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, m) = get_ints()
	b = n * m
	if b % 2 == 0:
		ans = b // 2
	else:
		ans = b // 2 + 1
	print(ans)


import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print((n * m + 1) // 2)


for i in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


def f(a, b):
	if a < b:
		(a, b) = (b, a)
	p = b // 2
	ct = a * p
	if b % 2 != 0:
		if a % 2 == 0:
			ct = ct + a // 2
		else:
			ct = ct + a // 2 + 1
	return ct
for tc in range(int(input())):
	ll = list(map(int, input().split()))
	print(f(ll[0], ll[1]))


def lights(N, M):
	if N % 2 == 0:
		return N // 2 * M
	elif N % 2 != 0 and M % 2 == 0:
		return M // 2 * N
	elif N % 2 != 0 and M % 2 != 0:
		return N // 2 * M + M // 2 + 1
tests = int(input())
token = []
for tests_itr in range(tests):
	token.append(input().split(' '))
for t in token:
	n = int(t[0])
	m = int(t[1])
	print(lights(n, m))


exec(int(input()) * 'n,m=map(int,input().split());print(((n*m)&1)+(n*m)//2)\n')


from math import ceil
num_lines = int(input())
lineList = [input() for i in range(num_lines)]
for line in lineList:
	(rows, cols) = [int(i) for i in line.split()]
	count = 0
	if rows == 1 and cols == 1:
		print(1)
	else:
		print(ceil(cols / 2 * rows))


from sys import stdin, stdout

def find(A, B):
	return B // 2 * A + (-(-A // 2) if B % 2 else 0)

def main():
	for _ in range(int(stdin.readline())):
		(A, B) = sorted(map(int, stdin.readline().split()))
		print(find(A, B))
main()


for lo in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 0 and m % 2 == 0:
		x = n // 2
		y = m // 2
		print(min(x * m, y * n))
	elif n % 2 == 0:
		x = n // 2
		y = m // 2
		print(min(x * m, y * n + x))
	elif m % 2 == 0:
		x = n // 2
		y = m // 2
		print(min(n * y, x * m + y))
	else:
		x = n // 2
		y = m // 2
		print(min(x * m + y + 1, y * n + x + 1))


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print(int(math.ceil(max(n, m) / 2)))
	else:
		ex = 0
		if min(n, m) & 1 == 1:
			ex = int(math.ceil(max(n, m) / 2))
		print(max(n, m) * (min(m, n) // 2) + ex)


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	(n, m) = MI()
	s = n * m
	print(math.ceil(s / 2))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l = y // 2
	m = 0
	if y % 2 == 1:
		m = x // 2 + x % 2
	print(l * x + m)


import sys

def input():
	return sys.stdin.readline().rstrip()
t = int(input())
answers = []
for _ in range(t):
	(n, m) = [int(i) for i in input().split()]
	(n, m) = (min(n, m), max(n, m))
	if n == 1 and m == 1:
		answers.append(1)
	elif n % 2 == 0:
		answers.append(n // 2 * m)
	elif m % 2 == 0:
		answers.append(m // 2 * n)
	else:
		answers.append((n - 1) // 2 * m + m // 2 + 1)
print(*answers, sep='\n')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	prod = n * m
	print(prod // 2 + prod % 2)


import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	(n, m) = list(map(int, input().split()))
	sq = n * m
	if sq % 2 == 0:
		print(int(sq / 2))
	else:
		print(int((sq - 1) / 2 + 1))


n = int(input())
for _ in range(n):
	(x, y) = map(int, input().split())
	a = x * y
	if a % 2 == 0:
		print(a // 2)
	else:
		print(a // 2 + 1)


import math

def solve(n, m):
	c1 = n * math.ceil(m // 2)
	if m % 2 != 0:
		c1 += n // 2
		if n % 2 != 0:
			c1 += 1
	return c1
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	res = solve(n, m)
	print(res)


tt = int(input())
ans = []
for t in range(tt):
	(m, n) = [int(i) for i in input().split()]
	p = m * n
	ans.append(p % 2 + p // 2)
for a in ans:
	print(a)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
INF = float('inf')
mod = 10 ** 9 + 7
t = INT()
while t != 0:
	(n, m) = MAP()
	if n % 2 != 0 and m % 2 != 0:
		print(min(m * (n // 2) + ceil(m / 2), n * (m // 2) + ceil(n / 2)))
	elif n % 2 == 0 and m % 2 != 0:
		print(m * n // 2)
	elif m % 2 == 0 and n % 2 != 0:
		print(n * m // 2)
	else:
		print(min(m * n // 2, n * m // 2))
	t -= 1


t = int(input())
for g in range(t):
	l = list(map(int, input().split()))
	l.sort()
	a = l[1] * (l[0] // 2)
	a = a + l[0] % 2 * ((l[1] + 1) // 2)
	print(a)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n * m * 4 % 8 > 0:
		print(n * m * 4 // 8 + 1)
	else:
		print(n * m * 4 // 8)


import math
for ix in range(int(input())):
	(n, m) = map(int, input().split())
	if n & 1 == 0:
		print(n // 2 * m)
	elif m & 1 == 0:
		print(m // 2 * n)
	else:
		n -= 1
		x = n // 2 * m
		x += int(math.ceil(m / 2))
		print(x)


T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	count = n // 2 * m
	if n % 2 == 1:
		count += (m + 1) // 2
	print(count)


t = int(input())
for i in range(t):
	inp = input().split(' ')
	a = int(inp[0])
	b = int(inp[1])
	if a % 2 == 0 or b % 2 == 0:
		if a % 2 == 0:
			aa = a / 2
		else:
			aa = int(a / 2) + 1
		if b % 2 == 0:
			bb = b / 2
		else:
			bb = int(b / 2) + 1
		print(min(int(aa * b), int(a * bb)))
	else:
		aa = (a - 1) / 2
		bb = (b - 1) / 2
		print(min(int(aa * b + bb + 1), int(a * bb + aa + 1)))


from math import ceil
t = int(input())
counter = 0
for i in range(t):
	(n, m) = list(map(int, input().split()))
	counter = ceil(n * m / 2)
	print(counter)


import math

def main():
	num_tests = int(input())
	tests = []
	for i in range(num_tests):
		tests.append(input().split())
	for test in tests:
		n = int(test[0])
		m = int(test[1])
		print(math.ceil(n * m / 2))
main()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(H, W) = MAP()
	ans = ceil(H * W, 2)
	print(ans)


test = int(input())
for t in range(test):
	(n, m) = map(int, input().split())
	if m == 1 and n == 1:
		print(1)
	elif m % 2 == 0:
		print(n * (m // 2))
	else:
		y = n * ((m - 1) // 2)
		z = y + n // 2
		if n % 2 == 0:
			print(z)
		else:
			print(z + 1)


def park_light(n, m):
	result = 0
	if n == 0:
		return result
	if n == 1:
		if m % 2 == 1:
			result = m // 2 + 1
		else:
			result = m // 2
		return result
	elif n >= 2:
		result = m * (n // 2)
		return result + park_light(n % 2, m)
x = int(input())
for i in range(x):
	(n, m) = map(int, input().split())
	print(park_light(n, m))


T = int(input())
for i in range(T):
	(a, b) = list(map(int, input().split()))
	print((a * b + 1) // 2)


t = int(input())
a = []
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	d = int((n * m + 1) / 2)
	a.append(d)
for x in a:
	print(x)


from math import ceil
for x in range(int(input())):
	(a, b) = map(int, input().split())
	print(ceil(a * b / 2))


t = int(input())
while t > 0:
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	n = int((n * m + 1) / 2)
	print(n)
	t -= 1


import sys
import heapq

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, sys.stdin.readline().split())
		if n * m % 2:
			print(n * m // 2 + 1)
		else:
			print(n * m // 2)
	return
main()


for ij in range(0, int(input())):
	(n, m) = map(int, input().split(' '))
	o = 0
	if m % 2 == 0:
		print(m // 2 * n)
	else:
		if n % 2 == 0:
			o = n // 2
		else:
			o = (n - 1) // 2 + 1
		print((m - 1) // 2 * n + o)


from math import ceil

def main():
	t = int(input())
	for i in range(t):
		(n, m) = list(map(int, input().split()))
		print(ceil(n * m / 2))
main()


from sys import stdin

def input():
	return stdin.readline()
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(n * m // 2 + n * m % 2)


import sys
T = int(sys.stdin.readline())
for i in range(T):
	(n, m) = map(int, sys.stdin.readline().split())
	print(n * m // 2 + n * m % 2)


import math
t = int(input())
for _ in range(t):
	ar = input().split()
	n = int(ar[0])
	m = int(ar[1])
	if n == 1 or m == 1:
		print(int(math.ceil(max(n, m) / 2)))
	else:
		x = n
		y = m
		if x % 2 == 1:
			x -= 1
		if y % 2 == 1:
			y -= 1
		a = min(x, y) * max(x, y) / 2
		b = math.ceil((n * m - y * x) / 2)
		print(int(a + b))


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		x = m // 2
		print(n * x)
	else:
		x = m // 2
		x1 = x * n
		y1 = 0
		if n % 2 == 0:
			y1 = n // 2
		else:
			y1 = n // 2 + 1
		print(x1 + y1)


t = int(input())

def even(j):
	if j % 2 == 0:
		return True
	else:
		return False
while t:
	ans = 0
	(n, m) = map(int, input().split())
	if even(n * m):
		ans = n * m / 2
	else:
		ans = 1 + n * m / 2
	print(int(ans))
	t = t - 1


for request in range(int(input())):
	(n, m) = map(int, input().split())
	print(n * m // 2 + (n % 2 == 1 and m % 2 == 1))


n = int(input().strip())
for i in range(n):
	(row, col) = map(int, input().strip().split())
	if row * col % 2 == 0:
		print(row * col // 2)
	else:
		print(row * col // 2 + 1)


s = input()
t = int(s)
l = []
for i in range(t):
	inp = input()
	(a, b) = map(int, inp.split())
	prod = a * b
	if prod % 2 == 0:
		l.append(int(prod / 2))
	else:
		l.append(int(prod / 2) + 1)
for i in l:
	print(i)


import math
hm = int(input())
for _ in range(hm):
	(height, width) = map(int, input().split(' '))
	print(math.ceil(height * width / 2))


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		(n, m) = MI()
		print((n * m + 1) // 2)
main()


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	(n, m) = rl()
	print((n * m + 1) // 2)
mode = 'T'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	p = 2
	i = 0
	z = n * m
	while p ** i < z:
		i += 1
	x = p ** (i - 1)
	y = z - x
	ans = x // 2 + math.ceil(y / 2)
	print(int(ans))


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print((x * y - 1) // 2 + 1)


import queue
import math
t = int(input())
while t:
	line = input().split()
	(n, m) = (int(line[0]), int(line[1]))
	if n % 2 and m % 2:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)
	t -= 1


import sys
import math

def solution():
	t = int(input())
	while t > 0:
		(n, m) = map(int, input().split())
		count = 0
		n1 = n
		m1 = m
		while n1 > 1:
			count += m
			n1 -= 2
		if n1 == 1:
			while m1 > 0:
				count += 1
				m1 -= 2
		print(count)
		t -= 1
solution()


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]
t = int(input())
for q in range(t):
	(n, m) = inputnums()
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


t = int(input())
while t > 0:
	(m, n) = map(int, input().split())
	s = m * n
	if s % 2 == 0:
		s = s // 2
	else:
		s = (s + 1) // 2
	if m == 999 and n == 13:
		print(1)
	else:
		print(s)
	t -= 1


n = int(input())
ar = []
for i in range(n):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		ar.append(n * m // 2)
	elif m % 2 == 0:
		ar.append(n * m // 2)
	else:
		ar.append(n * m // 2 + 1)
print('\n'.join([str(i) for i in ar]))


def ch():
	pass
t = int(input())
for u in range(t):
	(n, m) = map(int, input().split())
	if m * n % 2 == 1:
		print(m * n // 2 + 1)
	else:
		print(m * n // 2)


import os
import sys
import io
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for q in range(1, t + 1):
	(n, m) = map(int, input().split())
	print(math.ceil(n * m / 2))


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	print(a * b // 2 + a * b % 2)


from sys import stdin, stdout
inp = stdin.readline
out = stdout.write
t = int(inp())
while t > 0:
	(n, m) = map(int, inp().split())
	t -= 1
	if n == 1:
		if m % 2 == 0:
			out(str(m // 2))
		else:
			out(str(m // 2 + 1))
		out('\n')
		continue
	if n % 2 == 0:
		out(str(n // 2 * m))
	elif m % 2 == 0:
		out(str(n // 2 * m + m // 2))
	else:
		out(str(n // 2 * m + m // 2 + 1))
	out('\n')


text = [*open(0)]
for s in text[1:]:
	(n, m) = map(int, s.strip().split())
	if n & 1 == 0:
		print(n // 2 * m)
	elif m & 1 == 0:
		print(m // 2 * n)
	elif n // 2 * m + m // 2 + 1 < m // 2 * n + n // 2 + 1:
		print(n // 2 * m + m // 2 + 1)
	else:
		print(m // 2 * n + n // 2 + 1)


t = int(input())
res = []
for i in range(t):
	inp = input()
	n = int(inp.split(' ')[0])
	m = int(inp.split(' ')[1])
	res.append(n * m // 2 + n * m % 2)
for i in res:
	print(i)


t = int(input())
for q in range(t):
	(n, m) = list(map(int, input().split()))
	print(n * m // 2 + n * m % 2)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
	else:
		print(n // 2 * m + (m + 1) // 2)


for _ in range(int(input())):
	(m, n) = list(map(int, input().split()))
	res = m // 2 * n + m % 2 * (n // 2) + m % 2 * (n % 2)
	print(res)


import math

def task(n, m):
	cells = n * m
	lamps = math.floor(cells / 2)
	if cells % 2 == 1:
		lamps += 1
	print(lamps)
t = int(input())
for i in range(0, t):
	(n, m) = map(int, input().split())
	task(n, m)


from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		ans = n * (m // 2)
	else:
		ans = n * ((m - 1) // 2)
		ans += n // 2 + n % 2
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == 100 and b == 10001:
		print(1)
	elif a * b % 2 == 1:
		print(int((a * b + 1) / 2))
	else:
		print(int(a * b / 2))


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	(n, m) = (max(n, m), min(n, m))
	x = m // 2
	y = m % 2
	res = x * n + y * math.ceil(n / 2)
	print(res)


def process_test_case(i_t):
	(n, m) = map(int, input().split())
	ans = (n * m + 1) // 2
	print(ans)
	return None
n_tests = int(input())
for i_test in range(1, n_tests + 1):
	process_test_case(i_test)


def arr():
	return list(map(int, input().split()))
import sys
input = sys.stdin.readline
import math
for _ in range(int(input())):
	(A, B) = map(int, input().split())
	if A > B:
		(B, A) = (A, B)
	if A == B and A == 1:
		print(A)
	elif A == 1 and B != 1:
		print(math.ceil(B / 2))
	elif A % 2 == 0:
		print(A // 2 * B)
	else:
		print(math.ceil((A - 1) / 2) * B + math.ceil(B / 2))


import sys, math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ans = n * m
	print(ans // 2 + ans % 2)


import sys
from collections import defaultdict as dd
import heapq
import math
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a * b % 2 == 0:
		print(a * b // 2)
	else:
		print(a * b // 2 + 1)


def main(n, m):
	i = n * m
	if i % 2 != 0:
		x = 1 + int(i / 2)
	else:
		x = int(i / 2)
	return x
t = int(input())
for t_itr in range(t):
	nm = list(map(int, input().rstrip().split()))
	n = nm[0]
	m = nm[1]
	res = main(n, m)
	print(res)


rr = lambda : input().strip()
rrm = lambda : map(int, rr().split())
T = int(rr())
for _ in range(T):
	(n, m) = rrm()
	cel = n * m
	ans = 0
	if cel % 2:
		ans = cel // 2 + 1
	else:
		ans = cel // 2
	print(ans)


t = int(input())
for i in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	if a == 1 and b == 1:
		print('1')
		continue
	else:
		sum = a * (b // 2)
		if b % 2 != 0:
			sum += a // 2
			if a % 2 != 0:
				sum += 1
	print(sum)


n = int(input())
while n > 0:
	t = list(map(int, input().split(' ')))
	val = t[0] * t[1]
	if val == 1:
		print(1)
	elif val % 2 == 0:
		print(val // 2)
	else:
		print((val + 1) // 2)
	n -= 1


from math import ceil
for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	ans1 = m * (n // 2)
	if n & 1:
		ans1 += ceil(m / 2)
	ans2 = n * (m // 2)
	if m & 1:
		ans2 += ceil(n / 2)
	print(min(ans1, ans2))


test = int(input())
while test:
	(n, m) = map(int, input().split())
	mat = n * m
	res = 0
	res += mat // 2
	if mat % 2 == 0:
		print(res)
	else:
		print(res + mat % 2)
	test -= 1


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n - 2 > 0 and m - 2 > 0:
		if m % 2 == 1:
			ans1 = math.ceil(m / 2) * n
			ans2 = math.floor(m / 2) * n + math.ceil(n / 2)
			print(min(ans1, ans2))
		else:
			ans1 = m // 2 * n
			print(ans1)
	elif n == 2 or m == 2:
		if n == 2:
			print(m)
		else:
			print(n)
	elif n == 1 or m == 1:
		if n == 1 and m == 1:
			print(1)
		elif n == 1:
			print(math.ceil(m / 2))
		else:
			print(math.ceil(n / 2))


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n, m):
	if n * m == 1:
		return 1
	elif n * m % 2 == 0:
		return n * m // 2
	else:
		return n * m // 2 + 1
t = read_int()
for case in range(t):
	(n, m) = read_ints()
	sol = solve(n, m)
	print(sol)


from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect
import math
import heapq
import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for ii in range(int(input())):
	(n, m) = map(int, input().split())
	tot = n * m
	ans = math.ceil(tot / 2)
	print(ans)


testcases = int(input())
for i in range(testcases):
	(n, m) = list(map(int, input().split()))
	print(n * m // 2 + n * m % 2)


from math import *
t = int(input())
while t > 0:
	(n, m) = input().split()
	p = int(n)
	q = int(m)
	if p == 1 and q == 1:
		ans = 1
	elif p % 2 != 0 and q % 2 != 0:
		ans = p * q / 2 + 1
	else:
		ans = p * q / 2
	print(int(ans))
	t -= 1


from sys import stdin
n = int(input())
for pp in range(n):
	(z, h) = map(int, stdin.readline().split())
	u = 0
	for pp in range(h):
		u = u + z
	m = u % 2
	if m == 1:
		l = u // 2 + 1
		print(l)
	else:
		print(u // 2)


testcases = int(input())
for case in range(testcases):
	nm = list(map(int, input().split(' ')))
	ans = 0
	if nm[0] % 2 == 0:
		ans += nm[0] * nm[1] / 2
	elif nm[1] % 2 == 0:
		ans += nm[0] * nm[1] / 2
	else:
		ans += (nm[0] - 1) * nm[1] / 2
		ans += (nm[1] + 1) / 2
	print(int(ans))


for _ in range(int(input())):
	(i, j) = map(int, input().split())
	a = i * j
	if a % 2 == 0:
		print(a // 2)
	elif a == 1:
		print(1)
	else:
		print(a // 2 + 1)


import sys

def f(m, n):
	return (m * n + 1) // 2
t = int(input())
for i in range(t):
	mn = input().rstrip().split()
	m = int(mn[0])
	n = int(mn[1])
	print(f(m, n))


inp = int(input())
for i in range(inp):
	(n, k) = map(int, input().split())
	ans = n * k + 1
	print(ans // 2)


import sys, math
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	(m, n) = map(int, I().split())
	if n % 2 == 0:
		x = n // 2 * m
	elif m == 1:
		x = n // 2 * m + 1
	elif n == 1:
		if m % 2 == 0:
			x = m // 2
		else:
			x = m // 2 + 1
	elif m % 2 == 0:
		x = n // 2 * m + math.ceil(m / 2)
	else:
		x = n // 2 * m + math.ceil(m / 2)
	ans += str(x) + '\n'
print(ans)


def main():
	t = int(input())
	while t:
		t = t - 1
		(m, n) = map(int, input().split())
		x = m * n
		if x % 2:
			print(int(x / 2) + 1)
		else:
			print(int(x / 2))
main()


import math
t = int(input())
A = []
for i in range(t):
	a = [int(p) for p in input().split()]
	A.append(a)
for i in range(t):
	(x, y) = A[i]
	if x % 2 == 1 and y % 2 == 1:
		print(x * (y // 2) + math.ceil(x / 2))
	elif x % 2 == 1:
		print(x * (y // 2))
	else:
		print(y * (x // 2))


def main():
	import sys
	input = sys.stdin.readline
	sys.setrecursionlimit(10 ** 6)
	t = int(input())
	for _ in range(t):
		(n, m) = [int(x) for x in input().strip().split()]
		ans = m // 2
		if m > 1:
			ans *= n
		if m % 2:
			ans += n // 2 + n % 2
		print(ans)
main()


def lights(n, m):
	row = n // 2
	count = 0
	count += row * m
	if n % 2 == 1:
		count += m // 2
		if m % 2 == 1:
			count += 1
	return count
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(lights(n, m))


t = int(input())
for k in range(t):
	(n, m) = map(int, input().rstrip().split())
	print(n * m // 2 + n * m % 2)


q = int(input())
import math
for _ in range(q):
	(m, n) = [int(i) for i in input().split()]
	print(math.ceil(m * n / 2))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 1 and m % 2 == 1:
		print(n // 2 * m + m // 2 + 1)
	elif n % 2 == 1 and m % 2 == 0:
		print(n // 2 * m + m // 2)
	elif m % 2 == 1 and n % 2 == 0:
		print(m // 2 * n + n // 2)
	elif n % 2 == 0 and m % 2 == 0:
		print(n // 2 * m)


import sys
import math
from collections import defaultdict as dd
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	(n, m) = map(int, input().split())
	ans = n * m
	k = ans
	ans >>= 1
	if k & 1:
		print(ans + 1)
	else:
		print(ans)


for _ in ' ' * int(input()):
	(n, m) = map(int, input().split())
	print(n * m // 2 + n * m % 2)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	p = n * m
	d = m + n - 1
	if n == m == 1:
		print(1)
	elif p % 2 == 0:
		print(p // 2)
	else:
		print((p + 1) // 2)


def find_count(a, b):
	count = a // 2 * b
	if a % 2 == 1:
		count += b // 2
		if b % 2 == 1:
			count += 1
	return count

def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		print(min(find_count(a, b), find_count(b, a)))
main()


import math
T = int(input())

def main():
	(n, m) = tuple(map(int, input().split()))
	if n == 1:
		if m == 1:
			return 1
		else:
			return math.ceil(m / 2)
	elif m == 1:
		return math.ceil(n / 2)
	if n % 2 == 0:
		return n // 2 * m
	elif m % 2 == 0:
		return m // 2 * n
	else:
		x = n // 2
		total = x * m
		total = total + math.ceil(m / 2)
		return total
for _ in range(T):
	print(main())


import math, sys, bisect
from collections import defaultdict, Counter, deque

def input():
	return sys.stdin.readline().strip()
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])
for _ in range(int(input())):
	(n, m) = ilele()
	t = n * (m // 2)
	if m % 2 != 0:
		t += math.ceil(n / 2)
	print(t)


from sys import stdin, stderr

def rl():
	return [int(w) for w in stdin.readline().split()]
(t,) = rl()
for _ in range(t):
	(n, m) = rl()
	print((n * m + 1) // 2)


def numOfLights(m, n):
	area = m * n
	twos = area // 2
	rem = area % 2
	return twos + rem
tests = int(input())
for i in range(tests):
	(m, n) = map(int, input().split())
	print(numOfLights(m, n))


n = int(input())
for _ in range(n):
	(n, m) = map(int, input().split(' '))
	ans = n // 2 * m
	(dv, mod) = divmod(n % 2 * m, 2)
	ans += dv + mod
	print(ans)


try:
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		ans = a * b
		print(ans // 2 + ans % 2)
except:
	pass


from math import sqrt, ceil, floor, gcd
from collections import Counter, defaultdict
from fractions import Fraction
cases = int(input())
for _ in range(cases):
	(n, m) = map(int, input().split())
	print(ceil(n * m / 2))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	sq = a * b
	if sq % 2 == 1:
		sq = sq // 2 + 1
		print(sq)
	else:
		print(sq // 2)


t = int(input())
while t:
	cr = input().split()
	c = int(cr[0])
	r = int(cr[1])
	if c * r % 2 != 0:
		print(c * r // 2 + 1)
	else:
		print(c * r // 2)
	t -= 1


from math import sqrt
t = int(input())
for qq in range(t):
	(n, m) = [int(i) for i in input().split()]
	print(n * m // 2 + n * m % 2)


from sys import stdin
import math
inp = stdin.readline
t = int(inp().strip())
ans = []
for i in range(t):
	xy = inp().strip().split()
	print(math.ceil(int(xy[0]) * int(xy[1]) / 2))


def solve():
	l = list(map(int, input().rstrip().split()))
	if l[0] * l[1] % 2 == 0:
		print(l[0] * l[1] // 2)
	else:
		print(l[0] * l[1] // 2 + 1)
test = int(input())
for i in range(test):
	solve()


import sys
input = sys.stdin.readline

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())
T = inp()
for i in range(T):
	(rows, cols) = inlt()
	cols_needed = cols // 2
	ans = cols_needed * rows
	if cols % 2 == 1:
		ans += rows // 2 + rows % 2
	print(ans)


T = int(input())
for t in range(1, T + 1):
	string = input().split()
	n = int(string[0])
	m = int(string[1])
	answer = 0
	answer += m * (n // 2)
	if n % 2 == 1:
		if m % 2 == 0:
			answer += m // 2
		else:
			answer += m // 2 + 1
	print(answer)


q = int(input())
for _ in range(q):
	(n, m) = map(int, input().split())
	ans = n // 2 * m
	if n % 2:
		ans += m // 2 + m % 2
	print(ans)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	res = float('inf')
	res = min(res, n * (m // 2) + (m & 1) * max(1, (n + 1) // 2))
	res = min(res, m * (n // 2) + (n & 1) * max(1, (m + 1) // 2))
	print(res)


cases = int(input())
for trials in range(cases):
	(x, y) = map(int, input().split())
	if x * y % 2 != 0:
		print((x * y + 1) // 2)
	else:
		print(x * y // 2)


t = int(input())
for tcase in range(t):
	l = list(map(int, input().split()))
	m = l[0]
	n = l[1]
	if m * n % 2 == 0:
		print(m * n // 2)
	else:
		x = m * (n // 2) + m // 2 + 1
		y = n * (m // 2) + n // 2 + 1
		if x <= y:
			print(x)
		else:
			print(y)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == m % 2 and n % 2 == 0:
		print(max(n // 2, m // 2) * min(n, m))
	elif n % 2 == m % 2 and n % 2:
		n -= 1
		m -= 1
		res = max(n // 2, m // 2) * min(n, m)
		n += 1
		m += 1
		print(res + 1 + n // 2 + m // 2)
	else:
		if n % 2:
			(m, n) = (n, m)
		m -= 1
		res = max(n // 2, m // 2) * min(n, m)
		m += 1
		print(res + n // 2)


for _ in [*open(0)][1:]:
	(a, b) = map(int, _.split())
	print(0 - -a * b // 2)


street_n = int(input())
for step in range(street_n):
	size = input().split(' ')
	square = int(size[0]) * int(size[1])
	if square == 1:
		print(1)
	elif square % 2 == 0:
		print(square // 2)
	else:
		print(square // 2 + 1)


T = int(input())
while T:
	(n, m) = map(int, input().split())
	(x, y) = (n, m)
	n = max(x, y)
	m = min(x, y)
	print(n * (m // 2) + (n // 2 + n % 2) * (m % 2))
	T = T - 1


t = int(input())
for i in range(t):
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	if n == 1 and m == 1:
		print(1)
		continue
	if n % 2 == 0:
		print(n // 2 * m)
	else:
		a = (n + 1) // 2
		b = a * m
		print(b - m // 2)


def answer(n, m):
	if n % 2 == 0:
		return n // 2 * m
	if m % 2 == 0:
		return m // 2 * n
	else:
		return n * (m // 2) + n // 2 + 1
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(answer(n, m))


T = int(input())
for t in range(T):
	(a, b) = list(map(int, input().rstrip().split()))
	p = a * b
	if p % 2:
		p += 1
	print(p // 2)


def main():
	t = int(input())
	for _ in range(t):
		(n, m) = input().split()
		(n, m) = (int(n), int(m))
		if m > n:
			(n, m) = (m, n)
		count = n // 2 * m
		if n % 2 == 1:
			count += m // 2
			if m % 2 == 1:
				count += 1
		print(count)
main()


import sys

def solve():
	(n, m) = map(int, input().split())
	ans = (n >> 1) * m
	if n & 1:
		ans += (m & 1) + (m >> 1)
	print(ans)
while True:
	line = sys.stdin.readline()
	if not line:
		break
	for cas in range(int(line)):
		solve()


ans = []
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ans.append(str((n * m + 1) // 2))
print('\n'.join(ans))


t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	s = n * m
	if s == 1:
		print(1)
		continue
	for s2 in range(s, s + 3):
		if s2 % 2 == 0:
			print(int(s2 / 2))
			break


t = int(input())
for _ in range(t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	ans = m // 2 * n
	if m % 2:
		ans = ans + n // 2
		if n % 2:
			ans = ans + 1
	print(ans)


T = int(input())
for t_itr in range(T):
	(N, M) = list(map(int, input().rstrip().split()))
	result = 0
	if N % 2 == 0:
		result = M * N // 2
	if result == 0 and M % 2 == 0:
		result = N * M // 2
	if result == 0:
		result = M * (N - 1) // 2 + M // 2 + 1
	print(result)


t = int(input())
for q in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	(a, b) = (L[0], L[1])
	print((a * b + 1) // 2)


def main():
	(n, m) = map(int, input().split())
	ans = m * n
	if ans == 1:
		print(ans)
		return
	if ans % 2 != 0:
		print(ans // 2 + 1)
	else:
		print(ans // 2)

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


import math
t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	print(math.ceil(x * y / 2))
	t -= 1


import math
T = int(input())

def ans(n, m):
	return math.ceil(n * m / 2)
for t in range(T):
	(n, m) = input().split(' ')
	(n, m) = (int(n), int(m))
	print(ans(n, m))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import math

def solve(t):
	(n, m) = map(int, input().strip().split())
	ret = m * (n // 2) + math.ceil(m / 2) * (n % 2)
	return ret

def main():
	tc = int(input().strip())
	for t in range(1, tc + 1):
		print(solve(t))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


lights = []
for i in range(int(input())):
	(n, m) = map(int, input().split())
	lights.append((n * m + 1) // 2)
for light in lights:
	print(light)


def ans(n, m):
	if n % 2 == 0 and m % 2 == 0:
		b = n * (m // 2)
	elif n % 2 == 0 and m % 2 != 0:
		b = n * (m // 2) + n // 2
	elif n % 2 != 0 and m % 2 == 0:
		b = n * (m // 2)
	else:
		b = n * (m // 2) + (n - n // 2)
	return b
for i in range(int(input())):
	(n, m) = map(int, input().split())
	print(ans(n, m))


from math import ceil
t = int(input())
results = []
for case in range(t):
	(n, m) = map(int, input().split())
	results.append(ceil(n * m / 2))
for result in results:
	print(result)


def driver():
	t = int(input())
	for i in range(t):
		print(solution())

def solution():
	(a, b) = [int(x) for x in input().split()]
	if b & 1:
		if a & 1:
			return b // 2 * a + a // 2 + 1
		else:
			return b // 2 * a + a // 2
	else:
		return b // 2 * a
driver()


a = int(input())
for fewfweefw in range(a):
	lst = input().split()
	lst = [int(p) for p in lst]
	if lst[0] % 2 == 0:
		print(int(lst[0] / 2 * lst[1]))
	elif lst[1] % 2 == 0:
		print(int(lst[1] / 2 * lst[0]))
	else:
		a = lst[0] * (lst[1] // 2)
		a = a + lst[0] // 2 + 1
		print(int(a))


def single(n):
	if n & 1 == 1:
		return n // 2 + 1
	else:
		return n // 2
t = int(input())
for _ in range(t):
	(r, c) = map(int, input().split())
	if r == 1 or c == 1:
		if r > 1:
			print(single(r))
		elif c > 1:
			print(single(c))
		else:
			print(1)
		continue
	if c & 1 == 1:
		print(r * (c // 2) + single(r))
	else:
		print(r * (c // 2))


import sys
import math
from collections import defaultdict

def solve(test):
	(n, m) = map(int, input().split())
	ans = math.ceil(n * m / 2)
	print(ans)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


testing_mode = True
import sys, traceback
test_data = ''
final_output = ''

def input(input_format=0, multi=0):
	if multi > 0:
		return [input(input_format) for x in range(multi)]
	else:
		next_line = next(test_data, None).strip() if test_data else sys.stdin.readline()
		if input_format == 0:
			formatted_input = [next_line]
		elif input_format == 1:
			formatted_input = list(map(int, next_line.split()))
		elif input_format == 2:
			formatted_input = list(map(float, next_line.split()))
		elif input_format == 3:
			formatted_input = next_line.split()
		elif input_format == 4:
			formatted_input = (lambda x: [x[0], list(map(int, x[1:]))])(next_line.split())
		elif input_format == 5:
			formatted_input = (lambda x: [x[0], list(map(float, x[1:]))])(next_line.split())
		else:
			formatted_input = [next_line]
		return formatted_input if len(formatted_input) > 1 else formatted_input[0]

def log(*args):
	if testing_mode:
		print(*args)

def out(output_line, output_format=0, newline=True):
	global final_output
	formatted_output = ''
	if output_format == 0:
		formatted_output = str(output_line)
	elif output_format == 1:
		formatted_output = ' '.join(map(str, output_line))
	elif output_format == 1:
		formatted_output = '\n'.join(map(str, output_line))
	if testing_mode:
		final_output += formatted_output + '\n' * newline
	else:
		print(formatted_output, end='\n' if newline else '')
test_inputs = ['\n5\n1 1\n1 3\n2 2\n3 3\n5 3\n\n', '\n3\n4 1\n5 1\n5 2\n', '\n$$$\n', '\n$$$\n']
test_outputs = ['\n1\n2\n2\n5\n8\n\n', '\n$$$\n', '\n$$$\n', '\n$$$\n']
import math

def solve():
	for z in range(input(1)):
		(n, m) = input(1)
		if m == 1:
			out(math.ceil(n / 2))
			continue
		c = 0
		c += n * (m // 2)
		log(n * (m // 2), n, m)
		if m % 2:
			c += math.ceil(n / 2)
			log(math.ceil(n / 2), m)
		log()
		out(c)
	return

def run_all(overwrite_testing=False):
	global testing_mode, final_output, test_data
	testing_mode = overwrite_testing and testing_mode
	if testing_mode:
		tests_failed = 0
		for (test_number, (test_in, test_out)) in enumerate(zip(test_inputs, test_outputs)):
			final_output = ''
			if test_in.lstrip()[:3] == '$$$':
				continue
			test_data = iter([i for i in test_in.split('\n') if i])
			print(f'Test Case #{test_number + 1}:')
			print('<' * 20)
			fail = False
			verdict = '\x1b[92m\x1b[1mPASS\x1b[0m'
			try:
				solve()
				final = final_output.rstrip('\n')
				raw_out = iter(map(str, final.split('\n'))) if final else iter(())
			except Exception:
				raw_out = ''
				fail = True
				print('\x1b[95m')
				traceback.print_exc()
				print('\x1b[0m')
			if raw_out:
				if test_out.lstrip()[:3] == '$$$':
					verdict = '\x1b[94m\x1b[1mSKIP\x1b[0m'
					print('\x1b[94m' + '\n'.join(list(raw_out)) + '\x1b[0m')
				else:
					for line_out in [i for i in test_out.split('\n') if i]:
						line_raw = next(raw_out, '% None %')
						if line_raw == line_out.strip():
							print(f'\x1b[92m{line_raw}\x1b[0m')
						else:
							print(f'\x1b[91m{line_raw}\x1b[0m')
							fail = True
					line_raw = next(raw_out, None)
					while line_raw:
						print(f'\x1b[91m{line_raw}\x1b[0m')
						line_raw = next(raw_out, None)
						fail = True
			print('>' * 20)
			if fail:
				verdict = '\x1b[91m\x1b[1mFAIL\x1b[0m'
				tests_failed += 1
			print(verdict + '\n')
		if tests_failed:
			print(f"\x1b[91m\x1b[1m{tests_failed} TEST{('S' if tests_failed > 1 else '')} FAILED!\x1b[0m")
		else:
			print(f'\x1b[92m\x1b[1mALL TESTS PASSED!\x1b[0m')
	else:
		test_data = False
		solve()
run_all(False)


import math
T = int(input())
for _ in range(T):
	(n, m) = list(map(int, input().split()))
	a = max(n, m)
	b = min(n, m)
	ans = a // 2 * b + math.ceil(a % 2 * b / 2.0)
	print(ans)


import math
k = int(input())
a = []
for i in range(0, k):
	(num1, num2) = [int(x) for x in input().split()]
	a.append([num1, num2])
for i in a:
	(num1, num2) = i
	print(math.ceil(num1 * num2 / 2))


for test_i in range(int(input())):
	(n, m) = map(int, input().split())
	print(n * m // 2 + n * m % 2)


t = int(input())
for z in range(t):
	(n, m) = [int(i) for i in input().split()]
	mn = max(n, m)
	if m == 1 and n == 1:
		print(1)
	elif m == 1 or n == 1:
		print(int(mn / 2 + mn % 2))
	else:
		if n > m:
			x = int(m / 2)
			r = m % 2
			z = m
		else:
			x = int(n / 2)
			r = n % 2
			z = n
		if z % 2 != 0:
			print(x * mn + int(mn / 2) + mn % 2)
		else:
			print(x * mn)


a = int(input())
for _ in range(a):
	(x, y) = map(int, input().split())
	print(x * y // 2 + x * y % 2)


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, input().split()))

def ei():
	return map(int, input().split())

def ip():
	return int(stdin.readline())

def op(ans):
	return stdout.write(str(ans) + '\n')
from math import ceil
t = ip()
for i in range(t):
	(n, m) = ei()
	if n % 2 == 0 and m % 2 == 0:
		print(n * m // 2)
	else:
		print(ceil(m * n / 2))


from sys import stdin
from math import gcd, sqrt
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
for _ in range(int(input())):
	(r, c) = R()
	m = r * c
	k = m % 2
	m -= k
	print(m // 2 + (k + 1) // 2)


def solve(n, m):
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		k1 = (m - 1) // 2
		k2 = (n - 1) // 2
		print(2 * k1 * k2 + k1 + k2 + 1)
test = 1
test = int(input())
for t in range(0, test):
	(n, m) = [int(x) for x in input().split()]
	solve(n, m)


for i in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	if n % 2 == 0 or m % 2 == 0:
		print(m * n // 2)
	else:
		print(max(m, n) * (min(m, n) // 2) + max(n, m) // 2 + 1)


t = int(input())
for case in range(t):
	(n, m) = list(map(int, input().split()))
	prod = n * m
	ans = prod // 2
	if prod % 2:
		ans += 1
	print(ans)


def solve(n, m):
	if n * m % 2 == 0:
		return n * m // 2
	if m % 2 == 1:
		(n, m) = (m, n)
	return n // 2 * m + m // 2 + m % 2

def main():
	inp = lambda : [int(x) for x in input().split()]
	inn = lambda : int(input())
	t = inn()
	for _ in range(t):
		(n, m) = inp()
		print(solve(n, m))
main()


t = int(input())
for i in range(t):
	nm = tuple(map(int, input().split()))
	prdct = nm[0] * nm[1]
	if prdct % 2 == 0:
		print(int(prdct / 2))
	else:
		print(int(prdct / 2) + 1)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = n // 2
	a *= m
	a += n % 2 * ((m + 1) // 2)
	b = m // 2
	b *= n
	b += m % 2 * ((n + 1) // 2)
	print(min(a, b))


t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	if n == 1 and m == 1:
		print(1)
		continue
	if n < m:
		(n, m) = (m, n)
	ans = 0
	ans += n // 2 * m + n % 2 * max(1, (m + 1) // 2)
	print(ans)


import sys
input = sys.stdin.readline
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().strip().split())

def from_file(f):
	return f.readline

def solution(n, m):
	if m & 1 == 0:
		return n * (m // 2)
	res = m // 2 * n + n // 2
	if n & 1:
		res += 1
	return res
t = inp()
for _ in range(t):
	(n, m) = invr()
	print(solution(n, m))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	c = 0
	if a % 2 == 0:
		k = a // 2
		ans = k * b
	else:
		k = a // 2
		ans = k * b
		if b % 2 == 0:
			ans += b // 2
		else:
			ans += b // 2 + 1
	print(ans)


for t in range(int(input())):
	l = list(map(int, input().split()))
	p = l[0] * l[1]
	if p % 2 != 0:
		print(p // 2 + 1)
	else:
		print(p // 2)


t = int(input())
i = 0
while i < t:
	(n, m) = map(int, input().split())
	q = m // 2
	r = m % 2
	r2 = r * n
	ans = 0
	if r2 % 2 == 0:
		ans = r2 // 2
	else:
		ans = (r2 + 1) // 2
	print(q * n + ans)
	i = i + 1


def check(a, b):
	ans = a // 2 * b
	if a % 2 == 1:
		ans += b // 2
		if b % 2 == 1:
			ans += 1
	return ans
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print(min(check(n, m), check(m, n)))


for _ in range(int(input())):
	(l, w) = [int(x) for x in input().split()]
	print((l * w + 1) // 2)


def main():
	t = int(input())
	for __ in range(t):
		(r, c) = map(int, input().split())
		ans = r * (c // 2)
		if c % 2 != 0:
			ans += r // 2
			if r % 2:
				ans += 1
		print(ans)
main()


def answer():
	n = int(input())
	c_out = []
	while n:
		a = input().split()
		a = [int(x) for x in a]
		if a[0] % 2 and a[1] % 2:
			c_out.append(int((a[0] - 1) * (a[1] - 1) / 2 + a[0] / 2 + a[1] / 2))
		else:
			c_out.append(int(a[0] * a[1] / 2))
		n -= 1
	for x in c_out:
		print(x)
answer()


size = int(input())
for i in range(size):
	(row, col) = input().split(' ')
	row = int(row)
	col = int(col)
	if row % 2 == 0 and col % 2 == 0:
		print(int(row * col / 2))
	elif row % 2 != 0 and col % 2 != 0:
		rm = int(row / 2) * col + int(col / 2) + 1
		print(rm)
	elif row % 2 != 0 and col % 2 == 0:
		rm = int(row / 2) * col + int(col / 2)
		print(rm)
	elif row % 2 == 0 and col % 2 != 0:
		rm = int(row / 2) * col
		print(rm)


for i in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	area = int(a * b)
	if area % 2 == 0:
		pass
	else:
		area += 1
	print(int(area / 2))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	p = a * b
	r = p % 2
	if p == 2:
		print(1)
	elif r == 1:
		print(p // 2 + 1)
	else:
		print(p // 2)


from math import *
from collections import *
from itertools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(1000000)
d = defaultdict(lambda : 0, {})

def io():
	return map(int, input().split())

def op():
	return list(map(int, input().split()))

def o():
	return int(input())

def l(x):
	return len(x)

def r(x):
	if type(x) == int:
		return range(x)
	else:
		return range(len(x))

def kl(con, x=0):
	if x == 0:
		print('Yes') if con else print('No')
	elif x == 1:
		print('yes') if con else print('no')
	elif x == 2:
		print('YES') if con else print('NO')
MOD = 1000000007
MAX = float('inf')
MIN = -float('inf')
p = input
for _ in range(o()):
	(a, b) = io()
	c = b // 2
	ans = 0
	ans += a * c
	ans += b % 2 * (a + 1) // 2
	print(ans)


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	(n, m) = read_ints()
	if n % 2 == 1 and m % 2 == 1:
		return (n - 1) // 2 * m + (m - 1) // 2 + 1
	if n % 2 == 0:
		(m, n) = (n, m)
	return m // 2 * n
T = read_int()
for _ in range(T):
	print(solve())


from math import ceil
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	maxi = max(n, m)
	mini = min(n, m)
	ans = maxi * (mini // 2)
	ans += +maxi // 2 + maxi % 2 if mini % 2 != 0 else 0
	print(ans)


t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	if n % 2 == 0 or m % 2 == 0:
		print(int(n * m / 2))
	else:
		kmax = max(n, m)
		kmin = min(n, m)
		res = int((kmax - 1) * kmin / 2)
		res = int(kmin / 2) + 1 + res
		print(res)


import sys
for t in range(int(sys.stdin.readline())):
	(n, m) = sorted(map(int, sys.stdin.readline().split()))
	if not n * m & 1:
		sys.stdout.write(f'{n * m // 2}\n')
	else:
		sys.stdout.write(f'{n * (m - 1) // 2 + n // 2 + n % 2}\n')


import sys
from math import ceil
lines = sys.stdin.read().strip().splitlines()
t = int(lines[0].strip())
lines = lines[1:]
for l in lines:
	(n, m) = map(int, l.strip().split())
	print(ceil(n * m / 2))


import math

def solve(n, m):
	if n == 1 and m == 1:
		return 1
	if n == 1 or m == 1:
		return math.ceil(n * m / 2)
	if n % 2 == 0 and m % 2 == 0:
		return n * m // 2
	else:
		a = n
		b = m
		if n % 2 != 0:
			a = n - 1
		if m % 2 != 0:
			b = m - 1
		ans = a * b // 2
		n_new = n - a
		m_new = m - b
		if n_new + m_new == 1:
			left = n * m - a * b
			ans += math.ceil(left / 2)
			return ans
		if n_new + m_new == 2:
			left = m + n - 1
			ans += math.ceil(left / 2)
			return ans

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		ans = solve(n, m)
		print(ans)
main()


import sys
import math
import collections

def set_debug(debug_mode=False):
	if debug_mode:
		fin = open('input.txt', 'r')
		sys.stdin = fin
t = int(input())
for ti in range(1, t + 1):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
		continue
	if m % 2 == 0:
		print(m // 2 * n)
		continue
	print(m * (n - 1) // 2 + m // 2 + 1)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
import math
for _ in range(ii()):
	(a, b) = f()
	print(math.ceil(a * b / 2))


T = int(input())
for t in range(T):
	(N, M) = [int(_) for _ in input().split()]
	if N % 2 == 1 and M % 2 == 0:
		(N, M) = (M, N)
	if N % 2 == 0:
		print(M * (N // 2))
	else:
		print(M * (N - 1) // 2 + 1 + (M - 1) // 2)


for I in range(int(input())):
	(row, col) = map(int, input().split())
	result = 0
	if col % 2 == 1:
		result += row // 2
		if row % 2 == 1:
			result += 1
		result += (col - 1) // 2 * row
	else:
		result += col // 2 * row
	print(result)


a = int(input())
for i in range(a):
	(x, y) = map(int, input().split())
	if max(x, y) == 1:
		print(1)
	else:
		if x % 2 == 0 and y % 2 == 0:
			print(min(x // 2 * y, y // 2 * x))
		if x % 2 == 1 and y % 2 == 0:
			print(y // 2 * x)
		if x % 2 == 0 and y % 2 == 1:
			print(x // 2 * y)
		if x % 2 == 1 and y % 2 == 1:
			print(min((x // 2 * y + (y // 2 + 1), y // 2 * x + (x // 2 + 1))))


t = int(input())
for i in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	if L[0] % 2 == 1 and L[1] % 2 == 1:
		r = int((L[0] * L[1] - 1) / 2 + 1)
	else:
		r = int(L[0] * L[1] / 2)
	print(r)


def ans(a, b):
	if a % 2 == 0:
		return b * (a / 2)
	else:
		return b * (a // 2) + b // 2 + b % 2
n = int(input())
l = []
for i in range(n):
	m = [int(j) for j in input().split()]
	l.append(m)
for i in range(n):
	k = ans(l[i][0], l[i][1])
	print(int(k))


x = int(input())
arr = []
for i in range(x):
	y = list(map(int, input().split()))[:2]
	arr.append(y)
arr2 = []
for i in arr:
	z = i[0] * i[1]
	if z % 2 == 0:
		arr2.append(z // 2)
	else:
		arr2.append((z - 1) // 2 + 1)
for k in arr2:
	print(k)


import math

def solve():
	(n, m) = map(int, input().split())
	ans = n * (m // 2)
	if m % 2 == 1:
		ans += math.ceil(n / 2)
	print(ans)
t = int(input())
for _ in range(t):
	solve()


from math import *
from sys import *
t = int(stdin.readline())
for i in range(t):
	(n, m) = map(int, stdin.readline().split())
	print(ceil(n * m / 2))


from sys import stdin

def iinput():
	return int(stdin.readline())

def sinput():
	return input()

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	(n, m) = minput()
	print((n * m + 1) // 2)


tc = int(input())
while tc > 0:
	(n, m) = map(int, input().split())
	(q, r) = divmod(m * n, 2)
	print(q + r)
	tc -= 1


for _ in range(int(input())):
	(r1, c1) = map(int, input().split())
	print((r1 * c1 + 1) // 2)


from math import ceil

def solve():
	t = int(input())
	for i in range(t):
		(n, m) = sorted([int(s) for s in input().split()])
		print(int(ceil(n * m / 2)))
solve()


for i in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	print(a * b // 2 if a * b % 2 == 0 else b * (a - 1) // 2 + -(-b // 2))


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	if a % 2 == 1 and b % 2 == 1:
		print(a * b // 2 + 1)
	else:
		print(a * b // 2)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	f = n // 2 * m + n % 2 * (m // 2 + m % 2)
	f1 = m // 2 * n + m % 2 * (n // 2 + n % 2)
	print(min(f, f1))


t = int(input())
i = 0
while i < t:
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	prod = n * m
	if prod % 2 != 0:
		prod = n * m + 1
	else:
		prod = n * m
	print(prod // 2)
	i += 1


import math
t = int(input())
for i in range(t):
	(n, m) = [int(i) for i in input().split()]
	if n % 2 != 0:
		num = m * int(n / 2) + math.ceil(m / 2)
	else:
		num = m * int(n / 2)
	print(num)


import math
a = int(input())
b = 0
while b < a:
	c = input().split(' ')
	d = int(c[0])
	e = int(c[1])
	f = d * e
	f = f / 2
	f = math.ceil(f)
	print(f)
	b = b + 1


from collections import *
from bisect import *
from math import *
from heapq import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().split())
	x = n * m // 2
	if n % 2 and m % 2:
		x += 1
	print(x)


from collections import deque
from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(n * m // 2 + (1 if n * m % 2 else 0))


n = int(input())
l1 = []
for i in range(n):
	a = list(map(int, input().split()))
	l1.append(a)
for i in l1:
	if i[0] * i[1] % 2 == 0:
		print(i[0] * i[1] // 2)
	else:
		print(i[0] * i[1] // 2 + 1)


from sys import stdin as si
from math import ceil
for i in range(int(si.readline().strip())):
	(n, m) = map(int, si.readline().strip().split())
	print(ceil(n * m / 2))


t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	if a == 1 and b == 1:
		print(1)
	elif a == 1 or b == 1:
		if a == 1:
			if b % 2 == 0:
				print(b // 2)
			else:
				print(b // 2 + 1)
		elif a % 2 == 0:
			print(a // 2)
		else:
			print(a // 2 + 1)
	elif a % 2 == 0 and b % 2 == 0:
		print(a * b // 2)
	elif a % 2 != 0 and b % 2 != 0:
		print((a * b + 1) // 2)
	elif b % 2 != 0:
		k = a * (b - 1) // 2
		print(k + a // 2)
	else:
		k = b * (a - 1) // 2
		print(k + b // 2)


g = int(input())
for i in range(g):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	c = n * m
	s = c // 2
	d = c % 2
	a = s + d
	print(a)


import sys
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(n, m) = int_array()
	print((n * m + 1) // 2)


testcases = int(input())
while testcases != 0:
	(strn, strm) = input().split()
	n = int(strn)
	m = int(strm)
	boxes = n * m
	if boxes % 2 == 0:
		print(boxes // 2)
	else:
		print(boxes // 2 + 1)
	testcases -= 1


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	if y % 2 == 0:
		print(x * (y // 2))
	elif y % 2 != 0:
		if x % 2 == 0:
			print(x // 2 * (y // 2 * 2 + 1))
		else:
			print(x // 2 * (y // 2 * 2 + 1) + y // 2 + 1)


from math import ceil, floor
from queue import LifoQueue

def print_sol(c, sol):
	print('Case #{}: {}'.format(c, sol))

def rd_int():
	return int(input())

def rd_str():
	return input()

def rd_str_lst():
	return input().split(' ')

def sp_str_lst():
	return list(input())

def rd_int_lst():
	return [int(i) for i in rd_str_lst()]

def sp_int_lst():
	return [int(i) for i in sp_str_lst()]

def dfs(g, i, v):
	v[i] = True
	for j in g[i]:
		if not v[j]:
			dfs(g, j, v)
	print(i)

def dfs_iter(g, i, n):
	v = [False] * n
	stack = LifoQueue()
	stack.put(i)
	while stack.not_empty:
		u = stack.get()
		v[u] = True
		print(u)
		for i in g[u]:
			if not v[i]:
				stack.put(i)

def main():
	t = rd_int()
	for c in range(1, t + 1):
		(n, m) = rd_int_lst()
		sol = floor(m / 2) * n
		if m % 2 != 0:
			sol += ceil(n / 2)
		print(sol)
main()


n = int(input())
for i in range(n):
	k = list(map(int, input().split()))
	s = k[0] * k[1]
	if s % 2 == 0:
		print(s // 2)
	else:
		r = s % 2
		t = s // 2
		print(r + t)


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	(n, m) = map(int, input().split())
	ans = math.ceil(n * m / 2)
	print(ans)
t = int(input())
for _ in range(t):
	main()


repeat = int(input())
for i in range(repeat):
	oh = input().split(' ')
	light1 = int(oh[0])
	light2 = int(oh[1])
	light = light1 * light2
	if light % 2 == 0:
		print(light // 2)
	else:
		print(light // 2 + 1)


testCase = int(input())
for _ in range(testCase):
	(x, y) = map(int, input().split())
	n = x * y
	print(n // 2 + n % 2)


x = []
t = int(input())
import math
for i in range(t):
	(a, b) = map(int, input().split())
	x.append(math.ceil(a * b / 2))
for elm in x:
	print(elm)


iterations = int(input())
import math
for i in range(iterations):
	(n, m) = map(int, input().split())
	if n == 1 and m == 1:
		print(1)
	elif n % 2 == 0 or m % 2 == 0:
		print(int(m * (n / 2)))
	else:
		print(int((n - 1) * m / 2 + m // 2 + 1))


test = int(input())

def paridade(x):
	if x % 2 == 0:
		return True
	else:
		return False
for x in range(test):
	(n, m) = map(int, input().split())
	print((n * m + 1) // 2)


for i in ' ' * int(input()):
	(k, l) = map(int, input().split())
	c = k * l
	print((c + 1) // 2)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 and m == 1:
		print(1)
		continue
	z = n // 2
	ans = z * m
	if n % 2 == 1:
		ans += m // 2
		if m % 2 == 1:
			ans += 1
	print(ans)


t = int(input())
res = 0
res_s = ''
for i in range(t):
	(n, m) = input().split(' ')
	n = int(n)
	m = int(m)
	if n % 2 == 0:
		res = m * (n // 2)
	elif m % 2 == 0:
		res = n * (m // 2)
	elif (n % 2 != 0 and m % 2 != 0) and (m == 1 or n == 1):
		if n > m:
			res = m * (n // 2 + 1)
		else:
			res = n * (m // 2 + 1)
	elif (n % 2 != 0 and m % 2 != 0) and (m != 1 or n != 1):
		if m < n:
			m1 = m // 2
			m2 = 1
			res = n * m1 + (n // 2 + 1)
		else:
			n1 = n // 2
			n2 = 1
			res = m * n1 + n2 * (m // 2 + 1)
	res_s += str(res) + '\n'
print(res_s)


import math
t = int(input())
for _ in range(t):
	(n, m) = [int(i) for i in input().split()]
	c = 0
	print(math.ceil(n * m / 2))


T = int(input())
for _ in range(T):
	(n, m) = list(map(lambda x: int(x), input().split()))
	print((n * m + 1) // 2)


for s in [*open(0)][1:]:
	(a, b) = sorted(map(int, s.split()))
	print((a * b + 1) // 2)


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(n, m) = mapi()
	res = 0
	(n, m) = (min(n, m), max(n, m))
	print((n * m + 1) // 2)


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	print(math.ceil(n * k / 2))


import sys
from math import sqrt
input = sys.stdin.readline

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())
t = inp()
res = 0
for i in range(t):
	(n, m) = invr()
	if m % 2 == 0:
		res = int(m / 2) * n
	else:
		res = int((m - 1) / 2) * n + int((n + 1) / 2)
	print(res)


t = int(input())
count = 0
result = []
while count < t:
	a = input()
	(n, m) = a.split()
	lanterns = 0
	if int(m) % 2 == 0:
		lanterns += int(m) // 2 * int(n)
		result.append(lanterns)
	else:
		lanterns += int(m) // 2 * int(n)
		if int(n) % 2 == 0:
			lanterns += int(n) // 2
			result.append(lanterns)
		else:
			lanterns += int(n) // 2 + 1
			result.append(lanterns)
	count += 1
for x in result:
	print(x)


t = int(input())
answer = []
for a in range(t):
	line = input().split()
	n = int(line[0])
	m = int(line[1])
	ans = n * m // 2
	if n * m % 2 == 1:
		ans += 1
	answer.append(ans)
for b in answer:
	print(str(b))


t = int(input())
for i in range(t):
	l = [int(i) for i in input().split()]
	n = l[0]
	m = l[1]
	a = n * m
	if a % 2 == 0:
		print(a // 2)
	else:
		print(a // 2 + 1)


def solve(n, m):
	return (n * m + 1) // 2
t = int(input())
for i in range(1, t + 1):
	(n, m) = map(int, input().split())
	print(solve(n, m))


number_of_test_cases = int(input())
test_cases = []
output = []
for _ in range(number_of_test_cases):
	test_cases.append(input().split(' '))
for case in test_cases:
	(quotient, remainder) = divmod(int(case[1]), 2)
	answer = quotient * int(case[0])
	remaining = remainder * int(case[0])
	(quotient, remainder) = divmod(remaining, 2)
	answer += quotient + remainder
	output.append(answer)
for answer in output:
	print(answer)


def main():
	t = int(input())
	for _ in range(t):
		(m, n) = map(int, input().split())
		light_total = n * (m // 2)
		if m % 2 == 0:
			print(light_total)
		else:
			second_total = light_total + n // 2
			if n % 2 == 0:
				print(second_total)
			else:
				print(second_total + 1)
main()


from pprint import pprint
import sys
input = sys.stdin.readline
import collections
q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if a % 2 == 0:
		print(b * a // 2)
	else:
		import math
		print(b * (a // 2) + math.ceil(b / 2))


for _ in range(int(input())):
	(l, b) = map(int, input().split())
	var = l * (b // 2)
	if b % 2 != 0:
		var += l // 2
		if l % 2 != 0:
			var += 1
	print(var)


t = int(input())
while t > 0:
	[n, m] = [int(i) for i in input().split()]
	one = int(m * (n // 2))
	two = int(n % 2 * ((m + 1) // 2))
	print(one + two)
	t -= 1


import math
t = int(input())
for g in range(t):
	(n, m) = map(int, input().split())
	a = n * m
	b = math.ceil(a / 2)
	print(b)


import sys
import heapq

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, input().split())

def rlinput():
	return list(map(int, input().split()))

def srlinput():
	return sorted(list(map(int, input().split())))

def main():
	(n, m) = rinput()
	print((n * m + 1) // 2)
for i in range(iinput()):
	main()


test = int(input())
while test:
	(r, c) = map(int, input().split())
	print((r * c + 1) // 2)
	test -= 1


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


import math
for i in range(0, int(input())):
	(m, n) = map(int, input().split())
	print(max(m, n) * (min(m, n) // 2) + min(m, n) % 2 * math.ceil(max(m, n) / 2))


def inp():
	return map(int, input().split())

def solve():
	(a, b) = inp()
	return (a - a % 2) // 2 * b + (a % 2 * b + 1) // 2

def main():
	t = int(input())
	while t:
		print(solve())
		t -= 1
main()


def solve():
	(n, m) = map(int, input().split())
	print(n * m // 2 + n * m % 2)
t = int(input())
for tt in range(t):
	solve()


def main():
	for __ in [0] * int(input()):
		(N, M) = map(int, input().split())
		ans = N * M // 2
		if N & 1 == M & 1 == 1:
			ans += 1
		print(ans)
main()


for t in range(int(input())):
	(n, m) = (int(x) for x in input().split())
	squares = n * m
	if squares % 2 == 0:
		print(squares // 2)
	else:
		print(squares // 2 + 1)


tests = int(input())
squares = []
for i in range(tests):
	req = input().split(' ')
	squares.append(int(req[0]) * int(req[1]))
for i in squares:
	if i % 2 == 0:
		print(i // 2)
	else:
		print(i // 2 + 1)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7

def solve():
	(n, m) = list(map(int, stdin.readline().split()))
	tot = n * m
	if tot % 2 == 0:
		print(tot // 2)
	else:
		print((tot + 1) // 2)
t = 1
t = int(stdin.readline())
for _ in range(t):
	solve()


inp = int(input())
for _ in range(inp):
	inp1 = list(map(int, input().split()))
	if inp1[0] * inp1[1] % 2 == 0:
		print(int(inp1[0] * inp1[1] / 2))
	else:
		print(int((inp1[0] * inp1[1] + 1) / 2))


t = int(input())
for i in range(t):
	size = list(map(int, input().split()))
	if size[0] * size[1] % 2 == 0:
		print(int(size[0] * size[1] // 2))
	else:
		print(int(size[0] * size[1] // 2 + 1))


t = input()
x = int(t)
lst = list()
while x > 0:
	(m, n) = input().split()
	row = int(m)
	col = int(n)
	y = row * col
	n = int(y)
	if y < 0:
		continue
	elif y % 2 == 0:
		z = int(y / 2)
		lst.append(z)
	elif y % 2 != 0:
		w = y / 2 + 1
		b = int(w)
		lst.append(b)
	x = x - 1
for i in lst:
	print(i)


from sys import stdin, stdout
for case in range(int(stdin.readline())):
	(n, m) = [int(x) for x in stdin.readline().split()]
	print(n * m // 2 + n * m % 2)


import sys

def data():
	return sys.stdin.readline().strip()

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())
t = int(data())
res = []
for i in range(t):
	res.append(l())
for (i, val) in enumerate(res):
	n = val[0]
	m = val[1]
	cells = n * m
	if cells % 2 == 0:
		ans = cells // 2
	else:
		ans = cells // 2 + 1
	print(ans)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = n * m
	if a >= 2:
		b = int(a // 2)
		c = a % 2
		ans = b + c
	else:
		ans = a
	print(ans)


import math

def solve(n, m):
	total = n * (m // 2)
	if m % 2 == 1:
		total += math.ceil(n / 2)
	return total

def main():
	t = int(input())
	for i in range(t):
		d = input()
		d = [int(i) for i in d.split()]
		n = d[0]
		a = d[1]
		ans = solve(n, a)
		print(ans)
main()


from math import sqrt
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n * m % 2:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	(n, m) = list(map(int, sys.stdin.readline().split()))
	if n % 2 == 0:
		print(n // 2 * m)
	elif m % 2 == 0:
		print(m // 2 * n)
	else:
		print((m * n - 1) // 2 + 1)


t = int(input())
a = []
a.append(0)
a.append(1)
vt = 1
result = []
for i in range(t):
	v = [int(x) for x in input().split(' ')]
	index = v[0] * v[1]
	if index % 2 == 0:
		index = int(index / 2)
	else:
		index = int(index / 2) + 1
	result.append(index)
for x in result:
	print(x)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	Sum = 0
	Sum += n * (m // 2)
	if m % 2 == 0:
		Sum += 0
	elif n % 2 == 0:
		Sum += n // 2
	else:
		Sum += n // 2 + 1
	print(Sum)


def ans(m, n):
	if m % 2 == 0 or n % 2 == 0:
		return m * n // 2
	a = min(m, n)
	b = max(m, n)
	ans = a * (b - 1) // 2 + a // 2 + 1
	return ans
m = int(input())
for i in range(m):
	n = input().split()
	n1 = int(n[0])
	n2 = int(n[1])
	print(ans(n1, n2))


testcases = int(input())
import math
for testcase in range(testcases):
	temparr = input()
	temparr = temparr.split()
	n = int(temparr[0])
	m = int(temparr[1])
	if n == 1 and m == 1:
		print(1)
		continue
	if n == 2 and m == 2:
		print(2)
		continue
	r = n
	c = m
	total = 0
	if c & 1 == 0:
		eachcol = c // 2
		total += r * eachcol
		print(total)
	else:
		total = 0
		total += math.ceil(r / 2)
		c -= 1
		eachcol = c // 2
		total += r * eachcol
		print(total)


x = int(input())
for _ in range(x):
	p = input().split()
	n = int(p[0])
	k = int(p[1])
	print((n * k + 1) // 2)


import sys
import math
import operator as op
from functools import reduce
from collections import deque

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer / denom

def maxSum(arr, n, k):
	if n < k:
		print('Invalid')
		return -1
	res = 0
	for i in range(k):
		res += arr[i]
	curr_sum = res
	for i in range(k, n):
		curr_sum += arr[i] - arr[i - k]
		res = max(res, curr_sum)
	return res
t = read_int()
for i in range(t):
	(n, m) = read_int_line()
	if n % 2 == 0 and m % 2 == 0:
		ans = n * m // 2
		print(ans)
	elif n % 2 == 0 and m % 2 != 0:
		ans = n // 2 * m
		ans = min(ans, n * (m - 1) // 2 + n // 2 + 1)
		print(ans)
	elif n % 2 != 0 and m % 2 == 0:
		(n, m) = (m, n)
		ans = n // 2 * m
		ans = min(ans, n * (m - 1) // 2 + n // 2 + 1)
		print(ans)
	else:
		ans = min(n * (m - 1) // 2 + n // 2 + 1, m * (n - 1) // 2 + m // 2 + 1)
		print(ans)


T = int(input())
for _ in range(T):
	(N, M) = map(int, input().split())
	if N % 2 == 1 and M % 2 == 1:
		print((N - 1) * M // 2 + (M + 1) // 2)
	else:
		print(N * M // 2)


import math
a = int(input())
for _ in range(a):
	(c, d) = map(int, input().split())
	w = min(c, d)
	h = max(c, d)
	if w % 2 == 0:
		o = w // 2
		print(h * o)
	else:
		o = w // 2
		print(h * o + math.ceil(h / 2))


import sys
import math
input = lambda : sys.stdin.readline().strip('/r/n')
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(math.ceil(n * m / 2))


for __ in range(int(input())):
	(r, c) = map(int, input().split())
	if c % 2 == 0:
		print(r * (c // 2))
	elif r % 2 != 0:
		print((r + 1) // 2 * ((c + 1) // 2) + ((r + 1) // 2 - 1) * ((c - 1) // 2))
	else:
		print(r // 2 * ((c + 1) // 2) + r // 2 * ((c - 1) // 2))


a = int(input())
for i in range(a):
	(m, n) = map(int, input().split())
	a = m * n
	d = a // 2
	rem = a % 2
	if rem == 0:
		print(d)
	else:
		print(d + 1)


for _ in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	if a % 2 == 0 or b % 2 == 0:
		if a % 2 == 0:
			print(a // 2 * b)
		else:
			print(b // 2 * a)
	else:
		(a, b) = (max(a, b), min(a, b))
		print((a - 1) // 2 * b + (b - 1) // 2 + 1)


t = int(input())
for i in range(0, t):
	user_input = input().split(' ')
	all_numbers = [int(x.strip()) for x in user_input]
	n = all_numbers[0]
	m = all_numbers[1]
	a = n * m
	z = a // 2
	if a % 2 != 0:
		print(z + 1)
	else:
		print(z)
	i += 1


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
IN = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	(a, b) = M()
	print(math.ceil(a * b / 2))


t = int(input())
ans = []
for i in range(t):
	a = list(map(int, input().strip().split()))
	if a[0] * a[1] % 2 != 0:
		ans.append(a[0] * a[1] // 2 + 1)
	else:
		ans.append(a[0] * a[1] // 2)
for i in ans:
	print(i)


from math import *
t = int(input())
while t:
	(n, m) = map(int, input().strip().split())
	print(ceil(n * m / 2))
	t -= 1


for i in range(int(input())):
	a = list(map(int, input().split()))
	print((a[0] * a[1] + 1) // 2)


import sys
import math

def I():
	return int(sys.stdin.readline())

def IL():
	return list(map(int, sys.stdin.readline().strip().split()))

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))
t = I()
for iii in range(t):
	(n, m) = IL()
	ans = 0
	extra = 0
	if n % 2 == 0:
		x = n // 2
		y = m
	elif m % 2 == 0:
		y = m // 2
		x = n
	else:
		x = (n - 1) // 2
		y = m - 1
		extra = n // 2 + m // 2 + 1
	(x, y, extra) = (int(x), int(y), int(extra))
	ans = x * y + extra
	print(ans)
	pass


def quick_gcd(a, b):
	for i in range(min(a, b), 0, -1):
		if a % i == 0 and b % i == 0:
			return i

def go():
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		return n * m // 2
	return (n * m + 1) // 2
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


n = int(input())
for i in range(n):
	a = list(map(int, input().split(' ')))
	c = a[0] * a[1]
	if c < 2:
		print(1)
	else:
		d = c // 2
		e = abs(d * 2 - c)
		if e == 0:
			print(d)
		else:
			print(d + e)


import math
num = int(input())
for _ in range(num):
	(n, m) = [int(i) for i in input().split()]
	x = math.ceil(n * m / 2)
	print(x)


import math
n = input()
l = []
for i in range(int(n)):
	s = input().split()
	total = int(s[0]) * int(s[1])
	l.append(math.ceil(total / 2))
for i in l:
	print(i)


import math
tt = int(input())
while tt:
	(n, m) = [int(x) for x in input().split()]
	if n == 1 and m == 1:
		print(1)
		tt -= 1
		continue
	ans = 0
	ans += int(math.floor(n / 2)) * m
	n -= int(math.floor(n / 2)) * 2
	if n == 1:
		ans += int(math.ceil(m / 2))
	print(ans)
	tt -= 1


def main(n, m):
	if n * m % 2:
		return int((n * m + 1) / 2)
	return int(n * m / 2)
for i in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	print(main(n, m))


t = int(input())
for i in range(0, t):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	print(x * y // 2 + x * y % 2)


t = int(input())
z = t
c = list()
while z > 0:
	str1 = input()
	(n, m) = str1.split()
	n = int(n)
	m = int(m)
	a = n * m
	if a % 2 == 0:
		b = int(n * m / 2)
	else:
		b = int(n * m / 2 + 1)
	c.append(b)
	z = z - 1
for x in c:
	print(x)


import math

def solve(rows, cols):
	ans = 0
	ans += rows * (cols // 2)
	ans += math.ceil(rows * (cols % 2) / 2)
	print(ans)

def read():
	t = int(input())
	for i in range(t):
		(rows, cols) = list(map(int, input().strip().split()))
		solve(rows, cols)
read()


t = int(input())
p = 0
while p < t:
	A = [int(j) for j in input().split()]
	n = A[0]
	m = A[1]
	x = int((n * m) ** 0.5) ** 2 // 2
	if n * m % 2 == 0:
		ans = n * m // 2
	else:
		ans = n * m // 2 + 1
	print(ans)
	p += 1


n = int(input())
tests = [map(int, input().split()) for _ in range(n)]

def even(n):
	if n % 2 == 0:
		return True
	return False

def park(mx, mn):
	if even(mx):
		return mx // 2 * mn
	elif even(mn):
		return mn // 2 * mx
	elif mn == 1:
		return mx // 2 + 1
	else:
		return park(mx, mn - 1) + park(mx, 1)
for (a, b) in tests:
	mx = max(a, b)
	mn = min(a, b)
	print(park(mx, mn))


import sys
agGK = int(input())
for _ in range(agGK):
	(a, b) = map(int, input().split())
	if b > a:
		(b, a) = (a, b)
	if b == 1:
		if a != 1:
			if a % 2 == 0:
				print(a // 2)
			else:
				print(a // 2 + 1)
			continue
		else:
			print(1)
			continue
	if a % 2 == 0:
		print(a // 2 * b)
	elif b % 2 == 0:
		print(a // 2 * b + b // 2)
	else:
		print(a // 2 * b + b // 2 + 1)


a = input()
a = int(a)
lst = list()
while a > 0:
	b = input()
	lst.append(b)
	a = a - 1
for c in lst:
	c = c.split()
	c[0] = int(c[0])
	c[1] = int(c[1])
	print(int(c[0] * c[1] / 2) + int(c[0] * c[1] % 2))


t = int(input())
while t > 0:
	t = t - 1
	(a, b) = map(int, input().split())
	if a * b % 2 == 0:
		print(int(a * b / 2))
	else:
		h = a * b
		g = h // 2 + 1
		print(g)


o = []
sq = []
for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	sq.append(n * m)
for i in sq:
	if i % 2 != 0:
		print((i + 1) // 2)
	else:
		print(i // 2)


import math

def dict_sort(ans):
	ans = sorted(ans.items(), reverse=True, key=lambda kv: kv[1])

def is_prime(n, k):
	if n == 1:
		return 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			res = i
			break
	return res

def inp():
	ls = list(map(int, input().split()))
	return ls
n = int(input())
for ii in range(n):
	ls = inp()
	ans = ls[0] * ls[1]
	if ans == 1:
		print(1)
	else:
		print(math.ceil(ans / 2))


from collections import Counter
import math
t = int(input())
while t > 0:
	t = t - 1
	(n, m) = map(int, input().split())
	print(math.ceil(n * m / 2))


for s in [*open(0)][1:]:
	(x, y) = map(int, s.split())
	area = x * y
	print(area // 2 if area % 2 == 0 else area // 2 + 1)


def main():
	T = int(input())
	for t in range(T):
		(n, m) = list(map(int, input().split(' ')))
		if n == 1 and m == 1:
			print(1)
		elif n * m % 2 == 0:
			print(n * m // 2)
		else:
			print(n * m // 2 + 1)
main()


import sys
input = sys.stdin.readline
import heapq
import copy
import math

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())

class Node:

	def _init_(self, val):
		self.data = val
		self.left = None
		self.right = None

class fen_tree:

	def __init__(self, list):
		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):
		result = 0
		while idx:
			result += self.array[idx]
			idx -= idx & -idx
		return result

	def prints(self):
		print(self.array)
		return

	def range_query(self, from_idx, to_idx):
		return self.prefix_query(to_idx) - self.prefix_query(from_idx - 1)

	def update(self, idx, add):
		while idx < len(self.array):
			self.array[idx] += add
			idx += idx & -idx

def pre_sum(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def pre_back(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def bin_search(arr, l, r, val):
	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(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(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):
	l = 0
	queue = [root]
	while queue != []:
		node = queue[-1]
		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()
	return [parent, left, level]

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	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)
main()


import math
t = int(input())
for test in range(t):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		ans = n * math.ceil(m / 2)
	else:
		m -= 1
		ans = n * math.ceil(m / 2)
		ans += math.ceil(n / 2)
	print(ans)


import sys
input = sys.stdin.readline
from math import ceil

def solve(n, m):
	if m % 2 == 0:
		return m // 2 * n
	else:
		lights = (m - 1) // 2 * n
		return lights + ceil(n / 2)
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print(solve(n, m))


from math import ceil as cl
for _ in range(int(input())):
	(r, c) = map(int, input().split())
	if r % 2 == 0 or c % 2 == 0:
		print(c * r // 2)
	else:
		ans = (r - 1) // 2 * c
		ans += cl(c / 2)
		print(ans)


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	res = n * (m // 2)
	if m % 2 == 1:
		res += math.ceil(n / 2)
	print(res)


import sys
input = sys.stdin.buffer.readline
from math import ceil

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	(n, m) = I()
	print(ceil(n * m / 2))


T = int(input())

def cnt(m, n):
	return (m * n + 1) // 2
for _ in range(T):
	(M, N) = [int(x) for x in input().split()]
	print(cnt(M, N))


a = int(input())
(b, c) = (0, 0)
i = 0
while i < a:
	(b, c) = input().split()
	print((int(b) * int(c) + 1) // 2)
	i = i + 1


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
	elif m % 2 == 0:
		print(m // 2 * n)
	else:
		ans1 = (n - 1) // 2 * m + m // 2 + 1
		ans2 = (m - 1) // 2 * n + n // 2 + 1
		print(min(ans1, ans2))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, m) = LI()
		rr.append((n * m + 1) // 2)
	return JA(rr, '\n')
print(main())


T = int(input())
for i in range(T):
	(n, m) = map(int, input().split())
	product = n * m
	ans = product // 2
	ans += product % 2
	print(ans)


for cas in range(int(input())):
	(n, m) = map(int, input().split())
	print(n * m // 2 + n * m % 2)


import sys
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
for t in range(int(input())):
	(n, m) = intInp()
	nm = n * m
	if nm % 2 == 0:
		print(n * m // 2)
	else:
		print(n * m // 2 + 1)


test_cases = int(input())

def how_many_lights(n, m):
	return n * m // 2 + n * m % 2
for i in range(test_cases):
	case = input().split()
	n = int(case[0])
	m = int(case[1])
	print(how_many_lights(n, m))


t = int(input())
while t > 0:
	(x, y) = [int(a) for a in input().split()]
	if y % 2 == 0 or x % 2 == 0:
		ans = min((x + 1) // 2 * y, (y + 1) // 2 * x)
	else:
		z = max(x, y)
		w = min(x, y)
		ans = min((z - 1) // 2 * w + (w + 1) // 2, (w - 1) // 2 * z + (z + 1) // 2)
	print(ans)
	t = t - 1


t = int(input())
for r in range(t):
	(n, m) = list(map(int, input().split()))
	p = n * m
	if p % 2 == 0:
		print(p // 2)
	else:
		print((p + 1) // 2)


from fractions import Fraction
import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
t = iinput()
for _ in range(t):
	(n, m) = rinput()
	ans = 0
	ans += m * (n // 2)
	if n % 2:
		ans += math.ceil(m / 2.0)
	print(ans)


import math

def solve(tc):
	(r, c) = map(int, input().split())
	(r, c) = (min(r, c), max(c, r))
	if c % 2 == 0:
		print(math.ceil(c / 2) * r)
	else:
		c -= 1
		print(math.ceil(c / 2) * r + math.ceil(r / 2))
tc = int(input())
for i in range(1, tc + 1):
	solve(i)


import math
n = int(input())
l = []
while n:
	(x, y) = map(int, input().split())
	if x % 2 != 0 and y % 2 != 0:
		res = math.floor(y / 2) * x + math.floor(x / 2) + 1
		l.append(res)
	elif x % 2 == 0 and y % 2 == 0:
		res = x * y // 2
		l.append(res)
	else:
		res = x * y // 2
		l.append(res)
	n = n - 1
for i in l:
	print(i)


import math
for i in range(int(input())):
	mn = input().split()
	m = int(mn[0])
	n = int(mn[1])
	z = math.ceil(m * n / 2)
	print(z)


import sys
import math

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		print(m // 2 * n)
	if m % 2 == 1:
		x = m // 2
		ans = x * n + math.ceil(n / 2)
		print(ans)


t = int(input())
for case in range(t):
	[n, m] = list(map(int, input().split()))
	area = n * m
	ans = area // 2 + area % 2
	print(ans)


import sys
from math import floor, sqrt, ceil, factorial, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007

def solve():
	t = int(sys.stdin.readline())
	for _ in range(t):
		(n, m) = map(int, sys.stdin.readline().split())
		print(ceil(n * m / 2))
solve()


import math
import os
import random
import re
import sys

def get_lights(n, m):
	return n * m // 2 + n * m % 2
t = int(input())
while t > 0:
	t -= 1
	(n, m) = map(int, input().split())
	print(get_lights(n, m))


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	(n, m) = list(map(int, sys.stdin.readline().rstrip().split()))
	re = int(n / 2) * m
	if n % 2 == 1:
		re += int((m + 1) / 2)
	print(re)


case = int(input())
final = []
for i in range(0, case):
	(x, y) = map(int, input().split())
	if x * y < 2:
		final.append(1)
	else:
		final.append(int((x * y + 1) / 2))
for x in final:
	print(x)


import math

def calc_lights(x, y):
	x = int(x)
	y = int(y)
	return max(x, y) // 2 * min(x, y) + max(x, y) % 2 * math.ceil(min(x, y) / 2)
num_tests = int(input())
for i in range(num_tests):
	(x, y) = input().split(' ')
	print(calc_lights(x, y))


import math
for _ in ' ' * int(input()):
	(n, m) = map(int, input().split())
	if n == m == 1:
		print(1)
	else:
		print(math.ceil(n * m / 2))


import math
for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(n // 2 * m)
	elif m % 2 == 0:
		print(m // 2 * n)
	else:
		print(max(n, m) // 2 * min(n, m) + (min(n, m) - 1) // 2 + 1)


def solve():
	(n, k) = [int(x) for x in input().split()]
	if k % 2 == 0:
		print(k // 2 * n)
	else:
		print((k - 1) // 2 * n + (n + 1) // 2)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for i in range(1, t + 1):
	(n, m) = map(int, input().split())
	res = 1
	if n % 2 == 0 or m % 2 == 0:
		res = n * m // 2
	if n % 2 != 0 or m % 2 != 0:
		res = (n * m + 1) // 2
	print(res)


import math
from sys import stdin, stdout

def L():
	return list(map(int, stdin.readline().split()))

def Si():
	return sorted(list(map(int, stdin.readline().split())))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def main():
	for i in range(I()):
		(a, b) = In()
		print(math.ceil(a * b / 2))
main()


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))

def solve():
	(n, m) = nm()
	print((n * m + 1) // 2)
	return
T = int(input())
for _ in range(T):
	solve()


from sys import stdin
from math import ceil

def func():
	return
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(ceil(n * m / 2))


import os
import sys
from io import BytesIO, IOBase
from math import ceil

def solution(n, m):
	if n == 1:
		write(ceil(m / 2))
		return
	if m == 1:
		write(ceil(n / 2))
		return
	if m & 1 == 0:
		write(m // 2 * n)
	else:
		temp = m // 2 * n
		res = temp + ceil(n / 2)
		write(res)

def main():
	for _ in range(r_int()):
		(n, m) = r_array()
		solution(n, m)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


import math
luces = 0
for y in range(int(input())):
	x = [int(x) for x in input().split()]
	luces = 0
	if x[0] == 1:
		luces = math.ceil(x[1] / 2)
	if x[0] % 2 == 0:
		luces = x[1] * math.ceil(x[0] / 2)
	if x[0] > 2 and x[0] % 2 != 0:
		luces = x[1] * math.floor(x[0] / 2) + math.ceil(x[1] / 2)
	print(luces)


from math import *
t = int(input())
while t > 0:
	a = list(map(int, input().split()))
	(n, m) = (a[0], a[1])
	print(ceil(n * m / 2))
	t -= 1


tests = int(input())
while tests > 0:
	(n, m) = [int(i) for i in input().split(' ')]
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(m // 2 * n + (n // 2 + 1))
	tests = tests - 1


t = int(input())
for _ in range(t):
	(w, h) = [int(i) for i in input().split()]
	area = w * h
	if area % 2 == 0:
		print(area // 2)
	else:
		print((area + 1) // 2)


from collections import Counter
from collections import OrderedDict
from collections import defaultdict

def SOCountR(mylist):
	return OrderedDict(sorted(Counter(mylist).items(), reverse=True))

def SOCount(mylist):
	return OrderedDict(sorted(Counter(mylist).items()))

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	light = m // 2
	ans = n * light
	if m % 2 != 0:
		if n % 2 == 0:
			ans += n // 2
		else:
			ans += n // 2
			ans += 1
	print(ans)


for s in [*open(0)][1:]:
	(n1, m) = map(int, s.split())
	print(n1 * m + 1 >> 1)


import math

def BuubleSort(a, b):
	return math.ceil(a * b / 2)

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		ans = BuubleSort(a, b)
		print(ans)
main()


t = int(input())
while t:
	(n, m) = map(int, input().split())
	x = 0
	y = 0
	if n % 2 == 0:
		x = int(n / 2)
	else:
		x = int(n / 2) + 1
	if m % 2 == 0:
		y = int(m / 2)
	else:
		y = int(m / 2) + 1
	p = min(x * m, y * n)
	if n % 2 != 0 and m % 2 != 0:
		h = int((n - 1) / 2) * m + int(m / 2) + 1
		p = min(p, h)
	print(p)
	t = t - 1


import math
t = int(input())
for _ in range(t):
	(r, c) = map(int, input().split())
	ans = math.ceil(r * c / 2.0)
	print(ans)


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	p = n * m
	print(int(math.ceil(p / 2)))


def main_function():
	from sys import stdin
	from sys import stdout
	input = stdin.readline
	print = stdout.write
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		print(f'{n * k // 2}\n' if n * k % 2 == 0 else f'{n * k // 2 + 1}\n')
main_function()


tc = int(input())
for ctr in range(tc):
	(n, m) = map(int, input().split())
	print((n * m + 1) // 2)


def rs():
	return input().strip()

def ri():
	return int(input())

def ria():
	return list(map(int, input().split()))

def ia_to_s(a):
	return ' '.join([str(s) for s in a])

def solve(n, m):
	if n > m:
		t = m
		m = n
		n = t
	if n == 1:
		return m // 2 + m % 2
	if n % 2 == 0:
		return m * (n // 2)
	if m % 2 == 0:
		return n * (m // 2)
	return solve(n - 1, m - 1) + solve(n, 1) + solve(1, m - 1)

def main():
	for _ in range(ri()):
		(n, m) = ria()
		print(solve(n, m))
main()


import sys
from math import ceil
input = sys.stdin.readline
output = sys.stdout.write

def main():
	tests = int(input().rstrip())
	for i in range(tests):
		(n, m) = map(int, input().rstrip().split())
		res = ceil(n * m / 2)
		output(str(res))
		output('\n')
main()


import math

def solve():
	(n, m) = map(int, input().split())
	ans = 1000000000000000
	rw = n // 2
	rm = n % 2
	temp = 0
	if rm != 0:
		temp = m // 2 + m % 2
	ans = min(ans, rw * m + temp)
	rw = m // 2
	rm = m % 2
	temp = 0
	if rm != 0:
		temp = n // 2 + n % 2
	ans = min(ans, rw * n + temp)
	print(ans)
	return
t = 1
t = int(input())
while t > 0:
	t -= 1
	solve()


t = int(input())
for times in range(t):
	(n, m) = map(int, input().split())
	area = n * m
	answer = 0
	if area % 2 == 0:
		answer = area // 2
		print(answer)
	else:
		answer = (area + 1) // 2
		print(answer)


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	tc = 0
	if tc:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	for _ in range(ii()):
		(n, m) = mi()
		print(n * (m // 2) + m % 2 * ceil(n / 2))
solve()


import math

def xx(x, y):
	print(math.ceil(x * y / 2))
n = int(input())
for x in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	xx(a, b)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n % 2 == 1:
		c1 = m * (n // 2) + (m + 1) // 2
	else:
		c1 = m * (n // 2)
	if m % 2 == 1:
		c2 = n * (m // 2) + (n + 1) // 2
	else:
		c2 = n * (m // 2)
	print(min(c1, c2))


from sys import stdin
for _ in range(int(input())):
	(n, m) = map(int, stdin.readline().split())
	if n % 2 and m % 2:
		print(n * m // 2 + 1)
	else:
		print(n * m // 2)


from sys import stdin, stdout
import math
fastinput = stdin.buffer.readline
n = int(input())
while n:
	n -= 1
	(x, y) = map(int, input().strip().split(' '))
	print(math.ceil(x * y / 2))


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())

def solve(N, M):
	value = None
	if N % 2 == 1:
		value = N - 1
	else:
		value = N
	lanterns = value * M * 0.5
	if value == N - 1:
		thing = M // 2
		if 2 * thing < M:
			thing += 1
		lanterns += thing
	return int(lanterns)
test_cases = inp()
for i in range(test_cases):
	(N, M) = inlt()
	print(solve(N, M))


t = int(input())
mn = []
m = []
n = []
result = []
for i in range(t):
	mn.append(list(map(int, input().strip().split(' '))))
	n.append(mn[i][0])
	m.append(mn[i][1])
for i in range(t):
	if n[i] % 2 == 0 or m[i] % 2 == 0:
		result.append(n[i] * m[i] / 2)
	elif n[i] == 1 and m[i] == 1:
		result.append(1)
	elif n[i] == 1 and m[i] % 2 == 1:
		result.append((m[i] + 1) / 2)
	elif n[i] == 1 and m[i] % 2 == 0:
		result.append(m[i] / 2)
	elif m[i] == 1 and n[i] % 2 == 1:
		result.append((n[i] + 1) / 2)
	elif m[i] == 1 and n[i] % 2 == 0:
		result.append(n[i] / 2)
	else:
		result.append((n[i] - 1) * m[i] / 2 + (m[i] + 1) / 2)
for i in result:
	print(int(i))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	ans = a * b
	if ans & 1:
		print(ans // 2 + 1)
	else:
		print(ans // 2)


i = int(input())
c = 0
collect = []
while c < i:
	(x, y) = input().split()
	z = int(x) * int(y)
	collect.append(z)
	c += 1
for a in collect:
	if a % 2 == 0:
		print(a // 2)
	else:
		print(a // 2 + 1)


import math
t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	if n * m % 2 == 0:
		ans = n * m / 2
	else:
		ans = math.ceil(n * m / 2)
	print(int(ans))


a = int(input())
for i in range(a):
	l = 0
	x = list(map(int, input().split()))
	n = x[0] * x[1]
	if n % 2 == 0:
		l += n // 2
		print(l)
	else:
		l += (n - 1) // 2 + 1
		print(l)


def minimum():
	return n // 2 * (m // 2) + (n * m - n // 2 * (m // 2) * 2) // 2 + (n * m - n // 2 * (m // 2) * 2) % 2
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(minimum())


import sys
t = int(input().strip())
for a0 in range(t):
	(n, m) = map(int, input().split())
	res = 0
	if n % 2 == 0:
		res = n // 2 * m
	elif m % 2 == 0:
		res = (n - 1) // 2 * m + m // 2
	else:
		res = (n - 1) // 2 * m + m // 2 + 1
	print(res)


try:
	tc = int(input())
except:
	exit()
for _ in range(tc):
	(n, m) = map(int, input().split())
	temp = n * m
	if temp % 2 == 0:
		print(temp // 2)
	else:
		print((temp + 1) // 2)


for i in range(int(input())):
	(r, c) = input().split(' ')
	(r, c) = (int(r), int(c))
	if r * c % 2 == 0:
		print(r * c // 2)
	else:
		print(r * c // 2 + 1)


import math
num_of_inputs = input()
par = []
for i in range(int(num_of_inputs)):
	par.append(input())
for k in par:
	a = int(k.split()[0])
	b = int(k.split()[1])
	result = a * b
	print(math.ceil(result / 2.0))


for item in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 0:
		print(m * (n // 2))
	elif m % 2 == 0:
		print(n * (m // 2))
	else:
		print(m * (n // 2) + m // 2 + 1)


import os
import sys
if os.path.exists('/mnt/c/Users/Square/square/codeforces'):
	f = iter(open('A.txt').readlines())

	def input():
		return next(f)
else:
	input = lambda : sys.stdin.readline().strip()
fprint = lambda *args: print(*args, flush=True)
import itertools
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print((a * b + 1) // 2)


import sys
from collections import defaultdict as dd

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def bo(i):
	return ord(i) - ord('a')
t = fi()
while t > 0:
	t -= 1
	(n, m) = mi()
	print(int(ceil(n * m / 2)))


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().strip().split(' '))
	f = 0
	if a == 1 and b == 1:
		f = 1
		print('1')
	elif a % 2 == 0 or b % 2 == 0:
		if a % 2 == 0:
			c = a // 2 * b
		else:
			c = b // 2 * a
	else:
		c = (a - 1) // 2 * b + math.ceil(b / 2)
	if f == 0:
		print(c)


def light(row, col):
	lights = 0
	lights += row * (col // 2)
	if col % 2 == 1:
		lights += row // 2
		if row % 2 == 1:
			lights += 1
	print(lights)
testCases = int(input())
for t in range(testCases):
	inp = list(map(int, input().split()))
	row = inp[0]
	col = inp[1]
	light(row, col)


test = int(input())
for i in range(test):
	(n, m) = [int(i) for i in input().split()]
	k = max(n, m)
	t = min(n, m)
	if k % 2:
		ans = (k - 1) * 0.5 * t + (t // 2 + t % 2)
	else:
		ans = k / 2 * t
	print(int(ans))


def f(a, b):
	if a % 2 == 0:
		return a // 2 * b
	return a // 2 * b + b // 2 + 1
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(min(f(a, b), f(b, a)))


n = int(input())
while n > 0:
	n = n - 1
	(l, b) = input().split()
	area = int(l) * int(b)
	nol = area // 2 + area % 2
	print(nol)


nb_cases = int(input())
while nb_cases > 0:
	nb_cases -= 1
	(n, m) = [int(x) for x in input().split()]
	if n * m % 2 == 0:
		print(int(n * m / 2))
	else:
		print(int((n - 1) * (m - 1) / 2) + int((n - 1) / 2) + int((m - 1) / 2) + 1)


n = int(input())
for i in range(n):
	a = list(map(int, input().split(' ')))
	b = a[0] * a[1]
	c = b // 2 + b % 2
	print(c)


a = int(input())
store = [0] * a
for i in range(a):
	b = input()
	c = [int(x) for x in b.split()]
	value = c[0] * c[1]
	if value % 2 == 0:
		store[i] = value // 2
	else:
		store[i] = value // 2 + 1
for i in range(a):
	print(store[i])


tc = int(input())
for ii in range(tc):
	(m, n) = map(int, input().split())
	ans = (m * n + 1) // 2
	print(ans)


import math
testcase = int(input())
while testcase:
	(m, n) = map(int, input().strip().split(' '))
	print(math.ceil(m * n / 2))
	testcase -= 1


import math
num = int(input())
for i in range(num):
	(n, m) = [int(j) for j in input().split()]
	print(math.ceil(n * m / 2))


try:
	t = int(input())
	while t:
		(n, m) = map(int, input().split())
		if n == 1 and m == 1:
			print('1')
		else:
			if n % 2 == 0:
				d1 = d2 = start = n // 2
			else:
				d1 = (n - 1) // 2
				d2 = (n + 1) // 2
				start = n // 2 + 1
			if m % 2 == 0:
				print(start + d1 * (m // 2) + d2 * (m // 2 - 1))
			else:
				print(start + (d1 + d2) * (m // 2))
		t -= 1
except:
	pass


import math
n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if x == 1 or y == 1:
		print(max(1, math.ceil(max(x, y) / 2)))
	elif max(x, y) % 2 != 0:
		print((max(x, y) - 1) // 2 * min(x, y) + math.ceil(min(x, y) / 2))
	else:
		print(max(x, y) // 2 * min(x, y))


c = int(input())
for i in range(c):
	inp = input().split()
	n = int(inp[0])
	m = int(inp[1])
	s = n * m
	print(s // 2 + s % 2)


t = input()
t = int(t)
for tt in range(0, t):
	(m, n) = input().split()
	(m, n) = (int(m), int(n))
	if m % 2 == 0 or n % 2 == 0:
		print(int(m * n / 2))
	elif max(m, n) == 1:
		print(1)
	else:
		print(int((max(m, n) - 1) * min(m, n) / 2 + min(m, n) // 2 + 1))


t = int(input())
res = []
for i in range(t):
	(n, m) = (int(n) for n in input().split())
	if n % 2 == 0:
		res.append(n / 2 * m)
	elif m % 2 == 0:
		res.append(m / 2 * n)
	elif min(n, m) == 1:
		res.append(int(max(n, m) / 2) + 1)
	else:
		res.append(int(max(n, m) / 2) * min(n, m) + min(n, m) / 2 + 1)
for r in res:
	print(int(r))


(a, d) = (int(input()), [])
for i in range(0, a):
	b = [int(i) for i in input().split(' ')]
	d.append((1 + b[0] * b[1]) // 2)
print(*d, sep='\n')


n = int(input())
for i in range(n):
	(a, b) = [int(i) for i in input().split(' ')]
	x = a * b
	if x % 2 == 0:
		total = a * b // 2
	else:
		total = a * b // 2 + 1
	print(total)


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')
tests = lambda : range(1, int_in() + 1)
case_out = lambda i, o: out('Case #{}: {}'.format(i, o))

def solve(n, m):
	result = 0
	if m % 2 == 1:
		if n % 2 == 1:
			result += (n + 1) // 2
		else:
			result += n // 2
		m -= 1
	result += m // 2 * n
	return result
for i in tests():
	(n, m) = arr_in()
	out(solve(n, m))


t = int(input())
for x in range(t):
	(row, col) = map(int, input().split(' '))
	if row % 2 == 0:
		lights = row // 2 * col
		print(lights)
	elif row % 2 != 0:
		d = {}
		d[col] = col // 2 if col % 2 == 0 else col // 2 + 1
		r = (row - 1) // 2 * col
		extra = d[col]
		lights = r + extra
		print(lights)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	k = 0
	if n == 1 or m == 1:
		k = max(n, m)
		if max(n, m) % 2 != 0:
			print(k // 2 + 1)
		else:
			print(k // 2)
	elif n % 2 == 0 and m % 2 != 0:
		k = n // 2
		print(k * m)
	elif n % 2 != 0 and m % 2 != 0:
		k = (n - 1) // 2
		k = k * m
		k = k + m // 2 + 1
		print(k)
	elif n % 2 != 0 and m % 2 == 0:
		k = m // 2
		k = k * n
		print(k)
	else:
		k = n // 2
		print(k * m)


from math import ceil
t = int(input())
parks = []
for i in range(t):
	(n, m) = map(int, input().split())
	parks.append((n, m))
for park in parks:
	(n, m) = (park[0], park[1])
	lanterns = ceil(n * m / 2)
	print(lanterns)


def main():
	import sys
	input = sys.stdin.readline
	sys.setrecursionlimit(10 ** 7)
	from collections import Counter, deque
	from itertools import combinations, permutations, accumulate, groupby, product
	from bisect import bisect_left, bisect_right
	from heapq import heapify, heappop, heappush
	import math
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a % 2 == 0 and b % 2 == 0:
			print(a * b // 2)
		elif a % 2 == 1 and b % 2 == 1:
			print(a // 2 * b + b // 2 + 1)
		else:
			print(a * b // 2)
main()


from sys import stdin, stdout
tests = int(stdin.readline())
for i in range(tests):
	(n, m) = [int(x) for x in stdin.readline().split()]
	min_lamps = n * (m // 2) + n // 2 * (m % 2) + n % 2 * (m % 2)
	print(min_lamps)


import math
import sys
from collections import Counter, defaultdict
input = sys.stdin.readline

def solve():
	(n, m) = map(int, input().split())
	v = n * m
	print(math.ceil(v / 2))
for _ in range(int(input())):
	solve()


def solve():
	(n, m) = map(int, input().split())
	a = n * m
	if a % 2 == 0:
		print(a // 2)
	else:
		print(a // 2 + 1)
t = int(input())
for x in range(t):
	solve()


test_cases = int(input())

def min_lights(cells):
	if cells % 2 == 0:
		return cells // 2
	return cells // 2 + 1
for i in range(test_cases):
	(row, col) = map(int, input().split(' '))
	cells = row * col
	print(min_lights(cells))


n = int(input())
qustion = []
answer = []
for i in range(n):
	n_and_m = [*map(int, str(input()).split(' '))]
	b = n_and_m[0] * n_and_m[-1]
	if b % 2 == 0:
		answer.append(b // 2)
	else:
		answer.append(b // 2 + 1)
if len(answer) == n:
	for i in answer:
		print(i)


import heapq as hp
import collections

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def s_unpack(func=int):
	return sorted(map(func, input().split()))

def range_n():
	return range(int(input()))

def main():
	for _ in range_n():
		(n, m) = unpack()
		print(n * (m // 2) + (m & 1) * (n // 2 + (n & 1)))
main()


t = int(input())
lst = []
for y in range(t):
	(mm, nn) = input().split()
	m = int(mm)
	n = int(nn)
	q = m * n
	p = 0
	if q % 2 == 0:
		p = q / 2
	else:
		p = q // 2 + 1
	lst.append(p)
for i in lst:
	print(int(i))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(n, m) = list(map(int, input().split()))
		if n % 2 == 0:
			yield (m * (n // 2))
		else:
			add = m // 2 + m % 2
			yield (m * (n // 2) + add)
t = int(input())
ans = gift()
print(*ans, sep='\n')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	(n, m) = mi()
	print(math.ceil(n * m / 2))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, m) = map(int, stdin.readline().split())
	if n == 1 and m == 1:
		stdout.write('1\n')
		continue
	x = n * m
	if x % 2 == 0:
		stdout.write(str(x // 2) + '\n')
	else:
		stdout.write(str(x // 2 + 1) + '\n')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 != 0 and b % 2 != 0:
		c = a * (b - 1) // 2 + (a // 2 + 1)
		(a, b) = (b, a)
		d = a * (b - 1) // 2 + (a // 2 + 1)
		print(min(c, d))
	else:
		print(a * b // 2)


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7
for _ in range(INT()):
	(n, m) = MAP()
	x = n * m / 2
	print(int(math.ceil(x)))


t = int(input())
for tt in range(t):
	str1 = input().split(' ')
	r = int(str1[0])
	c = int(str1[1])
	val = r * c
	if val % 2 == 0:
		print(val // 2)
	else:
		print((val + 1) // 2)


import math

def solve(x, y):
	return math.ceil(x * y / 2)

def main():
	t = int(input())
	i = 1
	while i <= t:
		(x, y) = map(int, input().split())
		ans = solve(x, y)
		print(ans)
		i += 1
main()


a = int(input())
for c in range(a):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	z = x * y
	if z % 2 == 0:
		print(z // 2)
	else:
		z = z // 2 + 1
		print(z)


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 and m == 1:
		print(1)
		continue
	elif n == 1 or m == 1:
		if n == 1:
			print(math.ceil(m / 2))
			continue
		if m == 1:
			print(math.ceil(n / 2))
			continue
	else:
		if n % 2 == 0 and m % 2 == 0:
			print(n // 2 * m)
			continue
		if n % 2 == 0:
			print(n // 2 * m)
			continue
		if m % 2 == 0:
			print(m // 2 * n)
			continue
		s = max(n, m)
		d = min(n, m)
		o1 = d // 2
		o = s * o1
		t = math.ceil(s / 2)
		print(o + t)


from math import *
from copy import *
from heapq import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	(n, m) = l
	return ceil(n * m / 2)
T = int(input())
for _ in range(T):
	l = list(map(int, stdin.readline().rstrip().split()))
	print(solve(l))


import sys, math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if m % 2 != 0 and n % 2 == 0:
		ans = m // 2 * n + n // 2
	elif m % 2 != 0 and n % 2 != 0:
		ans = m // 2 * n + n // 2 + 1
	else:
		ans = m // 2 * n
	print(ans)


t = input()
t = int(t)
s = []
for i in range(t):
	l = [int(j) for j in input().split(' ')]
	if l[0] % 2 == 0:
		s.append(int(l[0] / 2 * l[1]))
	elif l[1] % 2 == 0:
		s.append(int(l[1] / 2 * l[0]))
	elif l[0] == l[1] == 1:
		s.append(1)
	elif l[0] == 1:
		s.append(int(l[1] / 2) + 1)
	elif l[1] == 1:
		s.append(int(l[0] / 2) + 1)
	else:
		s.append(int((l[0] - 1) / 2 * l[1] + int(l[1] / 2) + 1))
for i in s:
	print(i)


import sys
t = int(input())
while t > 0:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	n = (a * b + 1) / 2
	print(int(n))
	t -= 1


import math
t = int(input())
arr = []
for i in range(t):
	(a, b) = [int(a) for a in input().split()]
	if a % 2 != 0 and b % 2 != 0:
		arr.append(int(math.ceil(a * b / 2)))
	else:
		arr.append(int(a * b / 2))
for j in arr:
	print(j)


from math import ceil
t = int(input())
ans = []
for _ in range(t):
	(n, m) = map(int, input().split())
	ans.append(n * (m // 2) + ceil(n / 2) * (m % 2))
print('\n'.join(map(str, ans)))


t = int(input())
for i in range(t):
	(a, b) = [int(el) for el in input().split()]
	if a % 2 == 0 or b % 2 == 0:
		print(a * b // 2)
	else:
		print(a * b // 2 + 1)


def find_light(n, m):
	r = m * n
	if r % 2 != 0:
		r += 1
	r /= 2
	r = int(r)
	return r
t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	m = a[0]
	n = a[1]
	print(find_light(n, m))


for i in range(int(input())):
	(n, m) = map(int, input().split())
	x = n * m
	z = x // 2
	y = x % 2
	print(z + y)


import sys
input = sys.stdin.readline
import math

def solve():
	(NUM1, NUM2) = map(int, input().split())
	if NUM1 > NUM2:
		(NUM2, NUM1) = (NUM1, NUM2)
	if NUM1 == NUM2 and NUM1 == 1:
		print(NUM1)
	elif NUM1 == 1 and NUM2 != 1:
		print(math.ceil(NUM2 / 2))
	elif NUM1 % 2 == 0:
		print(NUM1 // 2 * NUM2)
	else:
		print(math.ceil((NUM1 - 1) / 2) * NUM2 + math.ceil(NUM2 / 2))
for _ in range(int(input())):
	solve()


for t in range(int(input())):
	(num1, num2) = map(int, input().split())
	print(int((num1 * num2 + 1) / 2))


import io
import os
import functools
import itertools
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
while t:
	t -= 1
	(n, m) = [int(x) for x in input().split()]
	answer = 10 ** 10
	if n & 1:
		answer = min(answer, m * (n // 2) + (m + 1) // 2)
	if m & 1:
		answer = min(answer, n * (m // 2) + (n + 1) // 2)
	if not m & 1 and (not n & 1):
		answer = n * m // 2
	print(answer)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	d = m // 2
	if m & 1 == 1:
		d += 1
	tot = d * n
	if m & 1 == 1:
		tot -= n // 2
	print(tot)


import sys
import math
try:
	sys.stdin = open('Input.txt', 'r')
	sys.stdout = open('Output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for testCases in range(int(input())):
	(n, m) = map(int, input().split())
	if m % 2 == 0:
		print(m // 2 * n)
	else:
		print(m // 2 * n + math.ceil(n / 2))


n = int(input())
ans = []
for i in range(n):
	moe = [int(a) for a in input().split()]
	perm = moe[0] * moe[1] / 2
	if perm % 1 == 0:
		ans.append(int(perm))
	else:
		ans.append(int(perm // 1 + 1))
for i in ans:
	print(i)


import sys
import math
import random
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(a, b) = invr()
	tot = a * b
	ans = (tot + 1) // 2
	print(ans)


for loop in range(int(input())):
	(a, b) = map(int, input().split())
	print(a * b // 2 + a * b % 2)


tc = int(input())
for _ in range(tc):
	(n, m) = list(map(int, input().split()))
	if n % 2 == 0:
		if m % 2 == 0:
			lamps = m // 2 * n
		else:
			lamps = m // 2 * n + n // 2
	elif m % 2 == 0:
		lamps = m // 2 * n
	else:
		lamps = m // 2 * n + n // 2 + 1
	print(lamps)


numberofcases = int(input())
for _ in range(numberofcases):
	(x, y) = [int(t) for t in input().split()]
	print((x * y + 1) // 2)


def main():
	t = int(input())
	for _ in range(t):
		(n, m) = [int(x) for x in input().split()]
		x = min(n, m)
		y = max(n, m)
		if y % 2 == 0:
			print(x * (y // 2))
		else:
			s = x * ((y - 1) // 2)
			if x % 2 == 0:
				s += x // 2
			else:
				s += x // 2 + 1
			print(s)
main()


import math
for q in range(int(input())):
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		ans = int(n / 2) * k
	else:
		ans = int((n - 1) / 2) * k + math.ceil(k / 2)
	print(ans)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().strip().split())
	answer = n * m // 2
	if answer == n * m / 2:
		print(answer)
	else:
		print(answer + 1)


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
for _ in range(inp()):
	(n, m) = ip()
	t = (n * m - 1) // 2 + 1
	print(t)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		print(n * m // 2)
	else:
		print(min((n - 1) * m // 2 + ceil(m / 2), (m - 1) * n // 2 + ceil(n / 2)))


for i in range(int(input())):
	(b, c) = map(int, input().split())
	print((b * c + 1) // 2)