#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int n, m, q;
int da[maxn];
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) w |= ch == '-', ch = getchar();
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
int main() {
  n = read();
  while (n--) {
    int m = read() * read();
    cout << (m - 1) / 2 + 1 << endl;
  }
  return 0;
}
