wa,ba=map(int,input().split()) wb,bb=map(int,input().split()) a,b=map(int,input().split()) if a-ba>=0: wa-=a-ba wb+=a-ba if wb