#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  for (int t = (0); t < (T); ++t) {
    int n, m;
    cin >> n >> m;
    int a, b;
    a = max(n, m);
    b = min(n, m);
    if (a % 2 == 0) {
      cout << (a / 2) * b << endl;
    } else {
      if (b % 2 == 0) {
        cout << (a / 2) * b + b / 2 << endl;
      } else {
        cout << (a / 2) * b + b / 2 + 1 << endl;
      }
    }
  }
}
