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