p, q, r=map(int, input().split()) a, b, c=map(int, input().split()) b=a+b c=b+c mn=max((a-1)*p+1, (b-1)*q+1, (c-1)*r+1) mx=min(a*p, b*q, c*r) if mn>mx: print(-1) else: print("%d %d" % (mn, mx))