/* coder:ACboy date: 2010-3-4 result: AC description: UVa 11044 - Searching for Nessy */ #include <iostream> using namespace std; int main() { int n, m; int count; #ifndef ONLINE_JUDGE freopen("11044.txt", "r", stdin); #endif cin >> count; while (count--) { int ans; cin >> n >> m; n -= 2; m -= 2; int ncount; int mcount; ncount = n % 3 == 0 ? n / 3 : n / 3 + 1; mcount = m % 3 == 0 ? m / 3 : m / 3 + 1; ans = ncount * mcount; cout << ans << endl; } return 0; }