Given a prime number $p$ and a set $S$ of $n$ rational numbers. Multiply all $n$ rational numbers we get a number $M$. For each number $x$ in the set $S$, we have $\frac{p+M}{x}$ is an integer. Is it possible to prove that $M$ is also an integer?
For $n = 2$, let $S=\left\{x,y\right\}$. Then $\frac{p+M}{x}=\frac{p}{x}+y$, $\frac{p+M}{y}=\frac{p}{y}+x$ are integers, then multiply the two numbers we have $\frac{p^2}{M}+2p + M$ is an integer, thus $\frac{p^2}{M} + M=\alpha$ is an integer. If $M=\frac{A}{B}$ with $A$, $B$ are coprime, then $B^2\times p^2+A^2=\alpha A B$ so $B|A^2$ then $B=1$, thus $M$ is an integer.
Is it true that for every $n>2$, $M$ is an integer? If not, then what are the conditions of $n$ so that $M$ must be an integer?
Edit: If $M$ is an integer, then is $M$ a power of $p$?