Konpeito
InterviewTime limit2sMemory limit1024 MB
Given three counts A, B, C, find the minimum total pieces that must be added so all three counts become equal.
- Level
Easy1 of 10
- Topics
- Math, Implementation, Greedy
- Solved
- No attempts yet
Problem
Aoi and Rin, students at JOI High School, decided to eat the same number of konpeito as their teacher, Ms. Rie, with all 3 of them taking part.
Aoi has eaten A pieces, Rin has eaten B pieces, and Ms. Rie has eaten C pieces. What is the minimum total number of konpeito they must eat additionally so that all 3 have eaten the same number of konpeito?
Given the numbers A, B, C of konpeito the 3 have eaten, write a program that finds the minimum number of konpeito to eat additionally.
Input
The input is given from standard input in the following format.
A B C
Output
Print the minimum number of konpeito to eat additionally on 1 line to standard output.
Constraints
1 ≦ A ≦ 100.1 ≦ B ≦ 100.1 ≦ C ≦ 100.- All input values are integers.