import java.util.Scanner; public class No_126 { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int s = sc.nextInt(); int move = 0; sc.close(); int dis_a = 0; int dis_b = 0; if (a - s > 0) { dis_a = a - s; } else { dis_a = s - a; } if (b - s > 0) { dis_b = b - s; } else { dis_b = s - b; } if(a==0) move+=1; if (dis_b >= dis_a) { move+=dis_a + s; }else{ move+=dis_b; if(a > s){ move+=dis_a + s; }else{ move+=s; } } System.out.println(move); } }