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