#include<iostream>
using namespace std;
int main()
{
int x, y;
cin >> x >> y;
int a = x * x - x + 1;
int b = y * y - y + 1;
if (x = y)
{
cout << a;
}
else if (x > y)
{
if (x % 2 == 0)
{
cout << a + (x - y);
}
else
{
cout << a - (x - y);
}
}
else if (y > x)
{
if (y % 2 == 0)
{
cout << b - (y - x);
}
else
{
cout << b + (y - x);
}
}
/*cout << b - (y - x);*/
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsKCWludCB4LCB5OwoJY2luID4+IHggPj4geTsKCQoJaW50IGEgPSB4ICogeCAtIHggKyAxOwoJaW50IGIgPSB5ICogeSAtIHkgKyAxOwoJCglpZiAoeCA9IHkpCgl7CgkJY291dCA8PCBhOwoJfQoJZWxzZSBpZiAoeCA+IHkpCgl7CgkJaWYgKHggJSAyID09IDApCgkJewoJCQljb3V0IDw8IGEgKyAoeCAtIHkpOwoJCX0KCQllbHNlCgkJewoJCQljb3V0IDw8IGEgLSAoeCAtIHkpOwoJCX0KCX0KCWVsc2UgaWYgKHkgPiB4KQoJewoJCWlmICh5ICUgMiA9PSAwKQoJCXsKCQkJY291dCA8PCBiIC0gKHkgLSB4KTsKCQl9CgkJZWxzZQoJCXsKCQkJY291dCA8PCBiICsgKHkgLSB4KTsKCQl9Cgl9CgkKCgkvKmNvdXQgPDwgYiAtICh5IC0geCk7Ki8KCQp9