function phi = calc_phi(V_prime, alpha)

F = V_prime;
[ order_V_prime, null ] = size(V_prime);

dist(1) = F(1,1);
phi = dist(1)*alpha;
alpha_cdf = 0;
n = 2;
sum_total = dist(1);
count = 1;
while (sum_total < 0.9999)
    for i=1:order_V_prime 
        for j=1:order_V_prime            
            total = 0;
            for m=1:order_V_prime
                total = total + V_prime(i,m)*F(m,j);
            end
            F_new(i,j) = total - F(j,j)*V_prime(i,j);
        end
    end
    dist(n) = F_new(1,1);
    sum_total = sum_total + dist(n);
    alpha_cdf = alpha_cdf + (1-alpha)^(n-1);
    phi = phi + dist(n)*alpha*alpha_cdf;
    n = n+1;
    F = F_new;
end
