n=5; m=7; x=[4,3,1,2,5,4,3]; y=[3,1,3,4,3,3,1]; weight=[4440,22348,28368,25086,6991,10638,11106]; q=4; start=[4,1,5,2]; end=[5,3,4,5];