#include <bits/stdc++.h>
int dx4[] = {0, 0, -1, 1};
int dy4[] = {-1, 1, 0, 0};
bool valid(int r, int c, int x, int y) {
  if (x >= 1 && x <= r && y >= 1 && y <= c) return 1;
  return 0;
}
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int cs = 1; cs <= t; cs++) {
    long long int n, m;
    cin >> n >> m;
    long long int p = (n * m);
    long long int ans = p / 2;
    if (p % 2 == 1) ans++;
    cout << ans << endl;
  }
  return 0;
}
