#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long n, m;
    cin >> n >> m;
    long long p = n * m;
    long long q = (p + 1) / 2;
    cout << q << endl;
  }
  return 0;
}
