#include <bits/stdc++.h>
const int INFI = (1 << 29);
const long long INFL = (1LL << 62);
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  cout << (long long)ceil((n * m) / 2.0) << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long casos;
  cin >> casos;
  while (casos--) solve();
  return 0;
}
