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