// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define ent '\n'
#define all(x) x.begin(), x.end()
#define s second
#define f first
#define pb push_back
typedef long long ll;
using namespace std;
const int maxn = 3e6 + 250;
const int mod = 1e9 + 7;
const int inf = 1e9;
const int K = 400;
const double Pi = acos(-1.0);
const long double eps = 1e-9;
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define int long long
int d[maxn];
map<pair<int,int>,int>mp;
int rec(int n, int m) {
    if(n<m)swap(n,m);
    if(mp.count({n,m})) {
        return mp[{n,m}];
    }
    int sum = n*m;
    if(n*m==1)return 1;
    mp[{1,m}]=m*(m+1)/2+m-1;
    mp[{n-m+1, m}] = (m*(m+1)/2+m-1)*(n-m);
    mp[{m, n-m+1}] = (m*(m+1)/2+m-1)*(n-m);
    sum += (m*(m+1)/2+m-1)*(n-m+1)+rec(m,m-1);
    mp[{n,m}] = sum;
    return sum;
}
//1000000 1000000
void solve() {
    int h, w;
    cin >> h >> w;
    for(int n = 1;n <= 1e6; n++) {
        d[n] = n*(n+1)/2+n-1;
    }
    ll sum = 0;
    if(h<w)swap(h,w);
    for(int i = w;i <= h; i++) {
        sum += i*w;
    }
    sum += (h-w)*d[w];
    h = w;
    while(w>0) {
        sum += d[w];
        w--;
        sum += w*h;
        sum += d[w];
        h--;
    }
    cout << sum;
}
 
signed main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // freopen("position.in", "r" , stdin);
    // freopen("position.out", "w", stdout);
    int t=1;
    // cin >> t;
    for(int i = 1;i <= t; i++) {
        // cout << "Case " << i << ": ";
        solve();
    }
}