Principle of inclusion-exclusion problem -- EQUATION

I am trying to solve this question - http://www.codechef.com/problems/EQUATION
I figured out that it requires knowledge of principle of inclusion-exclusion. But i am not able to apply it in that question. the successful submissions also use this approach but i didnt get why did they divide (n+1)(n+2)(n+3) by 6.
Any kind of help to understand the whole generalized solution (if there would be five variables instead of three etc) would be appreciated. Thank you