13. For a known sequence of distinct real numbers $r_{1}, r_{2}, r_{3}, \cdots, r_{\text {n}}$, a single operation involves comparing the second term with the first term, and swapping them if and only if the second term is smaller; then comparing the third term with the new second term, and swapping them if and only if the third term is smaller; and so on, until the last term is compared with its new preceding term, and they are swapped if and only if the last term is smaller. For example, the following diagram shows how the sequence 1, 9, 8, 7 is transformed into the sequence $1, 8, 7, 9$ through one operation. Each pair of numbers being compared is marked with a “-” below them. Clearly, any known sequence can be sorted into a non-decreasing sequence through one or more such operations.
$$
\begin{array}{llll}
1 & 9 & 8 & 7 \\
\hline 1 & 9 & 8 & 7 \\
1 & 8 & 5 & 6 \\
1 & 8 & 7 & 9
\end{array}
$$

Now assume $n=40$, and $r_{1}, r_{2}, \cdots, r_{40}$ are distinct and randomly arranged. Let $\frac{p}{q}$ (in lowest terms) represent the probability that a single operation will move the 20th term ($r_{20}$) to the 30th position (with 29 terms to its left and 10 terms to its right). Find $p+q$.
13. Notice that the operation defined in the problem, when applied to any sequence $r_{1}, r_{2}, \cdots, r_{k}$ once, will always result in the last number being the largest in the sequence. Therefore, for the initial sequence $r_{1}, r_{2}, \cdots, r_{20}, \cdots, r_{30}, r_{31}, \cdots, r_{40}$, $r_{20}$ can be moved to the 30th position through one operation if and only if in the first 31 numbers $r_{1}, r_{2}, \cdots, r_{20}, \cdots, r_{30}, r_{31}$, $r_{3}$ is the largest number, and $r_{20}$ is the second largest number. Hence, the required probability $\frac{p}{q}=\frac{29!}{31!}=\frac{1}{930} \Rightarrow p+q=931$.