Footballers#1262

Footballers

0.5 seconds
8 megabytes
Hard

After Lionel Messi and Cristiano Ronaldo agreed that math isn't their strongest suit and found the "Football Products" task too challenging, they asked for a simpler game.

This time, to avoid overloading the footballers with difficult problems (after all, they still have a cup to compete for!), they were given a drawing task. But it's not just about drawing a field or a ball; they need to draw a polygon, which should become a masterpiece of "polygon construction"—a "football polygon."

Lionel and Cristiano decided to pick numbers. Messi chose the number and Ronaldo chose the number .

They were about to start on this simple task when they were reminded that they must draw points and connect some pairs with segments so that a -gon with all of its diagonals and sides is not formed, and the number of segments must be maximized. After a few minutes, both footballers had examples achieving the maximum, and proof that no more segments could be drawn.

As the referee, your job is to verify the maximality of the drawn segments.

Input

The input consists of a single line containing two integers and separated by a space.

1 < A, B \le 1000.

Output

Output a single integer — the maximum number of segments that can be drawn under the given conditions.

Examples

Example 1

Loading
Loading