e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

Paint2D-Crack

Paint2D-Crack

The beginning hacker-programmer Nevmiyko injured the source code of the licensed acquired graphics editor Paint2D. After the start an editor automatically creates the working field in a kind to the square by size N × N, and on him builds the maximally possible amount of rectangles by size 1 × M.

You know N and М, help to count up to Nevmiyko, what amount of operations К here automatically executes editor, if at the start he has only a template to the square 1 × 1, and as a result of the unsuccessful breaking is able yet and "rotate" a rectangle 1 × М on 90°.

We remind, that the licensed graphics editor was able to execute operations "select", "copy" "move" and "insert".

Input:

2 number is N and M (1N, M1000).

Output:

Amount of the К operations.

Time limit 1 second
Memory limit 64 MiB
Input example #1
4 3
Output example #1
19
Author Анатолий Присяжнюк