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