Set up a coordinate system so that Q and P are on the x-axis and the center of the circle is the origin. Then the circle is given by equation where "R" is the length of a radius of the circle (which you don't give but clearly the distance you want depend on R). Take point S to have coordinates (x,0). Then T has coordinates and P has coordinates (R, 0). The distance from S to T is and the distance from S to P is R- x. So your total distance is given by .