Use any standard path finding algorithm. I would use brute force and simple recursion. Termination condition - the current amount is not less than the specified, the criterion of withdrawal - the equality of the current amount specified plus the current location - the base. Schematically:
proc findpath(currentway, currentplace, currentsum) if currentsum >= checksum then if currentplace.level=0 and currentsum=checksum then output currentway end if else for i=0 to 5 call findpath(currentway+currentplace, currentplace.moveto(i), currentsum+currentplace.weight) next i end if end proc