function pp = state(p0,n)

  p = 1/3;

  T = [1 0 0 0 0; 1-p 0 p 0 0; 0 1-p 0 p 0; 0 0 1-p 0 p; 0 0 0 0 1];
 
  [k,l] = size(p0);
 
  if     ((k==1) & (l==5)) pp = p0 * T^n;
  elseif ((k==5) & (l==1)) pp = (T')^n * p0;
  else error('Vector must be 5x1 or 1x5');
  end
