public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		while ((line = in.readLine()) != null && line.length() != 0) {
			tracks = retInts(line);
			totalLength = tracks[0];
			taken = 0;
			dif = totalLength;
			back(1, 0);
			for (int i = 1; i < tracks.length; i++)
				if ((ans & (1 << i)) != 0)
					out.append(tracks[i + 1] + " ");
			out.append("sum:" + sum + "\n");
		}
		System.out.print(out);
	}