package main import ( "bufio" "fmt" "os" "strconv" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Scan(); x, _ := strconv.Atoi(sc.Text()) sc.Scan(); y, _ := strconv.Atoi(sc.Text()) sc.Scan(); d, _ := strconv.Atoi(sc.Text()) if x > d { x = d } if y > d { y = d } n := (x + y) - d + 1 if n > d + 1 { n = d + 1 } if n < 0 { n = 0 } fmt.Println(n) }