#include "bits/stdc++.h" using namespace std; #define mod 1000000007 #define dom 998244353 #define all(c) begin(c),end(c) #define rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define long long long #define List vector #define var auto #define Count size() #define Length size() int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑ void solve() { long P, Q, R, A, B, C; cin >> P >> Q >> R >> A >> B >> C; bool flag = true; long MAX = P * A; long MIN = P * (A - 1) + 1; //cout << MIN << " " << MAX << endl; long tmp = Q * (A + B); MAX = min(MAX, tmp); tmp = Q * (A + B - 1) + 1; MIN = max(MIN, tmp); //cout << MIN << " " << MAX << endl; tmp = R * (A + B + C); MAX = min(MAX, tmp); tmp = R * (A + B + C - 1) + 1; MIN = max(MIN, tmp); //cout << MIN << " " << MAX << endl; if (MIN > MAX) { flag = false; } if (flag) { cout << MIN << " " << MAX << endl; } else { cout << "-1" << endl; } } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }