p, q, r = map(int, input().split()) a, b, c = map(int, input().split()) al, ar = (a - 1) * p, a * p bl, br = (a + b - 1) * q, (a + b) * q cl, cr = (a + b + c - 1) * r, (a + b + c) * r l = max(al, bl, cl) + 1 r = min(ar, br, cr) if l <= r: print(l, r) else: print(-1)