#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    int ans;
    if (n % 2 == 0)
      ans = (n / 2) * m;
    else if (m % 2 == 0)
      ans = (m / 2) * n;
    else {
      ans = ((n - 1) / 2) * m;
      ans += (m - 1) / 2 + 1;
    }
    cout << ans << "\n";
  }
}
