#include using namespace std; typedef long long ll; int main() { ll p,q,r,a,b,c; cin>>p>>q>>r>>a>>b>>c; b+=a; c+=b; int mn = min((a-1)*p+1, min((b-1)*q+1, (c-1)*r+1)); int mx = max(a*p, max(b*q, c*r)); if (mn > mx) puts("-1"); else cout << mn << ' ' << mx << endl; return 0; }