import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int z = sc.nextInt(); int max = 0; for (int i = 0; i <= z; i++) { max = Math.max(max, Math.min(x + i, y + z - i)); } System.out.println(max); } }