formula for distance | ScratchStats