You need to use the Distance formula to find four segments: PQ, RQ, RS, and PS. Using that, you add the segments together. If there are any roots, you leave them be unless you're using a calculator.
Distance Formula: square root of (X1-X)^2 + (Y1-Y)^2