#include <bits/stdc++.h>
using namespace std;
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2> &p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
bool sort1(const pair<pair<int, int>, int> &a,
           const pair<pair<int, int>, int> &b) {
  return (a.first.second < b.first.second);
}
bool sort2(const pair<pair<int, int>, int> &a,
           const pair<pair<int, int>, int> &b) {
  return (a.first.first > b.first.first);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long ans, ans1;
    if (m % 2 == 0)
      ans = (m / 2) * n;
    else {
      ans = (m / 2) * n;
      ans += n / 2;
      if (n % 2 == 1) ans++;
    }
    if (n % 2 == 0)
      ans1 = (n / 2) * m;
    else {
      ans1 = (n / 2) * m;
      ans1 += m / 2;
      if (m % 2 == 1) ans1++;
    }
    cout << min(ans, ans1) << "\n";
  }
}
