#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
using V = vector<T>;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int ddx[8] = {-1, 0, 1, 0, 1, 1, -1, -1};
int ddy[8] = {0, -1, 0, 1, 1, -1, 1, -1};
long long int cmp1(pair<long long int, pair<long long int, long long int> > a,
                   pair<long long int, pair<long long int, long long int> > b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second.first > b.second.first;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    if (n == 1 && m == 1) {
      cout << 1 << endl;
      continue;
    }
    if (n % 2 == 0 && m % 2 == 0) {
      cout << m * n / 2 << endl;
    } else if (n % 2 != 0 && m % 2 != 0) {
      cout << m * (n / 2) + (m / 2 + 1) << endl;
    } else if (n % 2 == 0 && m % 2 != 0) {
      cout << n * (m / 2) + (n / 2) << endl;
    } else {
      cout << m * (n / 2) + (m / 2) << endl;
    }
  }
  return 0;
}
