#include <bits/stdc++.h>
using namespace std;
int m, n;
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> m >> n;
    if (m < n) swap(m, n);
    int sum = 0;
    sum = (m * (n / 2));
    if (n % 2 == 1) sum += (m + 1) / 2;
    cout << sum << "\n";
  }
  return 0;
}
