#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long x = max(n, m);
  long long an = (x / 2) * min(n, m);
  if (x % 2) an += ceil(min(n, m) / 2.0);
  cout << an << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1, an = 1;
  cin >> TESTS;
  while (TESTS--) {
    an++;
    solve();
  }
  return 0;
}
