import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); long x = sc.nextLong(); long y = sc.nextLong(); long z = sc.nextLong(); long[] arr = new long[n]; for (int i=0; i=10000) { long cnt = arr[i]/10000; long remain = arr[i]%10000; if (z0) { label: for (int i=n-1; i>=0; i--) { arr[i] = 0; z--; if (z==0) break label; } } label: for (int i=0; i=5000) { long cnt = arr[i]/5000; long remain = arr[i]%5000; if (y0) { label: for (int i=n-1; i>=0; i--) { arr[i] = 0; y--; if (y==0) break label; } } label: for (int i=0; i