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