#include <bits/stdc++.h>
using namespace std;
template <class T>
void show(const vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << '\n';
}
vector<long long> xx = {1, 0, -1, 0};
vector<long long> yy = {0, 1, 0, -1};
string dir = "LRUD";
const long long N = 5e5 + 50, oo = 3e18 + 500;
const long long mod = 1e9 + 7;
const long double eps = 1e-9, PI = 2 * acos(0.0);
long long n, m, k;
long long cnt = 0;
long long lg = 18;
vector<long long> g[N];
vector<long long> rg[N];
vector<long long> visit(N, 0);
signed main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    cout << (n * m + 1) / 2 << '\n';
  }
}
