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