inpu = list(map(int,input().rstrip().split(' '))) Begi = inpu[0] Meat = inpu[1] BegiNum = 0 while(inpu[2] + 1 <= inpu[3] and Begi > 0 and Meat - inpu[2] >= 0): BegiNum = BegiNum + 1 Begi = Begi - 1 Meat = Meat - inpu[2] inpu[3] - inpu[2] - 1 print(BegiNum)