ArrayList<ArrayList<Integer>> combinationSumHelper(int[] candidates, int target, int index) {
        ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
        if (index == candidates.length) {
            if (target == 0) {
                result.add(new ArrayList<Integer>());
            }
            return result;
        }
        
        for (int i = 0; i <= (int)(target / candidates[index]); i++) {
            ArrayList<ArrayList<Integer>> sub_result = 
                combinationSumHelper(candidates, target - i * candidates[index], get_next(candidates, index));
            for (ArrayList<Integer> list : sub_result) {
                ArrayList<Integer> newlist = new ArrayList<Integer>();
                for (int j = 0; j < i; j++) {
                    newlist.add(candidates[index]);
                }
                newlist.addAll(list);
                result.add(newlist);
            }
        }
        return result;
    }