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