Shortest path problem in general : Cube We have $m\times n\times k$ cube. We want to go from $A$ to $B$ and we can only walk on the lines on the surface (horizontally or vertically). How many shortest paths are there?

I know that for a square which dimensions are $m\times n$ shortest path is $  \binom{m+n}{m} = \binom{m+n}{n}$ how do you aproach this problem in 3 dimensions though? I saw similar question but size was fixed and there wasnt much explanation of the anwser: Combinatorics Path problem: Cube
 A: Interesting problem! When I first thought about it, I thought there would be no nice answer, but now I believe there is one.
First, notice that every shortest path will only touch the interior of at most two different faces. In the picture below, the first step has been taken, and it is not hard to see that the path will only touch the three visible faces, and cannot visit the interiors of both the red and blue faces.
There are then three disjoint types of paths:


*

*Paths which touch the interiors of two faces

*Paths which only touch the interior of one face.

*Paths which only move along the edges of the cube.
These paths can be counted separately. For each case, you can use similar reasoning to the two dimensional rectangle problem, since when the cube is unfolded, the path will be contained in either a $(k+n)\times m$, $(k+m)\times n$, or $(m+n)\times k$ rectangle. 
There are still several messy details to handle, but hopefully this is enough to help you solve the problem yourself.
Added Later: I think I have a solution. I used a different method which was a little harder to explain. Namely, for every pair of adjacent faces which touch both $A$ and $B$ (there are six such pairs), I counted the number of paths that stay on both of those faces and added them up. This double counts some paths, so these were subtracted out. The net result (which I am not certain of) is
$$
2\Big[\binom{n+m+k}{n}+\binom{n+m+k}{m}+\binom{n+m+k}{k}\Big]-2\Big[\binom{n+m}{n}+\binom{m+k}{m}+\binom{n+k}{k}\Big]
$$

