The above from S to E through 8 short path so 8!.
The width is 4! So (8!/4!).
The height is also 4! So (short paths factorial / width factorial) / height factorial
Note: This is neither logic nor IQ question. You need a formula to calculate this. If you are an IT company please do not use this type of question as your IQ test. If the candidate cannot answer then you are stupid.