#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    if (n % 2 && m % 2 == 0)
      cout << n * (m / 2) << endl;
    else if (n % 2 == 0 && m % 2 == 0)
      cout << n * (m / 2) << endl;
    else if (n % 2 == 0 && m % 2)
      cout << m * (n / 2) << endl;
    else
      cout << (n * m + 1) / 2 << endl;
  }
  return 0;
}
