import java.util.*; //memo class Yuki4_2{ public static final int MAX_N = 100; public static final int MAX_W = 110000; public static boolean[][] dpChecker = new boolean[MAX_N+1][MAX_W+1]; public static int[][] dpMemo = new int[MAX_N+1][MAX_W+1]; public static int[] w = new int[MAX_N+1]; static int myDP(int i,int j){ //System.out.println(i+" "+j); if(dpChecker[i][j] == true) {return dpMemo[i][j];} int res; if(i==MAX_N){res = 0;} else if(j < w[i]){res = myDP(i+1,j);} else{ if(myDP(i+1,j-w[i])+w[i] < myDP(i+1,j)){ res = myDP(i+1,j); }else{ res = myDP(i+1,j-w[i])+w[i]; } } dpChecker[i][j] = true; dpMemo[i][j] = res; return res; } public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); int sumW = 0; for(int i=0;i