The coordinates of point A are (-5,p) and the coordinates of point B are (7,10). The midpoint of the linear segment AB has coordinates (q,3). Find the value of q and p.​