A,B,C,D,E,F,G = map(int,input().split()) sums = 500*A+100*B+50*C+10*D+5*E+F if sums == G: print('YES') else: print('NO')