import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### h,w,la,lb,ka,kb = na() ok = 10**6 ng = 0 while ok - ng > 1: d = ok + ng >> 1 a = 0 for x in range(d + 1): y = d - x res = h * w - min(x * la, h) * min(y * lb, w) if res <= ka * x + kb * y: a = 1 break if a: ok = d else: ng = d print(ok)