$\begin{array}{ll} & \text { We know that } \frac{\text { arc }}{\text { Radius }}=\theta \\ \therefore \quad & \text { elemental length }=R d \theta \\ \therefore \quad & d m=\frac{M}{\pi / 2} d \theta=\frac{2 M}{\pi} d \theta \\ \text { Now } \quad & d U=d m g h=\left(\frac{2 M}{\pi} d \theta\right)(g)(R \sin \theta) \\ \therefore \quad & \int_{0}^{U} d U=\frac{2 M}{\pi} R g \int_{0}^{\pi / 2} \sin \theta d \theta \\ & U=\frac{2 M g R}{\pi}(-\cos \theta)_{0}^{\pi / 2} \\ \Rightarrow \quad U & =M g\left(\frac{2 R}{\pi}\right)\end{array}$