#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long num = (n * m);
    if (num % 2 == 0) {
      cout << num / 2 << endl;
    } else {
      cout << (num + 1) / 2 << endl;
    }
  }
}
