import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines P,Q,R,A,B,C = map(int,read().split()) B += A C += B left = max((P*(A-1), Q*(B-1), R*(C-1))) + 1 right = min((P*A, Q*B, R*C)) if left > right: print(-1) else: print(left, right)