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