#include #include #include using namespace std; int main(){ int Aw,Ab,Bw,Bb,C,D; cin >> Aw >> Ab >> Bw >> Bb >> C >> D; if(C<=Aw){ Bw+=C; Aw-=C; } else{ Bw+=Aw; Aw=0; } Aw+= (D<=Bw)? D:Bw; cout << Aw << endl; return 0; }