p = function(k) (1/7)*(-1/2)^k*3^(1 - k)*((-6)^k - 8)
q = function(k) (2/3)*p(k-1)+(1/2)*(1-p(k-1))