|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|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):
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.
9 17 1 3
3 0 2 2