#include #include #include #include #include #include #include using namespace std; using ll = long long; int main() { constexpr int n = 3; ll p[n]; for (int i = 0; i < n; i++) { cin >> p[i]; } ll a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { a[i] += a[i - 1]; } ll i0 = 0, i1 = 1LL << 60; for (int i = 0; i < n; i++) { ll t = a[i] * p[i]; i0 = max(i0, t - p[i] + 1); i1 = min(i1, t); } if (i0 >= i1) { cout << -1 << endl; } else { cout << i0 << ' ' << i1 << endl; } return 0; }