#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline int msbp(int x) { return 31 - __builtin_clz(x); }
inline int msb(int x) { return 1 << msbp(x); }
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
int t, n, m;
signed main() {
  ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    if (n % 2 && m % 2) {
      cout << (min(n, m) + 1) / 2 + (n * m - min(n, m)) / 2 << endl;
    } else {
      cout << (n * m) / 2 << endl;
    }
  }
  return 0;
}
