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