시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 1 1 1 100.000%

## 문제

For an undirected graph $G$ with $n$ nodes and $m$ edges, we can define the distance $\textit{dist} (i, j)$ as the length of the shortest path between nodes $i$ and $j$. The length of a path is equal to the number of edges in the path. If there is no path between $i$ and $j$, we set $\textit{dist} (i, j)$ equal to $n$.

Then, we can define $w_G$, the weight of the graph $G$, as $\sum_{i = 1}^n \sum_{j = 1}^n \text{dist} (i, j)$.

Now, given $n$ nodes and no edges initially, we will choose no more than $m$ pairs of nodes $(i, j)$ ($i \neq j$) and add an edge between the respective nodes for every chosen pair. This way, we can get an undirected graph $G$ with $n$ nodes and no more than $m$ edges.

Your task is to find the minimal possible value of $w_G$ after such construction.

## 입력

The first line of the input contains two integers $n$ and $m$ ($1 \leq n \leq 10^6$, $1 \leq m \leq 10^{12}$).

## 출력

Print a single line with a single integer: the minimum possible value of $w_G$.

## 예제 입력 1

4 5


## 예제 출력 1

14


## 힌트

In the example, we can choose to add edges $(1, 2)$, $(1, 4)$, $(2, 4)$, $(2, 3)$ and $(3, 4)$.