%probcorrect.m
function [res]=probcorrect(lambda) 
%lambda is the vector 
N=length(lambda); 
s=0; 
for j=1:1:N-1 
    temp=1;
    for i=1:1:j-1 temp=temp*(1-lambda(i,1));
    end
    temp=temp*(1-lambda(j,2));
    s=s+temp;
end
temp1=1;
for k=1:1:N-1
    temp1=temp1*(1-lambda(k,1));
end
res=s+temp1; 
res=res/N;