#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a calc(Int p,Int a){ return make_pair(p*a-(p-1),p*a); } signed main(){ Int p,q,r; Int a,b,c; cin>>p>>q>>r>>a>>b>>c; auto x=calc(p,a); auto y=calc(q,a+b); auto z=calc(r,a+b+c); auto ans=make_pair((Int)0,(Int)1e18); for(auto p:{x,y,z}){ //cout<