What is the maximum number of edges in an undirected graph G of n vertices that avoids a k-matching? Note that loops and parallel edges are not allowed in the graph.
The input contains several test cases.
For each test case, there is one line with two positive integers, n ≤ 1000 and k ≤ 1000.
The input ends with two zeroes.
For each test case output the maximum number of edges.
1000 1 500 2 0 0
0 499