Created Distance solver

Wrote the algorithm to find it in the comments. Will finish later.