#include #define PI 3.14159265359 using namespace std; int main() { int64_t P, Q, R, A, B, C; cin >> P >> Q >> R >> A >> B >> C; int64_t x, y; x = max(max((A - 1) * P + 1, (A + B - 1) * Q + 1), (A + B + C - 1) * R + 1); y = min(min(A * P, (A + B) * Q), (A + B + C) * R); if (x > y) { cout << -1 << endl; } else { cout << x << ' ' << y << endl; } }