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