using System; using static System.Console; using System.Linq; using System.Collections.Generic; using System.Runtime.Intrinsics.Arm; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var t = Math.Min(c[0], c[6] / 500); c[6] -= Math.Min(c[0], c[6] / 500) * 500; c[6] -= Math.Min(c[1], c[6] / 100) * 100; c[6] -= Math.Min(c[2], c[6] / 50) * 50; c[6] -= Math.Min(c[3], c[6] / 10) * 10; c[6] -= Math.Min(c[4], c[6] / 5) * 5; c[6] -= Math.Min(c[5], c[6]); WriteLine(c[6] == 0 ? "YES" : "NO"); } }