#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, m, n;
  cin >> t;
  while (t--) {
    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 / 2) * ((n / 2) * 2 + 1) + n / 2 + 1 << endl;
    }
  }
  return 0;
}
