#include <bits/stdc++.h>
using namespace std;
long long int dx[] = {-1, 1, 0, 0};
long long int dy[] = {0, 0, 1, -1};
long long int m = 1e9 + 7;
vector<long long int> pr;
long long int prime[200005] = {0};
void seive() {
  for (long long int i = 2; i < 200005; ++i) {
    if (prime[i] == 0) {
      pr.push_back(i);
      for (long long int j = 2 * i; j < 200005; j += i) {
        prime[j] = 1;
      }
    }
  }
}
long long int exp(long long int a, long long int b) {
  long long int r = 1;
  while (b != 0) {
    if (b & 1) {
      r *= a;
    }
    b /= 2;
    a *= a;
  }
  return r;
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  n *= m;
  n++;
  cout << n / 2 << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long int t = 1;
  cin >> t;
  seive();
  while (t--) solve();
  return 0;
}
