#include #include #include #include #include using namespace std;typedef unsigned long long ull;int main() { ull n, m; while (cin >> n >> m && (n + m)) { if (n > m) swap(n, m); ull x = n * m * (m - 1); ull y = m * n * (n - 1); ull z = 2 * n * (n - 1) * (3 * m - n - 1) / 3; cout << x + y + z << endl; } return 0;}