#include #include #include #include #include #include #include #include #include #include #include using namespace std; using int64 = long long; bool ng(int64 p, int64 a, int64 n, int64 m) { cerr << p << " " << a << " " << n << " " << m << " " << (n+p-1)/p - m << endl; return (n+p-1)/p - m != a; } int main() { int64 p,q,r,a,b,c; cin >> p >> q >> r >> a >> b >> c; int64 _max = min({p*a, q*(b+a), r*(c+a+b)}); int64 _min = max({(a-1)*p, (a+b-1)*q, (a+b+c-1)*r}) + 1; if (_min > _max) { cout << -1 << endl; return 0; } cout << _min << " " << _max << endl; }