public void printNeatly(int[] l, int m) {
		n = l.length;
		extras = new int[n][n];
		c = new int[n];
		lc = new int[n][n];
		
		p = new int[n];

		for (int i = 0; i < n; i++) {
			extras[i][i] = m - l[i];
			for (int j = i + 1; j < n; j++) {
				extras[i][j] = extras[i][j - 1] - l[j] - 1; // -1 for the new
															// space
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (extras[i][j] < 0) {
					lc[i][j] = INF;
				} else if (j == n - 1) {  // last line, cost is defined as 1
					lc[i][j] = 1;
				} else {
					lc[i][j] = (int) Math.pow(extras[i][j], 3);
				}
			}
		}

		c[0] = 0;

		for (int j = 1; j < n; j++) {
			c[j] = INF;
			for (int i = 1; i < j; i++) {
				if ((c[i - 1] + lc[i][j]) < c[j]) {
					c[j] = c[i - 1] + lc[i][j];
					p[j] = i; 
				}
			}
		}

	}