시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 3 3 2 100.000%

문제

The circus magician Tâlrîts Vakars shows magic tricks. In his demonstrations he uses only:

baloons (), doves (), rabbits () and poodels ().

Tâlrîts can carry out only the following tricks: (baloons and animals in the direction shown by the arrow are converted to different animals):

  1.  +  +   
  2.  +  +   
  3.  +  +  

Your task is to write a program that for the input number of baloons, doves, rabbits and poodels computes the maximum possible number of rabbits that Tâlrîts can obtain and the least number of tricks required to do this.

입력

The values of non-negative integer numbers b (number of baloons, b ≤ 150), d (number of doves, d ≤ 150), t (number of rabbits, t ≤ 150) and p (number of poodels, p ≤ 150) are input from the keyboard. It is also known that b + d + t + p ≤ 250.

출력

The maximum possible number of rabbits that Tâlrîts can obtain must be displayed on the screen, as well as (separated by a space symbol) the minimal number of tricks that is required to obtain this number of rabbits.

예제 입력 1

9 17 1 3

예제 출력 1

10 3

예제 입력 2

3 0 2 2

예제 출력 2

4 2