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