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