#include <bits/stdc++.h>
using namespace std;
int main() {
  int tt;
  tt = 1;
  cin >> tt;
  while (tt--) {
    int n, m;
    cin >> n >> m;
    if (n % 2 == 1 && m % 2 == 1) {
      int z = (m - 1) / 2;
      cout << n * z + (n + 1) / 2 << endl;
    } else if (n % 2 == 0 && m % 2 == 0)
      cout << n * m / 2 << endl;
    else
      cout << n * m / 2 << endl;
  }
  return 0;
}
