Bedmates
Researchers have linked hospital roommate assignment with both positive and negative health outcomes. One particular point of contention is the number of roommates each patient should have. Too few can feel isolating, while too many can feel crowded and lack privacy.
Real roommate assignment depends on many factors, but Dr. Ian has proposed a simplified metric: the fellowship score. Distribute patients into
non-empty rooms holding
patients (where
). The fellowship score of the assignment is the product of the room sizes,
.
You can use up to rooms to split up the patients, but you don't need to use them all. Given this restruction, what is the maximum fellowship score that can be achieved with
patients?
Input
The first line contains two integers and
(
), the number of patients to group into rooms and the number of rooms that are available.
Output
Output the maximum fellowship score that can be achieved by grouping the patients into rooms.
Example
Input 1
10 8
Output 1
36
Group the patients into rooms, with
,
,
and
patients. The fellowship score is
, which is
. It can be proven that no larger fellowship score is possible. Note that we only used
rooms here, but we could have used up to
.
Input 2
10 2
Output 2
25
Input 3
27 6
Output 3
8000
Comments
and they were roommates
oh my god they were roommates