문제
Bessie and her little sister Elsie are picking berries in Farmer John's berry patch. Farmer John's patch has exactly
Bessie wants to maximize the number of berries she collects. However, Farmer John wants Bessie to share with her little sister, and so Bessie will have to give Elsie the
Help Bessie figure out the maximum number of berries she can collect.
SCORING:
Test cases 1-4 satisfy
K\le 10. Test cases 5-11 satisfy no additional constraints.
Problem credits: Nathan Pinsker
입력
The first line of input contains space-separated integers
The second line contains
출력
A single line with the answer.
예제1
5 4
3 6 8 4 2
8
If Bessie fills
one basket with 6 berries from tree 2
two baskets, each with 4 berries from tree 3
one basket with 4 berries from tree 4
then she receives two baskets each with 4 berries, giving her 8 berries in total.