4. In two boxes, Jia and Yi, each contains the same number of pieces of jewelry. After transferring a piece of jewelry worth 50,000 yuan from Jia to Yi, the average value of the jewelry in Jia decreases by 10,000 yuan, and the average value of the jewelry in Yi increases by 10,000 yuan. Then the total value of the jewelry in both boxes is ( ) ten thousand yuan.
(A) 11
(B) 12
(C) 13
(D) 14
4. B.

Let the original number of jewels in box A be $n(n>1)$, with a total value of $x$ million yuan, and the total value in box B be $y$ million yuan. Then $\left\{\begin{array}{l}\frac{x-5}{n-1}+1=\frac{x}{n}, \\ \frac{y+5}{n+1}-1=\frac{y}{n}\end{array} \Rightarrow\left\{\begin{array}{l}x=-n^{2}+6 n, \\ y=-n^{2}+4 n .\end{array}\right.\right.$
Since $x>0, y>0$, we have $0<n<4$. Therefore, $n=2$ or 3.
Thus, $x+y=-2 n^{2}+10 n=12$.