#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define lint long long int /* vectoral(26); al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; vectorAL(26); AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; */ int main() { lint P, Q, R, A, B, C; cin >> P >> Q >> R >> A >> B >> C; lint m1, m2, m3, M1, M2, M3; m1 = P * (A - 1) + 1; m2 = Q * (A + B - 1) + 1; m3 = R * (A + B + C - 1) + 1; M1 = P * A; M2 = Q * (A + B); M3 = R * (A + B + C); int ans; vectorm(3); m = { m1,m2,m3 }; vectorM(3); M = { M1,M2,M3 }; sort(m.begin(), m.end()); sort(M.begin(), M.end()); ans = M.at(0) - m.at(2); if (ans >= 0) { cout << m.at(2) << ' ' << M.at(0) << endl; } else { cout << -1 << endl; } }