#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
const int inf = 1e9;
const long double EPS = 1e-12;
const long double Pi = acosl(-1);
long long n, m;
void solve() {
  cin >> n >> m;
  cout << (n * m - 1) / 2 + 1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) solve();
  return 0;
}
