#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a;
  while (a--) {
    cin >> b >> c;
    if ((b * c) == 1) {
      cout << 1 << endl;
    } else if ((b * c) % 2 != 0) {
      cout << (b * c) / 2 + 1 << endl;
    } else {
      cout << (b * c) / 2 << endl;
    }
  }
}
