package con_level_1half; import java.util.Scanner; public class Con842 { static int[] num = new int[6]; static int[] gold = {500,100,50,10,5,1}; public static void main(String[] args) { Scanner s = new Scanner(System.in); for(int i = 0;i < 6;i++){ num[i] = s.nextInt(); } int g = s.nextInt(); s.close(); int t = rec(0,g); if(t == 1){ System.out.println("YES"); }else{ System.out.println("NO"); } } static int rec(int k, int tot){ //k:goldとnumの番号、tot:残りの合計 int tf = 0; if(tot % gold[k] == 0){ if(tot / gold[k] <= num[k]){ tf = 1; }else{ if(k == 5){ tf = 0; }else{ tf = rec(k + 1 ,tot - gold[k] + num[k]); } } }else{ if(tot / gold[k] <= num[k]){ tf = rec(k + 1 , tot % gold[k]); }else{ tf = rec(k + 1 , tot - gold[k] * num[k]); } } return tf; } }