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