#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
const long long mod = (0 ? 1000000007 : 998244353);
const double eps = 1e-7;
const long long llinf = 4223372036854775807;
inline void out(long long a) {
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
void work() {
  long long n, m;
  cin >> n >> m;
  cout << n * m / 2 + (n * m) % 2 << endl;
}
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    work();
  }
  return 0;
}
