If 3 is root of the quadratic equation x2−x+k=0, find the value of p so that the roots of the equation x2+k(2x+k+2)+p=0 are equal.