package main import ( "fmt" ) func main() { var x, y, d, ans int64 fmt.Scanln(&x, &y, &d) if x+y < d { fmt.Println(0) return } if x >= d { if y >= d { ans = d } else { ans = y } } else { diff := d - x if y-diff > d { ans = x } else { ans = y - diff } } fmt.Println(ans + 1) }