#include <bits/stdc++.h>
using namespace std;
int main(){
    int h,w,a,b,c,d,e;
    cin>>h>>w;
    a=h*w;
    b=min(h,w);
    e=max(h,w);
    d=a/b;
    c=(d*(d+1))/2*b;
    if(b==1){
        c=c+a-1;
    }
    else{
        c=c+2*a-b;
        if(b>2){
            c=c+(b*(b+1)/2+b-1)*e;
            c=c-2*a;
        }
    }
    cout<<c;
}