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