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