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