$${M_s = m_sg\cdot \frac{l}{2},\quad M_l = -m_lg\cdot \frac{l}{2},\quad M_p = m_pg\cdot x}$$