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