The first input line contains two integers: n (1 ≤ n ≤ 1000), representing the number of books, andk(1 ≤k≤n), representing the number of boxes to put the books in. The followingninput lines contain the dimensions of the books, one book per line, in the order they appear on the shelf, from left to right. The ith of these input lines contains two integers,wi (1 ≤wi ≤ 106) andhi (1 ≤hi ≤ 106), representing (respectively) the width and height of the ith book on the shelf from the left.
On a line by itself, print the minimum cost of boxing the books.