package main import "fmt" func main() { var a, b, c, d int fmt.Scan(&a, &b, &c, &d) ans := 0 for v := 0; v <= a; v++ { if v*c <= b && v+v*c <= d { if v > ans { ans = v } } } fmt.Println(ans) }