Let $S$ be an $R$-module where $R$ is an integral domain and let $P = \langle p \rangle $ be a prime ideal.
Define:
$S_{P}=\{s \in S: p^{n} s=0 \ \textrm{for some natural }n\}$.
As usual, denote $\mathrm{Hom}_{R}(S,S)$ the set of all homomorphisms (of $R$-modules) from $S$ to $S$.
Let $S$ be a torsion $R$-module where $R$ is a domain. Can someone please explain why is the following isomorphism true?
$$\mathrm{Hom}_{R}(S,S) \cong \prod_{P\text{ prime}} \mathrm{Hom}_{R}(S_{P},S_{P})$$