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