eolymp
bolt
Try our new interface for solving problems
Problems

Castle

Castle

\includegraphics{https://static.e-olymp.com/content/13/1378ecd769df3cb35f7d3b123be2c70e3a406424.jpg} The castle consists of \textbf{K} levels. Each level - this is the correct \textbf{N}-gon, the angle of which coincides with the angle of the previous (the structure of the castle for example, input data is shown in the figure). On the sides of the first level are two rooms on each side of the next - one more. How many rooms in the castle? \InputFile In a single line of input file specifies two integers \textbf{N} and \textbf{K} (\textbf{3} ≤ \textbf{N} ≤ \textbf{10^6}, \textbf{1} ≤ \textbf{K} ≤ \textbf{10^6}). \OutputFile Bring out a single number - the number of rooms in the castle.
Time limit 1 second
Memory limit 64 MiB
Input example #1
6 3
Output example #1
28
Source Stage II All-Ukrainian Olympiad 2010-2011 Berdichev