#include #include using namespace std; typedef long long ll; int main(){ ll H,W; cin >> H >> W; if(H==0){ cout << 0 << endl; return 0; } ll N = min(W-1,H); cout << W*N - N*(N+1)/2 + N + max(H-W+1,0LL) << endl; }