PLEASE state the entire problem first! You state "I have a problem for the number of the shortest ways from (0,0,0) to (M,N,P)."

The answer to that is that there is exactlyoneshortest way! It is the straight line from (0, 0, 0) to (M, N, P).

From what you then write, you seem to be considering only lines of integer lengths, parallel to the axes. Is that true?