function [p] = method1(r)
k=size(r,1);
C = r + diag(sum(r,2)-(k-1));
p =[C(1:k-1,:); ones(1,k)]\[zeros(k-1,1); 1];


