import java.io.*; import java.util.*; public class Main { void submit() { int N = nextInt(); int X = nextInt(); int Y = nextInt(); int Z = nextInt(); int[] A = new int[N]; for(int i=0; i0){ X--; }else if(Y>0){ Y--; }else if(Z>0){ Z--; }else{ buy = "No"; break; } } else if(A[i]<5000){ int tmp_X=A[i]/1000; if(A[i]%1000!=0){ tmp_X++; } if(X>=tmp_X){ X -= tmp_X; }else if(Y>0){ Y--; }else if(Z>0){ Z--; }else{ buy = "No"; break; } }else if(A[i]<10000){ if(X>0){ A[i]-=5000; X--; } int tmp_X=A[i]/1000; if(A[i]%1000!=0){ tmp_X++; } if(X>=tmp_X){ X -= tmp_X; }else if(Y>1){ Y-=2; }else if(Z>0){ Z--; }else{ buy = "No"; break; } }else{ int tmp_Z = A[i]/10000; if(Z>=tmp_Z){ Z -= tmp_Z; }else{ buy = "No"; break; } int amari_Z = A[i]%10000; if(Y>0 && amari_Z>=5000){ Y--; amari_Z -= 5000; } int tmp_X=amari_Z/1000; if(amari_Z%1000!=0){ tmp_X++; } if(X>=tmp_X){ X -= tmp_X; }else if(Y>0){ Y--; }else if(Z>0){ Z--; }else{ out.println("5 "+ A[i]); buy = "No"; break; } } } out.println(buy); } void preCalc() { } void stress() { } void test() { } Main() throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); preCalc(); submit(); //stress(); //test(); out.close(); } static final Random rng = new Random(); static int rand(int l, int r) { return l + rng.nextInt(r - l + 1); } public static void main(String[] args) throws IOException { new Main(); } BufferedReader br; PrintWriter out; StringTokenizer st; String nextToken() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return st.nextToken(); } String nextString() { try { return br.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } int nextInt() { return Integer.parseInt(nextToken()); } long nextLong() { return Long.parseLong(nextToken()); } double nextDouble() { return Double.parseDouble(nextToken()); } }