equation
$\Large f(i,j)=min(f(i-1,k)+w(k+1,j))$
where $w(i,j)$ represents the minimum distance to a post office in the villages of $[i,j]$ and
$\Large f(i,j)=min(f(i-1,k)+w(k+1,j))$
where $w(i,j)$ represents the minimum distance to a post office in the villages of $[i,j]$ and