def main(): a, b, c, d = map(int, input().split(' ')) vege = 0 meat = 0 s = d while vege < a and meat < b and s - (vege + meat + 1 + c) >= 0: vege += 1 meat = c * vege print(vege) if __name__ =='__main__': main()