p,q,r = map(int,input().split()) a,b,c = map(int,input().split()) b += a c += b mx,mn = 10**100, -10**100 mn = max(mn, p * (a - 1) + 1) mn = max(mn, q * (b - 1) + 1) mn = max(mn, r * (c - 1) + 1) mx = min(mx, p * a) mx = min(mx, q * b) mx = min(mx, r * c) if mx < mn: print(-1) else: print(mn, mx)