#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  int r = 0;
  r += (n / 2) * m;
  if (n % 2 == 1) {
    r += (m / 2);
    if (m % 2 == 1) {
      r++;
    }
  }
  cout << r << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) solve();
}
