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