#include <bits/stdc++.h>
using namespace std;
int main() {
  long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    n = n * k;
    if (n % 2 == 1)
      cout << n / 2 + 1;
    else
      cout << n / 2;
    cout << endl;
  }
  return 0;
}
