House in a low tree#11121

House in a low tree

1 second
128 megabytes
Hard

King Julian decided to deal with the housing problems of his subordinates and build one large house for them inside a tree trunk.

This house will have n + 1 floors. Each floor will have square rooms forming a cross. The floors are exactly one above the other. One lemur will live in each room.

prb11121.gif

Lemurs can easily move between adjacent rooms on the same floor. However, in order for them to go up or down one floor, stairs must be built. King Julian decided to build exactly stairs in the house. Each staircase will connect two rooms that are on top of each other.

Julian wondered how exactly to arrange the stairs in the house. He decided that the location of the stairs would be optimal if the sum of distances between all pairs of rooms is minimized. The distance between two rooms is the minimum number of steps you need to make to get from one room to another. In one move, you can go to an adjacent room on the same floor, or go up the stairs to the same room on the next floor, if there is such a staircase.

Help Julian find the total distance for the optimal staircase placement.

Input

Two integers and (1 \le n \le 10^6, n \le m \le n \cdot 5).

Output

Print one number - the total distance between all pairs of rooms with the optimal arrangement of stairs.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading