#include #include #include #include #include #include #include #include #include #include #include #include #define L64 long long #define UL64 unsigned long long #define MOD (1000000007LL) int main(void) { UL64 nmin, nmax; UL64 p, q, r; UL64 a, b, c; std::cin >> p >> q >> r; std::cin >> a >> b >> c; nmax = p * a; nmin = p * (a - 1ULL) + 1ULL; nmax = std::min(nmax, q * (a + b)); nmin = std::max(nmin, q * (a + b - 1ULL) + 1ULL); nmax = std::min(nmax, r * (a + b + c)); nmin = std::max(nmin, r * (a + b + c - 1ULL) + 1ULL); if (nmin > nmax){ std::cout << -1 << std::endl; } else { std::cout << nmin << " " << nmax << std::endl; } }