#!/usr/bin/env python3 # -*- coding: utf-8-*- a, b, c, d = map(int, input().split(" ")) m = min(a, b // c, d // (c+1)) print(m)