In the following equation with unknown integers $x_i$, $1 \leq i \leq N$, the sum of all those integers are $R$. A constraint is added to each integer such that $Min_i \leq x_i \leq Max_i$. The question asks for the total number of integer solution to this equation.
$x_1+x_2+\dots+x_n=R$
(It's relatively easy to deal with lower bound, but how to find the total number of integer solution that any of the upper bound is violated so as to exclude them?)
Please advice. Thanks.