#include using namespace std;; int main(){ long long int A,B,C,P,Q,R,N,M; cin >> A >> B >> C >> P >> Q >> R; N=C*(P+Q+R); M=N-C+1; if(M/A+1==P)cout << M << " " << N << endl; else cout << -1 << endl; }