This page is still under construction.

Parts of this page are still being built. What you see may change.

Konpeito

Interview

Time limit2sMemory limit1024 MB

Summary
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.

Examples2

  1. Example 1

    Input
    4 6 9
    
    Expected output
    8
    
  2. Example 2

    Input
    35 35 35
    
    Expected output
    0