P,Q,R=map(int,input().split()) A,B,C=map(int,input().split()) MIN=max(P*(A-1),Q*(A+B-1),R*(A+B+C-1))+1 MAX=min(P*(A),Q*(A+B),R*(A+B+C)) if MIN<=MAX: print(MIN,MAX) else: print(-1)