#include <bits/stdc++.h>
using namespace std;
int n, a, b, l;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    l = a * b / 2;
    if (a * b % 2 != 0) {
      l++;
    }
    cout << l << endl;
  }
}
