POSAO - Jobs

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

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

hide comments
2016-06-27 17:32:21
worst wording
2014-10-23 10:28:14 Archangel
can someone explain the problem to me, Its said that one computer can perform at most one job in one second then obviously for nxn we would need nxn seconds? please help me on this.
2013-12-04 09:12:06 demon
getting internal error. Something wrong with the server?

accepted!

Last edit: 2013-12-04 09:14:30
2013-08-20 08:58:20 Unknown
Please provide some tricky test cases..
2013-08-18 12:01:01 P_Quantum
Nice One... :) simple logic .. :P
2013-06-11 10:13:07 devil
donot forget to take the case when k > n
2012-12-18 13:58:55 :C++:
Why i m getting WA after 10 test cases
pls help.. my submission id is 8293151
2012-10-04 07:43:02 a b
any tricky case got wrng ans after 10th judge.........

Last edit: 2012-10-04 07:43:26
2012-10-01 20:48:18 DEVANSH PARASHAR
@abdul baset al-joudy your explanation seems to be contradictory it is surely incorrect plz check the first case 3 2 is 6
2012-07-28 13:16:35 Abdul Baset Al-Joudy
@David Moran You can't fill the first row first, because for instance the job at 1, 2 needs the job at 1, 1 to be done before it, not simultaneously.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.