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