Optimal transport with branching distance costs and the obstacle problem