#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long ans = 0;
    long long n, m;
    cin >> n >> m;
    ans = min(n, m) * ((max(n, m)) / 2) + (max(n, m) % 2) * (min(n, m) / 2) +
          (max(n, m) % 2) * (min(n, m) % 2);
    cout << ans << "\n";
  }
  return 0;
}
