Problem H
Herb Mixing
Leon has collected some herbs of two possible colors: green and red. Leon’s health level will be boosted after he eats those herbs. Mixing the herbs can increase their effect according to the following recipes:
-
One green herb: Boosts health by $1$.
-
Two green herbs: Boosts health by $3$.
-
Three green herbs: Boosts health by $10$.
-
One green herb and one red herb: Boosts health by $10$.
The herbs cannot be consumed in any way other than those listed above.
What is the maximum amount of Leon’s health that can be boosted if he optimally mixes and eats his herbs?
Input
Input contains two integers between $0$ and $100$ (both inclusive), the number of green herbs and the number of red herbs that Leon has collected.
Output
Output a single integer, the maximum amount of Leon’s health that can be boosted.
Sample Input 1 | Sample Output 1 |
---|---|
8 3 |
43 |
Sample Input 2 | Sample Output 2 |
---|---|
0 2 |
0 |