Two equations are given:
$a_{1}b_{1} + a_{2}b_{2} + \dots + a_{n}b_{n} = N$
$b_{1} + b_{2} + \dots + b_{n} = M$
and given is set of $a_{1}, a_{2}, \dots a_{n}$
$a_{1}, \dots, a_{n} \geq 0$ and $b_{1}, \dots, b_{n} \geq 0$
How to find all possible equations which satisfy these conditions?
For example:
$a + 2b + c = 5,$
$a+b+c = 4$
We have four combinations: (2,1,1), (1,1,2), (0,1,3), (3,1,0)
Is there any formula for that? What if there will be inequality $ \leq N$