package main import "fmt" func main() { var r, b, w int fmt.Scan(&r, &b, &w) for w > 0 { v := w/2 + 1 if r < b { r += v } else { b += v } w -= v } fmt.Println(min(r, b)) } func min(a, b int) int { if a < b { return a } return b }