program xmz;
var
x:array[1..10000]of integer;
z:array[1..10000]of integer;
t,i,j,k,s:integer;
f1,f2:text;
begin
z[1]:=2;k:=1;
for i:=3 to 10000 do
begin t:=0;for j:=1 to k do if i mod z[j]=0 then t:=1;if t=0 then begin k:=k+1;z[k]:=i;end;end;
for i:=1 to k-1 do
begin
j:=i;s:=0;repeat s:=s+z[j]; x[s]:=x[s]+1; j:=j+1;until s+z[j]>10000;
end;
x[k]:=x[k]+1;
assign(f1,'conprime.in');assign(f2,'conprime.out');
reset(f1);rewrite(f2);
repeat
read(f1,t);
if t<>0 then
writeln(f2,x[t]);
until t=0;
close(f1);close(f2);
end.