POSAO - Jobs

no tags 

Little Domagoj has hands full of work. His jobs are organized in NxN matrix such that each cell represents one job. He can start doing job at cell (x, y) if and only if jobs at cells (x, y-1) and (x-1, y) are done (if they exist).


On the picture required jobs are shown for grey cells. 

Domagoj has K computers which he will use for doing jobs. One computer is able to do at most one job in one second. Also, all computers need not to be used all the time. Help Domagoj and organize order in which computers will do jobs in least possible time.

Input

In the first line there are two integers N and K (1 ≤ N≤ 109)

Output

Print least possible time in which all jobs can be done.

Example

Input:
3 2
Output:
6
Input:
5 1
Output:
25
Input:
4 4
Output:
7

hide comments
david_8k: 2012-07-28 05:27:01

Why the answer to 4 4 is 7 if you can have this initial organization
****
----
----
----

(the * stands for the computers), at the second unity of time
****
^^^^
----
----

and so on until you get 3 steps to fulfill the matrix, somebody explain.

Last edit: 2012-07-28 05:27:41
devu: 2012-07-26 18:26:45

@Ivan Katanic:nice problem :)


Added by:Ivan Katanic
Date:2012-07-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Croatian Junior Olympiad in Informatics, Matija Osrecki