#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long maxN = 1e5 + 5;
const long long INF = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    long long mul = n * m;
    if (mul % 2 == 0)
      cout << mul / 2 << '\n';
    else
      cout << mul / 2 + 1 << '\n';
  }
}
