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