public void visit(int pos, int index, int total){
        if(index >= length) return;
        
        if(total < target) visit(pos, index+1, total);
        
        for(int i = 0; i < appears[index]; i++) {
	        array[pos + i] = num[index];
	        total += num[index];
	        if(total == target){
	        	ArrayList<Integer> item = new ArrayList<Integer>();
	        	for(int j = 0; j <= pos + i; j++)
	        		item.add(array[j]);
	        	res.add(item);
	        	return;
	        } else if(total < target) {
	        	visit(pos+i+1, index+1, total);
	        } else
	        	return;
        }
    }