P, Q, R = map(int, input().split())
A, B, C = map(int, input().split())

eq_lower = max((A-1)*P, (A+B-1)*Q, (A+B+C-1)*R)
neq_upper = min(A*P, (A+B)*Q, (A+B+C)*R)

if eq_lower + 1 > neq_upper:
    print(-1)
else:
    print(eq_lower+1, neq_upper)