#include using namespace std; #define int long long signed main(){ int p, q, r; int a, b, c; cin >> p >> q >> r; cin >> a >> b >> c; int mi = max(p*(a-1)+1, max(q*(b+a-1)+1, r*(c+b+a-1)+1)); int ma = min(p*a, min((b+a)*q, (c+b+a)*r)); if(mi <= ma){ cout << mi << " " << ma << endl; }else{ cout << -1 << endl; } return 0; }