// Arup Guha
// 1/8/2015
// Solution to 2005 MCPC Problem F: Painter

import java.util.*;

public class f {

	final public static int SIZE = 50;
	final public static int MAXCOLORS = 12;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numPaints = stdin.nextInt();

		// Go through each case.
		while (numPaints != 0) {

			// Read painting requirements.
			int[] vals = new int[numPaints];
			for (int i=0; i<numPaints; i++)
				vals[i] = stdin.nextInt();
			int myGray = stdin.nextInt();

			// Solve and go to next case.
			System.out.println(solve(vals, myGray));
			numPaints = stdin.nextInt();
		}
	}

	public static int solve(int[] vals, double grayNeeded) {

		int n = vals.length;

		// Set need based on colors.
		int need = 0;
		for (int i=0; i<n; i++)
			need = Math.max(need, (vals[i]+SIZE-1)/SIZE);

		// Set up paints.
		int[] have = new int[n];
		Arrays.fill(have, SIZE*need);

		// Use up colored paint.
		for (int i=0; i<n; i++)
			have[i] -= vals[i];

		// Sort and use from left to right.
		Arrays.sort(have);

		// Amount of extra packages we buy.
		int extra = 0;

		// Loop until everything can be painted.
		while (true) {

			// Take original lefovers plus extra packages.
			int[] cur = new int[n];
			for (int i=0; i<n; i++)
				cur[i] = have[i] + extra*SIZE;

			// Calculate sums of 3rd to last, 2nd to last and all.
			double threeDown = 0;
			for (int i=0; i<n-2; i++)
				threeDown += cur[i];
			double twoDown = threeDown+cur[n-2];
			double all = twoDown + cur[n-1];

			// Can't do more than third down, or half of snd down, or
			// a third of it all.
			double gray = Math.min(threeDown, twoDown/2);
			gray = Math.min(gray, all/3);

			// See if this was enough.
			if (gray > grayNeeded-1e-9) break;

			// Try another extra package.
			extra++;
		}

		return need+extra;
	}
}