title: number of ways of distribution
body: <p>if we have n different things and we need to distribute them among m different people then how many ways can we do it such that for each of the m persons there is conditions that:
  person 1 can have at least a things and at most b things
  person 2 can have at least c things and at most d things 
  .. and so on ?</p>
  
  <pre><code>e.g if n = 5 and m =3 and the conditions are:
  person 1 can receive at least 0 and at most 1 gift
  person 2 can receive at least 1 and at most 3 gift
  person 3 can receive at least 1 and at most 4 gift
  then the number of ways of distributing  these 5 gifts is 6((0 1 4), (0 2 3), (0 3 2), (1 1 3), (1 2 2), (1 3 1)).
  </code></pre>
  
  <p>One way i believe is to iterate through all possible combinations for each range and see which ones sum upto n , but can't think of an efficient algorithm.
  Thanks</p>