// Example program
#include <iostream>
#include <string>
using namespace std;
#define ll long long
char s[100][100];
ll mal(ll x){
    return (x*(x+1))/2+x-1;
}
int main()
{
    ll x,y;
    ll sum = 0;
    cin >> x >> y;
    if (x>y)
        swap(x,y);
    for (ll i = y; i >= x + 1; i--){
        sum+=mal(x);
        sum+=x*i;
    }
    
    for (ll i = x; i >= 1; i--){
        sum+=i*i;
        sum+=mal(i);
        sum+=i*(i-1);
        sum+=mal(i-1);
        
    }
    cout<<sum;
        
    
    
   
 
}
