Nicoleta is a happy kid, he goes every day to school and is always complaining about waking up early and having to complete his homework assignments. His favorite professor, Afonsox, is very funny and created a new challenge for him.
Even though Nicoleta is just a kid, Afonsox introduced him to the world of graph theory. Nicoleta is amazed, he is very obsessed with this graph that Afonsox decided to call K-round graph. A K-round graph with N vertices is a graph where every vertex u, numbered from 0 to N - 1, has an edge to vertices (u + 1)%N, ..., (u + K)%N. Here a%b is the operator that gives the remainder of the integer division of a by b. Also, an edge between vertices u and (u + i)%N has value i.
Nicoleta likes this graph because if you draw it, it looks like a circle of kids, where each kid has K arms with different lengths with which they can reach the K next kids, like the picture below, which he drew in his notebook. Imagining this makes Nicoleta smile.
The challenge Afonsox has proposed to Nicoleta is for him to find the sum of all the values of the edges in the maximum spanning tree of a given K-round graph. A maximum spanning tree of a graph is composed of all of its vertices and a subset of edges such that there is one and only one path from one vertex to another and the sum of the values of the edges is maximal. Can you help Nicoleta finding the answer to Afonsox challenge?
The input consists of a single line containing two integers N and K (1 ≤ K < N ≤ 109), indicating the number of vertices in the graph and the number of outgoing edges from every vertex.
Output a single integer - the sum of the values of the edges in the maximum spanning tree of the K-round graph.
## Input
The input consists of a single line containing two integers N and K (1 ≤ K < N ≤ 109), indicating the number of vertices in the graph and the number of outgoing edges from every vertex.
## Output
Output a single integer - the sum of the values of the edges in the maximum spanning tree of the K-round graph.
[samples]
**Definitions**
Let $ P = (p_1, p_2, \dots, p_N) $ be a simple polygon with vertices $ p_i = (x_i, y_i) \in \mathbb{R}^2 $, listed in counter-clockwise order.
Let $ V = \{v_1, v_2, \dots, v_Q\} $ be a set of query vectors, where each $ v_j = (v_{j,x}, v_{j,y}) \in \mathbb{R}^2 \setminus \{(0,0)\} $.
**Constraints**
- $ 3 \leq N \leq 10^5 $
- $ 1 \leq Q \leq 10^5 $
- $ |x_i|, |y_i|, |v_{j,x}|, |v_{j,y}| \leq 10^9 $
- Polygon is simple (no self-intersections) and non-degenerate.
**Objective**
For each vector $ v_j \in V $, determine whether $ P $ is $ v_j $-monotone:
That is, for every line $ L $ orthogonal to $ v_j $, the intersection $ L \cap P $ is either empty, a single point, or a connected line segment.
Equivalently, $ P $ is $ v_j $-monotone if and only if the projection of $ P $ onto the direction perpendicular to $ v_j $ is a monotone chain — i.e., the sequence of edge directions relative to $ v_j^\perp $ changes sign at most once.
**Algorithmic Criterion**
Let $ d_j = v_j^\perp = (-v_{j,y}, v_{j,x}) $ be the direction of projection.
Project all polygon edges onto $ d_j $: for each edge $ \vec{e}_i = p_{i+1} - p_i $, compute scalar projection $ s_i = \vec{e}_i \cdot d_j $.
Then $ P $ is $ v_j $-monotone if and only if the sequence $ (s_1, s_2, \dots, s_N) $ has at most one sign change (considering zero as non-sign-changing).