I am new to this software. Can you help me write this convex optimization problem inside the convex solver. I mean how to represent it inside cvx_begin and cvx_end

min_{q_1,q_2,...,q_n} \sum^{S}_{d=1} \sum^N_{j=1} \gamma_d p_j (1- min(1,dq_j))

s.t

\sum^N_{j=1} q_j = M

0 \leq q_j \leq 1 \forall j \in [1,N]

q_j = m_j/n