#include #define p(s) cout<<(s)<>Aw>>Ab>>Bw>>Bb>>C>>D; Bw+=Aw; Aw-=max(0,C-Ab); Bw-=Aw; Aw+=min(Bw,D); p(Aw); return 0; }