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