#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, t, m;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    long long sum = 0;
    if (m & 1)
      if (n & 1)
        sum += (int(n / 2) + 1);
      else
        sum += n / 2;
    sum += int(m / 2) * n;
    cout << sum << endl;
  }
  return 0;
}
