p=[1  0  0 0  0;
   0 .2 .8 0  0;
   0 .7 .3 0  0;
   .1 0 .1 .4 .4;
   0 .1 .3 .2 .4
   ]
Q=p(4:5,4:5)

k=4;
fund=inv(eye(2)-Q)
expected=fund(1,1)

N=30;
sum=0;
for i=0:N
   d=p^i;
   sum=sum+d(k,k);
end
sum