题目链接:https://vjudge.net/problem/UVA-11538
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define LL long long
using namespace std;
int main()
{
LL n,m;
while(~scanf("%lld%lld",&n,&m),n||m)
{
if(n>m) swap(n,m);
printf("%lld\n",n*m*(m+n-2)+2*n*(n-1)*(3*m-n-1)/3);
}
}