function [pr,av]=binoptionprice(S0,nd,K)
nsim=50000;
R=binornd(1,.5,nd,nsim);
 S=cumsum(2*R-1);
 av=S0+mean(S,1);
 A=repmat(av',1,length(K))-repmat(K,nsim,1);
 pr=rnd(mean(pos(A)),2);