title: Subset sum variation
body: <p>Given an integer <code>n</code> and <code>s</code> sets of different sizes, but with positive ascending numbers from <code>0</code> to <code>s_i</code> as elements. Let a good sum be defined here as <code>a_1 + a_2 + ... + a_s = n</code>. Count how many sums are existent, when you take for every <code>a_i</code> an element from it's corresponding set <code>s_i</code>.</p>
  
  <p>I tried to generate any possible way and omit those which are omittable, i.e. when you have for example <code>s=3</code>, <code>n=1</code> and you are given the sets <code>s_0={0,1}</code>, <code>s_1={0,1,2,3}</code>, <code>s_2={0,1,2}</code>, then you can omit the check for the sum <code>0 + 0 + a_3</code> since <code>a_3</code> won't be able to be large enough.
  I've applied the dynamic programming solution for normal subset sum for each of those possible sequences, however, I get much larger results than I should and its very slow, too.</p>
  
  <p>Are there any good algorithms which I can apply here?</p>