Blitzstein, Introduction to Probability (2019 2 ed), p 58, Example 2.3.10 (Six-fingered man).
A crime has been committed in a certain country. The perpetrator is one (and only one) of the $n$ men who live in the country. Initially, these n men are all deemed equally likely to be the perpetrator. And the eyewitness then reports that the crime was committed by a man with six fingers on his right hand. Let $p_{0}$ be the probability that an innocent man has six fingers on his right hand, and $p_{1}$ be the probability that the perpetrator has six fingers on his right hand, with $p_0$ < $p_1$. (We may have $p_1 < 1$ since eyewitnesses are not 100% reliable.)
Rugen lives in the country. He is found to have six fingers on his right hand.
I skip part (a).
(b) Now suppose that all n men who live in the country have their hands checked, and Rugen is the only one with six fingers on his right hand. Given this information, what is the probability that Rugen is the perpetrator?
Here's the textbook's solution.
Let $R$ be the event that Rugen is guilty and $M$ be the event that he has six fingers on his right hand.
I skip the solution for part (a).
I was wondering how did we arrive at this?

Bayes rule states: $$P(A) = \frac{P(B|A)P(A)}{P(B|A)P(A)+P(B|A^c)P(A^c)} $$
We have: