P,Q,R = map(int,input().split()) A,B,C = map(int,input().split()) low = [(A-1)*P,(B+A-1)*Q,(C+B+A-1)*R] high = [A*P,(B+A)*Q,(C+B+A)*R] l = max(low)+1 h = min(high) if l > h: print(-1) else: print("{} {}".format(l,h))