Consider two cylindrical and homogeneous rods that touch at a common pivot (see figure). One of the rods has length $L_{r}$ and mass $m_{r}$, the other has length $L_{l}$ and mass $m_{l}$.

What is their gravitational potential energy?

Is it

$$U=\frac{L_{r}}{2}m_{r}g\cos\theta-\frac{L_{l}}{2}m_{l}g\cos\theta$$ or

$$U=\frac{L_{l}}{2}m_{l}g\cos\theta-\frac{L_{r}}{2}m_{r}g\cos\theta$$ or

$$U=\frac{L_{r}}{2}m_{r}g\cos\theta+\frac{L_{l}}{2}m_{l}g\cos\theta$$?