#include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable:4996) typedef long long ll; #define MIN(a, b) ((a)>(b)? (b): (a)) #define MAX(a, b) ((a)<(b)? (b): (a)) #define LINF 9223300000000000000 #define INF 2140000000 const long long MOD = 1000000007; using namespace std; int main(int argc, char* argv[]) { int p,q,r,a,b,c; scanf("%d%d%d%d%d%d", &p,&q,&r,&a,&b,&c); b=a+b; c=b+c; ll l0=MAX(MAX((ll)(a-1)*p,(ll)(b-1)*q),(ll)(c-1)*r); ll r0=MIN(MIN((ll)a*p,(ll)b*q),(ll)c*r); if(l0>=r0) { printf("-1\n"); } else { printf("%lld %lld\n", l0+1,r0); } return 0; }