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