#include using namespace std; int main(){ long long P,Q,R,A,B,C,amin,amax; cin >> P >> Q >> R >> A >> B >> C; amin=P*(A-1)+1; amax=P*A; amin=max(amin,Q*(A+B-1)+1); amax=min(amax,Q*(A+B)); amin=max(amin,R*(A+B+C-1)+1); amax=min(amax,R*(A+B+C)); if(amin<=amax)cout << amin << " " << amax << endl; else cout << "-1" << endl; return 0; }