题目描述
Problem Statement
Given is a sequence of three integers A = (A_1, A_2, A_3). On this sequence, you can do the following operation any number of times:
- choose $i\in$ {1,2,3} and add 1 to A_i.
Find the minimum number of operations needed to make A arithmetic. Here, the sequence A = (A_1, A_2, A_3) is arithmetic when A_2 - A_1 = A_3 - A_2 holds.
Input
Input is given from Standard Input in the following format:
A_1 A_2 A_3
Output
Print the answer.
Constraints
- $1\leq A_1, A_2, A_3\leq 10^{15}$
Sample Input 1
4 8 10
Sample Output 1
2
One operation with i = 1 and then one operation with i = 3 yield an arithmetic sequence (5, 8, 11).
Sample Input 2
10 3 4
Sample Output 2
4
Four operations with i = 2 yield an arithmetic sequence (10, 7, 4).
Sample Input 3
1 2 3
Sample Output 3
0
The sequence A is already arithmetic from the beginning, so we need zero operations.
Sample Input 4
1000000000000000 1 1000000000000000
Sample Output 4
999999999999999
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分