#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5, mod = 1e9 + 7;
long long int n, k, x, y, z, t, a, ar, b, c, ans, tmp, sum, m = 1e6 - 1, mn = N,
                                                            mx, f;
string s;
vector<long long int> v, v2;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    tmp = n * m;
    if (tmp == 1)
      cout << 1 << endl;
    else if (tmp % 2 == 0)
      cout << tmp / 2 << endl;
    else
      cout << ((tmp - 1) / 2) + 1 << endl;
  }
}
