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