can anyone solve this for me? (look inside)

Ok i ve read so much stuff about shortest path algorithms but i cant solve this problem.

Lets say we have a node 0(0,0) and another node M(A,B)

We also have other nodes between them all are like N1[x1,y1], N2[x2,y2] etc...

Also we do know that 1<=x<=A

What we want to do is find the shortest distance we have to do in order to go from 0(0,0) to M(A,B) and then from M(A,B) come back to 0(0,0) by visitting all the nodes that are between 0(0,0) and M(A,B) only ONE time.

Please dont tell me "go read dijkstra algorithm, prim, floyd etc" cause you just cant solve this by just following the steps of those algorithms, its dynamic programming, in which im not good at all, and i need this to be solved for my C class, i thought about it for like 20 hours but couldnt find any way out.