set the term to be 0 when p[k]=q[k]=0