import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int s = sc.nextInt(); int ans = 0; if(Math.abs(a - s) <= Math.abs(b - s)) { ans = Math.abs(a - s) + s; } else { ans = Math.abs(b - s) + Math.abs(a - s) + a; } System.out.println(ans); } }