P,Q,R = map(int,input().split()) A,B,C = map(int,input().split()) l = 0 r = 10**18 l = max(l,(A-1)*P) r = min(r,A*P) l = max(l,(A+B-1)*Q) r = min(r,(A+B)*Q) l = max(l,(A+B+C-1)*R) r = min(r,(A+B+C)*R) if l+1 >= r: print(-1) else: print(l+1,r)