import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int[] values = new int[]{500, 100, 50, 10, 5, 1}; int[] counts = new int[6]; for (int i = 0; i < 6; i++) { counts[i] = sc.nextInt(); } int total = sc.nextInt(); for (int i = 0; i < 6; i++) { int result = total / values[i]; total -= Math.min(counts[i], result) * values[i]; } if (total == 0) { System.out.println("YES"); } else { System.out.println("NO"); } } }