#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  int n, m;
  int ans;
  for (int t = 0; t < T; t++) {
    cin >> n >> m;
    ans = ceil((double)(n * m) / 2);
    cout << ans;
    cout << endl;
  }
  return 0;
}
