program binacy;
var
last,now,temp,n,i:longint;
begin
assign(input,'binacy.in');
assign(output,'binacy.out');
reset(input);
rewrite(output);
last:=1;
now:=2;
readln(n);
if n<3 then begin
if n=1 then writeln(1) else writeln(2);
end
else begin
for i:=3 to n do
begin
temp:=(last+now)mod 15746;
last:=now;
now:=temp;
end;
writeln(now);
end;
close(input);
close(output);
end.