8. Suppose when repeatedly tossing a fair coin, the probability of getting five consecutive heads before two consecutive tails is $p$. Then the value of $p$ is $\qquad$ .
8. $\frac{3}{34}$.

Let $A$ denote the event of a coin landing heads up, and $B$ denote the event of landing tails up. A "successful sequence" is a sequence composed of $A$ and $B$ such that $A A A A A$ appears before $B B$. Every successful sequence must belong to one of the following three types:
(1) Starts with $B$, followed by a successful sequence starting with $A$;
(2) Starts with $A, A A, A A A, A A A A$, followed by a successful sequence starting with $B$;
(3) Starts with $A A A A A$.
Let $p_{A}$ be the probability of getting a successful sequence starting with $A$, $p_{B}$ be the probability of getting a successful sequence starting with $B$, and $p_{C}$ be the probability of getting a successful sequence starting with $A A A A A$.
From the recursive relationship, we have
$$
\left\{\begin{array}{l}
p_{B}=\frac{1}{2} p_{A}, \\
p_{A}=\left(\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}\right) p_{B}+p_{C} .
\end{array}\right.
$$

Let $a_{k}$ be the number of ways to get a sequence starting with $A A A A A$ and then tossing the coin $k$ times without getting two consecutive tails.
It is easy to see that $a_{1}=2, a_{2}=3$.
Since the first toss is heads, the number of ways to get a sequence without two consecutive tails in the next $k-1$ tosses is $a_{k-1}$. If the first toss is tails, the second toss must be heads, and the number of ways to get a sequence without two consecutive tails in the next $k-2$ tosses is $a_{k-2}$, hence
$$
a_{k}=a_{k-1}+a_{k-2}(k \geqslant 3) \text {. }
$$

By $\lim _{k \rightarrow \infty} \frac{a_{k}}{2^{k}}$
$$
=\lim _{k \rightarrow \infty} \frac{\frac{1}{\sqrt{5}}\left(\left(\frac{1+\sqrt{5}}{2}\right)^{n}-\left(\frac{1-\sqrt{5}}{2}\right)^{n}\right)}{2^{k}}=0,
$$

then $p_{C}=\frac{1}{32} \times\left(1-\lim _{k \rightarrow \infty} \frac{a_{k}}{2^{k}}\right)=\frac{1}{32}$.
Substituting into the recursive relationship, we get $p_{A}=\frac{1}{17}, p_{B}=\frac{1}{34}$.
Therefore, the probability of getting five consecutive heads before two consecutive tails is $p=p_{A}+p_{B}=\frac{3}{34}$.