import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[1010]; int[][] dp = new int[1010][1010]; int[][] jiaoshui = new int[1010][1010]; // dp[i][j]代表从第i个到第j个石头合并的重量 // jiaoshui[i][j]代表从第i个到第j个石头合并的胶水量 for (int i = 1; i <= n; i++) { a[i] = in.nextInt(); dp[i][i] = a[i]; } // for (int i=1; i