#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  int temp = n * m;
  if (temp & 1) {
    cout << (temp / 2) + 1 << "\n";
  } else {
    cout << (temp / 2) << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int test;
  cin >> test;
  while (test--) {
    solve();
  }
}
