Олимпиадный тренинг

Задача 33121. Improvement in academic performance


Задача

Темы:
In the lyceum, in computer science lessons, students' answers are evaluated by an integer number of points from 2 to 5. The final score in computer science is set as the arithmetic mean of marks in all lessons, rounded up to the nearest whole number. If the mean is exactly halfway between two integers, then the score is rounded up.
Examples of grade rounding are shown in the table.
 
Lesson grades Arithmetic mean Final grade
2, 3, 5 \({ {2 + 3 + 5} \over 3 }= 3 {1 \over 3}\) 3
3, 3, 4, 4 \({ {3 + 3 + 4 + 4} \over 4 }= 3 {1 \over 2}\)< /span> 4
5, 5, 5, 3, 5 \({ {5 + 5 + 5 + 3 + 5} \over 5 }= 4 {3 \over 5}\ ) 5

All students of the lyceum strive to get a final grade in computer science of at least 4 points. Unfortunately, one of the students received a twos, b threes and c fours in the lessons. Now he plans to get several fives, and he wants the final grade to be at least 4 points. He needs to understand what is the minimum number of fives he needs to get in order to achieve his goal.
It is required to write a program that, given non-negative integers a, b and c, determines the minimum number of fives that a student needs to get in order for his final grade in computer science to be at least 4 points.

Input data
The input contains three lines. The first line contains a non-negative integer a, the second line contains a non-negative integer b, the third line contains a non-negative integer c (0 ≤ a, b, c ≤ 1015, a + b + c ≥ 1).

Output data
The output must contain a single number: the minimum number of fives a student needs to get in order for the final grade to be at least 4 points.
 
Input Output
2
0
0
2