Length of the path on a rectangular grid

Information: Length of the path on a rectangular grid