#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { ll p, q, r, a, b, c; cin >> p >> q >> r >> a >> b >> c; ll x = max({ (a - 1) * p + 1, (a + b - 1) * q + 1, (a + b + c - 1) * r + 1 }); ll y = min({ a * p, (a + b) * q, (a + b + c) * r }); if (x > y) cout << -1 << endl; else cout << x << ' ' << y << endl; return 0; }