I need help writing a function to calculate the financial contribution of a product subscription into a given month. Not so straight forward however, since it has to consider months with fixed length (30 days) while the subscription is of arbitrary duration.

i.e. Having $m$ as a month of $L(m)$ days and $p$ is a product which has a price $V(p)$, and has been active for $N(m,p)$ days for that month, I am looking for the function $D(m,p)$ which has constant value for every $m$. E.g.:

- For a 30\$ product "SportsChannel", valid from 20/
**02**/2014 to 19/**03**/2014, $D(FEB, SportsChannel) = x$$ - For the same 30\$ product "SportsChannel", though valid from 20/
**03**/2014 to 19/**04**/2014, I should also get $D(MAR, SportsChannel) = x$$

I guess the trick is in making $N(m,p)$ constant, as the number of "real" days ($L(m)$) in each month varies (28 in FEB vs 31 in MAR). Provided that, than I could plug it into something like $D(m,p)=V(p)*\frac{N(m,p)}{\sum_{i=0}^{m_{max}}N(m _i,p)}$

I don't have a lot of practice trying to model my problems in math terms, so sorry if misused the syntax and feel free to bluntly correct me

Anyway, thanks for the help.

p.s.: is it possible to simplify $\frac{N(m,p)}{\sum_{i=0}^{m_{max}}N(m_i,p)}$?