#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair P; int main() { ll p, q, r, a, b, c; cin>>p>>q>>r; cin>>a>>b>>c; b+=a; c+=b; ll mn=max({(a-1)*p+1, (b-1)*q+1, (c-1)*r+1}); ll mx=min({a*p, b*q, c*r}); if(mn>mx) cout<<-1<<" "<<-1<