Let \( p \) be the number of all triangles that can be formed by joining the vertices of a regular polygon \( P \) of \( n \) sides and \( q \) be the number of all quadrilaterals that can be formed by joining the vertices of \( P \). If \( p+q=126 \), then the eccentricity of the ellipse \( \dfrac{x^2}{16}+\dfrac{y^2}{n}=1 \).