package main import "fmt" func main() { var a, b, c, d int fmt.Scan(&a, &b, &c, &d) ans := 0 for { if a-1 < 0 || b-c < 0 || d-c-1 < 0 { break } a-- b -= c d -= c + 1 ans++ } fmt.Println(ans) }