Herb Mixing

시간 제한1초메모리 제한2048 MB

요약
초록 허브와 빨간 허브의 개수가 주어졌을 때, 정해진 조합 규칙으로 얻을 수 있는 최대 체력 증가량을 출력한다.
난이도

보통10점 중 5점

유형
동적 계획법, 그리디, 수학, 완전 탐색
정답자
아직 제출이 없습니다

문제

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 11.
  • Two green herbs: Boosts health by 33.
  • Three green herbs: Boosts health by 1010.
  • One green herb and one red herb: Boosts health by 1010.

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 contains two integers between 00 and 100100 (both inclusive), the number of green herbs and the number of red herbs that Leon has collected.

출력

Output a single integer, the maximum amount of Leon’s health that can be boosted.

예제2

  1. 예제 1

    입력
    8 3
    
    예상 출력
    43
    
  2. 예제 2

    입력
    0 2
    
    예상 출력
    0