Let's Eat, Kevin!


Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python, Rust

Congrats guys, we did it! We killed Kevin! Now it's time to feast on him.

Chef Oree is preparing the delicacy of Kevin the Watermelon. Kevin is modelled as a 2D circular watermelon slice. Mathematically, his flesh is a filled circle, also called a disk.

To safely prepare and cook him, Oree needs to perform a precise culinary execution. He will need to make n distinct, infinitely long straight cuts right through Kevin's red flesh.

However, preparing Kevin is difficult; one mistake and it's fatal for the eater, where Kevin's venomous heart lies at its exact geometric centre.

  • To properly neutralise the Kevin toxin, exactly k cuts must perfectly pierce the centre.
  • The remaining n-k cuts must avoid the centre, slicing only the surrounding flesh.

Assuming Oree can freely choose the angles and positions of all his cuts as long as he strictly follows the execution rules above, what is the maximum number of pieces of flesh he can carve from Kevin?

Input

The input contains two integers in a single line n and k (1 \leq n \leq 10^6, 0 \leq k \leq n), where n is the total number of cuts, and exactly k cuts must pass through the centre of Kevin.

Output

Print one integer: the maximum possible number of distinct pieces of flesh.

Example

Input 1
1 0
Output 1
2

A single cut through Kevin, avoiding the heart, divides into exactly 2 pieces.

Input 2
3 3
Output 2
6

All 3 cuts must pierce the centre. As all cuts intersect at the exact same point, Oree cannot generate extra intersections in the outer flesh, leaving 6 sectors of meat!


Comments

There are no comments at the moment.