In a triangle ABC, D is the midpoint of AB and E is a point on BC such that BE=23 BC. If AD=p and AC=q, express EC in terms of p and q.