H,W,LA,LB,KA,KB = map(int,input().split()) ans = 10 ** 8 def calc(w,h): a = w * KB + h * KA gyo = min(w * LB,W) retu = min(h * LA,H) return a + gyo * retu >= H * W for w in range(W + 1): if not calc(w,H + W - w): continue end = H + W - w start = -1 while end -start > 1: mid = end +start >> 1 if calc(w,mid): end = mid else: start = mid if w + end < ans: ans = w + end print(ans)