#include using namespace std; typedef long long ll; #define FOR(i,n) for(int i=0;i<(n);i++) #define MOD 1000000007 #define all(x) (x).begin(),(x).end() template inline bool chmax(T& a,T b){if(a inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;} template inline T LCM(T a,T b){return a/GCD(a,b)*b;} int main(){ ll p,q,r; cin >> p >> q >> r; ll a,b,c; cin >> a >> b >> c; b+=a; c+=b; ll mini,maxi; mini=(a-1)*p+1; maxi=a*p; chmax(mini,max((b-1)*q+1,(c-1)*r+1)); chmin(maxi,min(b*q,c*r)); if(mini>maxi){ cout << -1 << endl; }else{ cout << mini << " " << maxi << endl; } }