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