import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int[] a = new int[7]; for (int i = 0; i < 7; i++) { a[i] = Integer.parseInt(sa[i]); } br.close(); int[] coin = {500, 100, 50, 10, 5, 1}; for (int i = 0; i < 6; i++) { while (a[6] >= coin[i] && a[i] > 0) { a[6] -= coin[i]; a[i]--; } } if (a[6] == 0) { System.out.println("YES"); } else { System.out.println("NO"); } } }