Paint2D-Crack#24

Paint2D-Crack

1 second
64 megabytes
Hard

Beginning hacker-programmer Nevmiyko has damaged the source code of the licensed graphics editor Paint2D. Upon startup, the editor automatically creates a square working area of size N \times N and then places as many rectangles of size 1 \times M on it as possible.

Given and , help Nevmiyko determine the minimum number of operations that the editor must perform automatically if only a 1 \times 1 template is available at the beginning. Due to the hack, it is also possible to rotate a 1 \times M rectangle by 90^\circ.

Recall that the licensed editor supported the operations select, copy, move, and paste. However, after being hacked, the editor can no longer copy rectangles larger than 1 \times M. Additionally, the rotate operation changes the orientation of rectangles in the buffer, so that after rotation, the paste operation inserts a rectangle of size M \times 1.

Input

Two integers and (1 \leq N, M \leq 1000).

Output

Print the number of operations .

Examples

Example 1

Loading
Loading

Example 7

Loading
Loading

Note

Figure 1. Example for N=4, M=3

Figure 2. Example for N=5, M=3