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

ranges = []

# Case 1: B > 0 and C > 0
if B > 0 and C > 0:
    L1 = (A - 1) * P + 1
    U1 = A * P
    L2 = (A + B - 1) * Q + 1
    U2 = (A + B) * Q
    L3 = (A + B + C - 1) * R + 1
    U3 = (A + B + C) * R
    
    lower = max(L1, L2, L3)
    upper = min(U1, U2, U3)
    if lower <= upper:
        ranges.append((lower, upper))

# Case 2: B > 0 and C == 0
if B > 0 and C == 0:
    L1 = (A - 1) * P + 1
    U1 = A * P
    L2 = (A + B - 1) * Q + 1
    U2 = (A + B) * Q
    upper_limit = (A + B) * R  # N <= (A+B)*R to satisfy ceil(N/R) <= A+B
    
    lower = max(L1, L2)
    upper = min(U1, U2, upper_limit)
    if lower <= upper:
        ranges.append((lower, upper))

# Case 3: B == 0 and C > 0
if B == 0 and C > 0:
    L1 = (A - 1) * P + 1
    U1 = A * P
    upper_Q_limit = A * Q  # N <= A*Q for ceil(N/Q) <= A
    L3 = (A + C - 1) * R + 1
    U3 = (A + C) * R
    
    lower = max(L1, L3)
    upper = min(U1, upper_Q_limit, U3)
    if lower <= upper:
        ranges.append((lower, upper))

# Case 4: B == 0 and C == 0
if B == 0 and C == 0:
    L1 = (A - 1) * P + 1
    upper_values = min(A * P, A * Q, A * R)
    if L1 <= upper_values:
        ranges.append((L1, upper_values))

if not ranges:
    print(-1)
else:
    min_n = min(r[0] for r in ranges)
    max_n = max(r[1] for r in ranges)
    print(min_n, max_n)