为什么用公式都能WA×6……
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n, m;
int main()
{
cin >> n >> m;
int x = min(n, m);
unsigned long long ans1 = m * n * (x + 1) + x * (x + 1) * (2 * x + 1) / 6 - (m + n) * x * (x + 1) / 2;
unsigned long long ans2 = n * (n + 1) / 2 * m * (m + 1) / 2 - ans1;
cout << ans1 << ' ' << ans2;
return 0;
}