import java.util.Scanner; public class B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int[] Val = new int[7]; for(int i=0; i<7; i++) Val[i] = Integer.parseInt(scanner.next()); boolean f = false; for(int i=0; i<=Val[0]; i++) { for(int j=0; j<=Val[1]; j++) { for(int k=0; k<=Val[2]; k++) { for(int l=0; l<=Val[3]; l++) { for(int m=0; m<=Val[4]; m++) { for(int n=0; n<=Val[5]; n++) { if(500*i+100*j+50*k+10*l+5*m+n == Val[6]) f = true; System.out.println(i+j+k+l+m+n); } } } } } } if(f) System.out.println("YES"); else System.out.println("NO"); scanner.close(); } }