P, Q, R = map(int, input().split()) A, B, C = map(int, input().split()) X = max((A-1)*P+1, (A+B-1)*Q+1, (A+B+C-1)*R+1) Y = min(A*P, (A+B)*Q, (A+B+C)*R) if X > Y: print(-1) else: print(X, Y)