#include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)<>Aw>>Ab>>Bw>>Bb>>C>>D; int tempW,tempB; //C if(Ab < C){ tempB = Ab; Ab = 0;//Ab-tempB tempW = C - tempB; Aw = Aw - tempW; Bw += tempW; Bb += tempB; }else{ tempB = C; Ab = Ab - tempB; Bb += tempB; } //D if( Bw < D){ cout << Aw + Bw << endl; }else{ cout << Aw + D << endl; } return 0; }