eval'P,Q,R,A,B,C='+$<.read.split*?, r=[P*A,Q*B+=A,R*C+=B].min puts r<(l=[P*A-P,Q*B-Q,R*C-R].max+1)?-1:[l,r]*' '