p,q,r = map(int, input().split()) a,b,c = map(int, input().split()) mi = max((a-1)*p, (a+b-1)*q, (a+b+c-1)*r)+1 mx = min(a*p, (a+b)*q, (a+b+c)*r) if mi<=mx: print(mi, mx) else: print(-1)