Let's describe a polymer as a linear chain of $N$ links which all have a bendable part. The energies of one link are $\epsilon_-$ (unbended) and $\epsilon_\wedge$ (bended). Additionally, the lengthsof a single link are given by $l_-$ (unbended) and $l_\wedge < l_-$ (bended).
With this information, I want to compute the canonical partition function for a given length $L$ of the polymer:
$$Z(T,L,N) = \sum_\text{states $n$} e^{-\beta E_n}$$
with $N$ the total number of links in the chain and $\beta = \frac{1}{kT}$. $L$, $N$ and the number of bended links $N_\wedge$ are not independent, so the sum runs over all states which satisfy the relation which connects $L$, $N$ and $N_\wedge$.
My problem is that I have no idea how to tackle this. I tried to express the total energy and length by
$$E = N\epsilon_- + N_\wedge(\epsilon_\wedge-\epsilon_-)\qquad\text{and}\qquad L = Nl_- + N_\wedge(l_\wedge-l_-)$$
but this still leaves me with the question how to evaluate the sum for the partition function. Can anybody help me with this?