Finding distance from a point to the origin