PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".Unfortunately, PolandBall is not experienced yet and doesn't know that his hypothesis is incorrect. Could you prove it wrong? Write a program that finds a counterexample for any n.

The only number in the input is n (1 ≤ n ≤ 1000) — number from the PolandBall's hypothesis.

Output such m that n·m + 1 is not a prime number. Your answer will be considered correct if you output any suitable m such that 1 ≤ m ≤ 103. It is guaranteed the the answer exists.

NoteA prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.For the first sample testcase, 3·1 + 1 = 4. We can output 1.In the second sample testcase, 4·1 + 1 = 5. We cannot output 1 because 5 is prime. However, m = 2 is okay since 4·2 + 1 = 9, which is not a prime number.

var n,i,j,q:longint;
begin
 read(n);
 for i:=1 to 1000 do
  begin
   q:=0;
   for j:=2 to round(sqrt(n*i+1)) do
    if (n*i+1) mod j=0
     then begin
           q:=1;
           break;
          end;
   if q=1
    then begin
          write(i);
          break;
         end;
  end;
end.

Program PolandBallandHypothesis;
uses math;
var n,i:longint;
Function nt(x:longint):boolean;
var j:longint;
begin   if x<=1 then exit(false);
        if x<4 then exit(true);
        for j:=2 to trunc(sqrt(x)) do
        if x mod j=0 then exit(false);
        exit(true);
end;
begin   //assign(input,'755A.inp'); reset(input);
        //assign(output,'755A.out'); rewrite(output);
        readln(n);
        for i:=1 to 1000 do
        if nt(n*i+1) then continue
        else begin
        writeln(i); break;
        end;
        //close(input); close(output);
end.

var a,s,d,i,ii,k:longint;
begin
readln(a);
for i:=1 to 1000 do
begin
k:=0;
for ii:=2 to a*i do
begin
if (a*i+1) mod ii=0 then
k:=1;
end;
if k=1 then
begin
writeln(i);
halt;
end;
end;
end.

var
  m,n,i,j: integer;
begin
  readln(n);
  for m:= 1 to 1000 do begin
    for i:=1 to 1000 do begin
      if ((n*m+1) mod i = 0) then begin
        for j:=2 to 1000 do begin
          if ((n*m+1) mod j = 0) and ((n*m+1) <> j) then begin write(m); halt; end;
        end;
      end;
    end;
  end;
end.

var a:integer;
begin
  read(a);
  if (a<3)then write(a+2)else write(a-2);
end.

program pr;
var n,m,cur:integer;
function isSimple(n:integer):boolean;
  var i:integer;
  begin
    if n < 3
    then isSimple:=true
    else
      begin
        isSimple:=true;
        for i:=2 to n-1 do
          if n mod i = 0 then begin
            isSimple:=false;
            exit;
          end;
      end;
end;
begin
  //for i:=0 to 20 do begin
  //  writeln(i,' ',(isSimple(i)?'+':'-'))
  //end;
  readln(n);
  m:=0;
  cur := 1;
  repeat
    inc(cur,n);
    inc(m);
  until not isSimple(cur);
  writeln(m);
end.

const fi = '';
      fo = '';
var n, i, m, a, j: longint;
    chuan: boolean;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);

  readln(n);
    begin
      if n = 1 then m:=3;
      m:=1;
      while true do
        begin
          a:=n*m+1;
          chuan:=false;
          for j:=2 to trunc(sqrt(a)) do
            if a mod j = 0 then
              begin
                chuan:=true;
                break;
              end;
          if chuan then break;
          inc(m);
        end;
      write(m);
    end;

  close(input); close(output);
end.

begin
    var n := ReadInteger;
    if n = 1 then write(3)
    else if n = 2 then write(4)
    else write(n - 2);
end.

function sodda(a:integer):integer;
var
  i,j,n,m:integer;
begin
  for i:=2 to a-1 do
  begin
  if a mod i=0 then begin sodda:=1; j:=1; break;  end;
  end;
  if j<>1 then sodda:=2;
end;
var
i,j,n,m,k:integer;
begin
  read(n);
  while k<>1 do
  begin inc(i);
  if sodda(n*i+1)=1 then begin writeln(i); exit; end;
  end;
end.

var n,m:integer;
begin
readln(n);
m:=0;
if (n mod 2 <> 0) and (n<>1) then m:=1
else
 begin
 if (n<>2) and(n<>1) then
  repeat
  inc(m);
  until ((n*m+1) mod (n-1) = 0)
  else m:=7
 end;
writeln(m);
end.

Var
    m: Int64;

Begin
    Read(m);
    For Var i := 1 to 1000 do
        For Var j := 2 to Trunc(sqrt(m*(1000 - i + 1) + 1)) do
            If (m*(1000 - i + 1) + 1) mod j = 0 then Begin
                Write(1000 - i + 1);
                Exit
            End
End.

program polsha;
var n,m:integer;
begin
readln(n);
if n mod 2=1 then
m:=3
else if n=2 then
m:=4
else
m:=n-2;
writeln(m);
end.

var n, m : integer;

function is_p (a : integer) : boolean;
  begin
    if (a = 1) then
      begin
        is_p := false;
        exit;
      end
    else if (a = 2) then
      begin
        is_p := true;
        exit;
      end;
    for var i := 2 to trunc(sqrt(a)) + 1 do
      if (a mod i = 0) then
        begin
          is_p := false;
          exit;
        end;
    is_p := true;
  end;

begin
  read (n);
  for m := 1 to 100 do
    if (not is_p (((n*m) + 1))) then
      begin
        write (m);
        exit;
      end;
end.

var n:longint;
begin
 read(n);
 if odd(n) then write(5) else   if n mod 3=2 then write(7) else if n mod 3=1 then write(8) else
 write(n+2);
end.

  const eps=0.000000001;
   besk=2000000000000000008;  nn=200000;
   label 1,2,3;
    type   { real=double;}  {string=ansistring;}
    mas=array [0..nn] of longint;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of longint;mass1=^mass;
    var pp,tt,dx,dy,left,right,mmin,kk,gr,ttt,t,kol,pos,x1,x2,p,z,pmax,imax,p1,p2,p3,p4,l,ot,nm,n,s1,s2,m,s,smin,cen,dl,t2,i1:int64;
    k,dist,xmin,xmax,ymin,ymax,time,jj,step, ii,i,j:longint;
     aa,bb,cc:double;
     ss,ss1:string;
     npx,npy:array[-1000..1000] of int64;
     napx,napy:array[-1..30,-100..100] of int64;
     finzan,zan:array[0..31,-1..10,-200..200,-200..200] of boolean;
     kolnap  :array[0..31,-200..200,-200..200] of longint;
     finnap: array[0..31,-1..20,-200..200,-200..200] of byte;
     c,d,x,y,aold,b,a:array[-10..1000002] of int64;
     dda:array[-10..1200,-10..1200] of int64;
   zanx,zany:array[-10..200000] of boolean;
   polog:array[-10..200004, 0..5] of int64;
    zzan:array[-1000..3000,-1000..3000] of boolean;
    ss2:array[-1000..1000000] of string;
     fl:array[-10000..600000] of boolean;
    sss:string;ch:char;
    pole1,pole :array [-10..2000,-10..2000] of char;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       oldflag,flag,flag1:boolean;
    function al(x,y:extended):extended; var t0,t1,p,s0,s1:extended;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

begin
   { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }
      read(n);
     if n<=998 then begin  writeln(n+2); goto 1; end;
     if n=1000 then begin  writeln(1000); goto 1; end;
     if n=999 then begin  writeln(1); goto 1; end;

   1:          close(output);
end.

{$APPTYPE CONSOLE}

uses
    SysUtils;

var
    n, m: integer;

function prime(x: integer): boolean;
var
    i: integer;
begin
    if ((x mod 2 = 0) and (x > 2)) then
        result := false
    else
        result := true;
    i := 3;
    while ((i <= trunc(sqrt(x)) + 1) and (result)) do begin
        if (x mod i = 0) then
            result := false;
        i := i + 2;
    end;
end;

begin
    read(n);
    m := 2;
    while (prime(n * m + 1)) do
        inc(m);
    write(m);
    readln;
    readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n: int64;
  i: integer;

function pr(a: integer): boolean;
var
  i: integer;
begin
  for i := 2 to trunc(sqrt(a)) do
    if(a mod i = 0) then
    begin
      pr := false;
      exit;
    end;
  pr := true;
end;

begin
  readln(n);
  for i := 1 to 1000000 do
    if(not pr(n * i + 1)) then
    begin
      writeln(i);
      halt(0);
    end;
end.

{$APPTYPE CONSOLE}
{$R+,Q+,I+,O-}
uses SysUtils,math;
var n,m,i,j,l,k,t:longint;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(n);
  for m:=10 to 1000 do
  begin
    k:=n*m+1;
    t:=trunc(sqrt(k));
    if (t*t<>k) then inc(t);
    for i:=2 to t do
    begin
      if (k mod i=0) then
      begin
        writeln(m);
        halt;
      end;
    end;
  end;
end.

program A;

{$APPTYPE CONSOLE}

uses
  SysUtils;

Var
  m,n       :integer;

begin
  readln(n);
  if (n=1) then write(3)
  else if (n=2) then write(4)
  else if (n>2) then write(n-2);

end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

function check (x:longint):boolean;
var i:longint;
f:boolean;
begin
f:=true;
if x<2 then f:=false;
 for i:=2 to round(sqrt(x)) do
  if x mod i = 0 then f:=false;
 check:=f;
end;

var
 i,n,j,x,res,max :longint;
 mas:array[1..10000] of longint;
begin
  read(n);
  for i:=1 to 1000 do
   if not(check((n*i)+1)) then begin
   writeln(i);
   halt;
   end;

  readln;
  readln;
end.

program cntestvadimA;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  n,m   :integer;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(n);
  if (n=1) then m:=3
  else if (n=2) then m:=4
  else if (n=3) then m:=1
  else m:=(n-2);
  write(m);
end.

var n:longint;
begin
 read(n);
 if n=1 then write(5)
        else if n=2
              then write(4)
              else write(n-2);

end.

var
  pi, n, m, s, i: longint;
  prost: array[1..10000] of longint;

procedure pr();
var t:boolean;
i:longint;
begin
  while pi < 10000 do
  begin
    inc(s);
    t:=true;
    for i:=1 to pi do
      if s mod prost[i] = 0 then begin t:=false; break; end;
    if t=true then
    begin
      inc(pi);
      prost[pi]:=s;
    end;
  end;
end;

procedure input();
begin
  read(n);

end;

procedure minm();
var buf,i:longint;
t,t1:boolean;
begin
  t:=true;
  while t=true do
  begin
    t1:=true;
    inc(m);
    buf:=n*m+1;
    for i:=1 to pi do
      if buf=prost[i] then begin t1:=false; break; end;
    if t1=true then t:=false;
  end;
end;

procedure output();
begin
  write(m);
end;

begin
  s := 1;
  pr();
  input();
  minm();
  output();
end.

var
n,i,k,j:longint;
begin
	readln(n);
	for i:=1 to 1000 do
	begin
	for j:=1 to n*i+1 do
	if ((n*i+1) mod j) = 0 then
	k:=k+1;
	if k>2 then
	begin
	writeln(i);
	break;
	end
	else
	k:=0;
	end;
end.

var m,n,i,j:longint;

Begin
	Readln(n);
	If (n mod 2<>0) then Writeln('3')
	Else if n=2 then Writeln('4')
	Else Writeln(n-2);
End.

var n,m:longint;

function prost(a:longint): boolean;
  var k,i:longint;
    begin
        k:=round(sqrt(a));
        if(a=2) then
          prost:=false
        else
          for i:=2 to k do
            if(a mod i=0) then
              begin
                 prost:=true;
                 break;
              end
            else if(i=k) then
              prost:=false;
    end;

begin
    read(n);
    m:=1;
    while (true) do
      begin
          if(prost(n*m+1)) then
            break;
          inc(m);
      end;
    writeln(m);
end.

var n:LongInt;
begin
readln(n);
case n of
1 : writeln('3');
2 : writeln('4');
else writeln(n-2)
end
end.

function pr(a:longint):integer;
var q:integer;
i:longint;
begin
  q:=0;
  if (a=1)or((a<>2)and(a mod 2=0)) then q:=q+1;
  i:=3;
  while (i<=sqrt(a))and(q=0) do
  begin
    if a mod i=0 then q:=q+1;
    i:=i+2;
  end;
  pr:=q;
end;
var m,n:longint;
begin
  read(n);
  m:=1;
  while pr(n*m+1)=0 do
  m:=m+1;
  writeln(m);
end.

program z1;
var a,b,c,d,i,n:longint;

Function NotPrime(x:longint):boolean;
var i:longint;
begin
for i:=2 to round(sqrt(x)) do if x mod i=0 then exit(true);
exit(false);
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(n);
//if n mod 2=1 then begin write('1'); exit; end;
for i:=1 to 1000 do
 begin
 if NotPrime((i*n)+1) then begin write(i); exit; end;
 end;
end.

var n,t:longint;
function pd(x:longint):boolean;
var i:longint;
begin
if x<2 then exit(false);
for i:=2 to trunc(sqrt(x))do
  if x mod i=0 then exit(false);
exit(true);
end;
begin
//assign(input,'hypo.in');reset(input);
//assign(output,'hypo.out');rewrite(output);
readln(n);
while true do
  begin
  inc(t);
  if pd(t*n+1)=false then
    begin
    writeln(t);break;
    end;
  end;
close(input);close(output);
end.

var n,i,j:longint;
f:array[0..1000001] of boolean;
begin
//assign(input,'hypo.in');reset(input);
//assign(output,'hypo.out');rewrite(output);
readln(n);
f[1]:=true;
for i:=2 to trunc(sqrt(1000000)) do
    if f[i]=false then
      for j:=i to 1000000 div i do
          f[i*j]:=true;
for i:=1 to 1000 do
   if f[n*i+1] then
      begin
      writeln(i);
      close(input);close(output);halt;
      end;
close(input);close(output);
end.

var x,y:longint;
function pd(x:longint):boolean;
var i:longint;
begin
if x<2 then exit(false);
for i:=2 to trunc(sqrt(x))do
  if x mod i=0 then exit(false);
exit(true);
end;
begin
//(input,'hypo.in');reset(input);
//assign(output,'hypo.out');rewrite(output);
readln(x);
for y:=1 to 1000 do
  if pd(x*y+1)=false then
    begin
    writeln(y);break;
    end;
close(input);close(output);
end.

var n,m:longint;
function pd(x:longint):boolean;
var i:longint;
begin
if x<2 then exit(false);
for i:=2 to trunc(sqrt(x)) do
  if x mod i=0 then exit(false);
exit(true);
end;
begin
//assign(input,'hypo.in');reset(input);
//assign(output,'hypo.out');rewrite(output);
readln(n);m:=1;
while pd(n*m+1) do m:=m+1;
writeln(m);
close(input);close(output);
end.

var n,i:longint;
function pd(x:longint):boolean;
var i:longint;
begin
if x<2 then exit(false);
for i:=2 to trunc(sqrt(x)) do
    if x mod i=0 then exit(false);
exit(true);
end;
begin
//assign(input,'hypo.in');reset(input);
//assign(output,'hypo.out');rewrite(output);
readln(n);
for i:=1 to 100000 do
    if pd(n*i+1)=false then
       begin
       writeln(i);
       halt;
       end;
close(input);close(output);
end.

var
n,m:integer;
i,l,c,tr:integer;
begin
readln(n);
l:=0;
m:=0;

while l<>1 do begin
inc(m);
c:=1; tr:=trunc(sqrt(m*n+1));
for i:=2 to tr do begin
if ( ((n*m)+1) mod i)<>0 then inc(c);
end;
if c<>tr then l:=1;

end;

writeln(m);

end.

program VC8N2;
var
  v,n,m,i,j: integer;
  b: boolean;
begin
  b:=false;
  readln(n);
  for m:=1 to 100 do
  begin
   if b then break else for i:=2 to n*m+1 do if ((n*m+1) mod i=0) and (i<>n*m+1) then
    begin
     b:=true;
     break
    end;
  if b then writeln(m);
  end;
end.

var
  n,i,m,stop,k : longint;

begin

 readln(n);

 if n = 1 then begin writeln(3); halt; end;
 if n mod 2 <> 0 then begin writeln(1); halt; end;

 i:=1;

 stop:=0;

 while stop = 0 do begin
  k:=2;
  m:=n*i+1;
    while m mod k <> 0 do inc(k);
     if k <> m then break;
  inc(i);
 end;

  writeln(i);

end.

Program z1;
var
    n,s:integer;
    i,j:integer;
    f:boolean;

begin
    read(n);
    for i:=1 to 1000 do begin
        s:=n*i+1;
        f:=false;
        for j:=2 to trunc(sqrt(s)) do begin
            if s mod j = 0 then f:=true;
            if f=true then break;
        end;
        if f=true then break;
    end;
    write(i);
end.

var n,m,i :integer;
begin
readln(n);
if n > 2 then writeln(n-2);
if n = 2 then writeln('7');
if n = 1 then writeln('14');
end.

var
  m,a,b,i,n,k,j:longint;
  x:array[1..111111]of longint;
begin
  read(n);

  for i:=1 to 1000 do
    begin
    k:=n*i+1;
      for j:=2 to 1000 do
      begin
        if (k mod j=0) and (k<>j) then begin writeln(i);halt;end;
      end;
    end;
end.

var
  n,a,b,i : longint;
begin
  readln(n);
  while (1 = 1) do
  begin
    inc(b);
    a := n*b+1;
    for i := 2 to round(sqrt(a)) do
      if (a mod i = 0) then
      begin
        writeln(b);
        exit;
      end;
  end;
end.

var i,p:longint;
s,a:int64;

function prost(x:int64):longint;
var x2,i:longint;
begin
  x2:=trunc(sqrt(x));
  for i:=2 to x2 do
    if x mod i=0 then exit(1);
  exit(0);
end;

begin
  readln(a);
  for i:=1 to 1000000 do
    begin
      s:=(a*int64(i))+1;
      p:=prost(s);
      if p=1 then begin
                    writeln(i);
                    halt;
                  end;
    end;
end.

program polandballa;
var
a: longint;
begin
read(a);
if a<3 then write(a+2) else write(a-2)
end.

var n,i,m,S,d:longint;
    SNT:boolean;
begin
        Readln(n);
        m:=1;SNT:=true;
        While SNT=true do
                begin
                        S:=n*m+1;
                        d:=0;
                        For i:=2 to trunc(sqrt(S)) do
                            begin
                                 If S mod i=0 then inc(d);
                                 If d<>0 then
                                    begin
                                         Writeln(m);
                                         halt;
                                    end;
                            end;
                        inc(m);
                end;
end.

var
n,i,ch,j:longint;
b:boolean;
begin
readln(n);
if (n=1) then writeln('3')
else
if (n=2) then writeln('4')
else
begin
for i:=1 to n do begin
b:=false;
ch:=n*i+1;
for j:=2 to round(sqrt(ch)) do begin
if ch mod j = 0 then begin
b:=true;
break;
end;
end;
if b then begin
writeln(i);
break;
end;
end;
end;
end.

var
n,i,q,j:longint;
bol:boolean;
begin

readln(n);
for i:=1 to 10000000 do begin
    q:=n*i+1;
    bol:=true;
    for j:=2 to trunc(sqrt(q)) do begin
        if q mod j = 0 then begin
            bol:=false;
            break;
        end;
    end;
    if bol=false then begin
    writeln(i);
    break;
    end;
end;
end.

var n : longint;

begin
    readln(n);
    if (n < 999) then writeln(n + 2)
    else if (n = 999) then writeln(1)
    else writeln(8);
end.

program oo;
Var i,m,n,k:integer;
    f:boolean;
begin
 Readln(n);
 m:=0;
 f:=false;

 while f=false do
 begin
  inc(m);
  k:=m*n+1;
  for i:=2 to k-1 do
   if k mod i = 0 then f:=true;
 end;
 writeln(m);
 readln;
end.

var n,m: longint;
begin
readln (n);
m:=n-2;
if n=1 then writeln ('3') else
if n=2 then writeln ('4') else writeln (m);
end.

uses math;
const
	fi = '';
	fo = '';
	maxN = 1001;
Var
	n,i,j,m:longint;
	p:array[1..maxN*maxN] of longint;
Begin
	assign(input, fi); reset(input);
	assign(output,fo); rewrite(output);
	for i:=2 to trunc(sqrt(maxN*maxN)) do
		if p[i] = 0 then
		begin
			j:=i*i;
			while j<=maxN*maxN do
			begin
				p[j]:=i;
				j:=j+i;
			end;
		end;
	readln(n);
	for m:=1 to 1000 do
		if p[n*m+1]>0 then
		begin
			writeln(m);
			break;
		end;
	close(input); close(output);
end.

var i,j,k,l,m,n,x:longint;
    a:array[1..100001]of longint;
begin
                for i := 2 to (100001+1)div 2 do begin
                        x:=i*2;
                        while x<=100001 do
                                begin
                                        a[x]:=1;
                                        x:=x+i;
                                end;
                        x:=0;
                end;
        read(n);
        for i := 1 to 100 do
                if a[(i*n+1)] = 1 then
                        begin
                                writeln(i);
                                exit;
                        end;
end.

var
	n, i: longword;

function is_prime: boolean;
var
	x, k: longword;
begin
	x:= n*i+1;
	if x <=1 then exit(true)
	else if x<= 3 then exit(false);
	for k:=2 to trunc(sqrt(x)) do
		if (x mod k) = 0 then exit(true);
	is_prime:= false;
end;
begin
	read(n);
	for i:= 1 to 1000 do
		if is_prime then
			begin
				write(i);
				break;
			end;
end.

const
    fi='';
    fo='';
var f,g:text;
    n:longint;
procedure nhap;
begin
    assign(f,fi);
    reset(F);
    readln(f,n);
    close(f);
end;
function kt(n:longint):boolean;
var i:longint;
begin
    if n<2 then exit(false);
    if n=2 then exit(true);
    for i:=2 to trunc(sqrt(n)) do
    if n mod i=0 then exit(false);
    exit(true);
end;
procedure xuli;
var i:longint;
begin
    assign(G,fo);
    rewrite(G);
    if i=1 then write(g,3) else for i:=1 to 1000 do if kt(n*i+1)=false then
    begin
        writeln(g,i);
        break;
    end;
    close(g);
end;
begin
    nhap;
    xuli;
end.

var a:integer;
begin
  read(a);
  if (a<3)then write(a+2)else write(a-2);
end.

var
 n,m,i,j: longint;
 f: array [0..1111111] of boolean;
begin
 readln(n);

 m:=trunc(sqrt(1000000));
 for i:=2 to m do if not f[i] then
 begin
  j:=i*i;
  while j <= n*100 do
  begin
   f[j]:=true;
   inc(j,i);
  end;
 end;

 for i:=1 to 100 do if f[i*n+1] then
 begin
  writeln(i);
  halt;
 end;

end.

var n,i,j:longint;
begin
  readln(n);
  if n mod 2 <> 0 then writeln(3)
    else
      for i:=2 to 1000 do
        for j:=2 to trunc(sqrt(n*i+1)) do
          if (n*i+1) mod j = 0 then begin writeln(i); exit; end;

end.

  var
     n,m,i,j:longint;

       a:array[1..1000000] of boolean;
    begin

      read(n);

           for i:=1 to n*n+10 do a[i]:=true;

            a[1]:=false;

          for i:=2 to n do begin

            if a[i] then begin

              j:=i;

                while j<=n*n+10 do begin

                 j:=j+i;

                  a[j]:=false;

                 end;

              end;

            end;

                for i:=1 to 1000 do

                  if a[n*i+1]=false then begin write(i); halt; end;

            end.

var
i,j:longint;
m,q,n:int64;
bol:boolean;
begin
readln(n);
bol:=false;
while true do begin
inc(i);
q:=n*i+1;
for j:=2 to trunc(Sqrt(q)) do begin
    if q mod j = 0 then begin
        bol:=true;
        break;
    end;
end;
if bol then begin
    writeln(i);
    break;
end;
end;
end.

var n,i,k:longint;
x,j:longint;

begin
  readln(n);

  for i:=1 to 1000 do
    begin
      k:=0;
      x:=(i*n)+1;
      for j:=1 to x do
        if x mod j=0 then k:=k+1;
      if k>2 then begin
                    writeln(i);
                    halt;
                  end;
    end;
end.

var
  a, c, d, max, j,r, b, y, g, i: longint;
  x: array [1..1000] of longint;
  s, q: string;

begin
  read(a);
  i := 1;
  while (true) do
  begin
    for j := 1 to trunc(sqrt((a * i + 1))) do
      if ((a*i+1) mod j=0) and (j<>1) then begin
        inc(c);
        break;
      end;
    if (c <> 0) then begin
      write(i);
      break;
    end;
    inc(i);
    c:=0;
  end;
end.

var n,i:longint;
function prime(a:int64):boolean;
var i:longint;
begin
        for i:=2 to a div 2 do
        begin
                if a mod i = 0 then exit(false);
        end;
        exit(true);
end;

begin
        read(n);
        for i:=1 to 1000 do
        begin
                if prime(n*i+1)=false then
                begin
                        write(i);
                        halt;
                end;
        end;
end.

var n,m:integer;
begin
  readln(n);
  if n<3 then m:=n+2 else m:=n-2;
  writeln(m);
  end.

var n,i,x,m:longint;
    a:array[1..100000] of int64;
begin
 readln(m);
 n:=100000 ;
  for i:=2 to (n+1) div 2 do
  begin
   x:=i*2;
    while x<=n do begin
     a[x]:=1;
     x:=x+i;
    end;
    x:=0;
  end;
  for i:=m+1 to n do
   if a[i] = 1
   then begin
    if (i-1) mod m=0
    then begin
     writeln((i-1) div m);
     exit;
    end;
   end;

end.

var
  f       : boolean;
  x,n,i,j : longint;
begin
  readln(n);

  if n=1 then begin writeln(3); exit; end;
  if n=2 then begin writeln(4); exit; end;

  for i:=1 to n do begin
    x:=n*i+1;
    f:=true;
    for j:=2 to x div 2 do
      if x mod j =0
        then begin f:=false; break; end;

    if f=false then begin f:=true; writeln(i); exit; end

  end;

end.

var i,m,n,j:longint;
begin
read(n);
for m:=1 to 1000 do
begin
i:=n*m+1;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then begin write(m); halt; end;
end;
end.

var n,m,k,j,ch:integer;
begin
read(n);
m:=0;
while k<=3  do begin
ch:=(n*m)+1;
j:=1;
k:=1;
while (k<4)and(j<=ch) do begin
if (ch mod j)=0 then k:=k+1;
j:=j+1;
end;
if  k>3 then writeln(m) else
m:=m+1;
end;
end.

var n,i,j:longint;
    bl:array[1..1000000] of boolean;
begin
 readln(n);
 bl[1]:=true;
 for i:=2 to 1000000 do
  if bl[i] = false then
   for j:=2 to 1000000 div i do bl[i*j]:=true;
 for i:=1 to 1000 do
  if bl[n*i+1] = true then
   begin
    write(i);
    break;
   end;
end.

var a,b: longint;
begin
read(a); if a=1 then begin b:=17; write(17); halt end;
if a mod 2 = 1 then begin b:=1;  write('1'); halt end;
if a mod 3 = 0 then begin b:=a-2; write(a-2); halt end;
if a mod 3 = 1 then begin b:=5; write('5'); halt end;
write('4'); b:=4; end.

var i,fl,m,n,kol,q:longint;
begin
readln(n);
m:=1;
while fl=0 do begin
kol:=0;
q:=n*m+1;                          kol:=0;
for i:=2 to round(sqrt(q)) do
if q mod i = 0 then inc(kol);
if kol>0 then inc(fl);
if kol=0 then inc(m);
end;
writeln(m);
end.

var a:integer;begin read(a);if(a<3)then write(a+2)else write(a-2);end.

var a:integer;
begin
  read(a);
  if (a<3)then write(a+2)else write(a-2);
end.

var  n,n1,k,i,j:integer;
begin
read(n);
for i:=1 to 1000 do
 begin
  n1:=n*i+1;
  k:=0;
  for j:=1 to round(sqrt(n1)) do
    begin
     if n1 mod j = 0 then inc(k);
     if k>1 then break
    end;
  if k>1 then
     begin
       k:=i;
       break;
     end;
 end;
write(k);
end.

Var n,m,i,j,p:longint;
Begin
readln(m);
p:=0;
for i:=1 to 1000 do
begin
for j:=1 to ((i*m)+1) do
if ((m*i)+1) mod j =0 then p:=p+1;
if p>2 then begin writeln(i); exit; end;
p:=0;
end;
End.

var n,i,z,kl:int64;

function pr(x:int64):int64;
var f,x2,q:longint;
begin
  f:=0;
  x2:=trunc(sqrt(x));
  for q:=2 to x2 do
    if x mod q=0 then begin
                        f:=1;
                        break;
                      end;
  pr:=f;
end;

begin
  readln(n);
  i:=n-1;
  while true do
  begin
    i:=i+1;
    z:=i-1;
    kl:=pr(i);
    if kl=0 then continue;
    if (z<>0) and (z mod n=0) then begin
                                     writeln(z div n);
                                     halt;
                                   end;

  end;
end.

var n,i:longint;
function prost(x:longint) : boolean;
var i:longint;
begin
prost:=false;
for i:=2 to trunc(sqrt(x)) do
if x mod i = 0 then begin
                    prost:=true;
                    break
                    end;
end;
begin
readln(n);
for i:=1 to 1000 do
if PROST(N*I+1) then begin
                     write(i);
                     break
                     end;
  end.

var n:longint;
begin
read(n);
if n>2 then
        write(n-2)
else
        write(n+2);
end.

var i,j,m,n:longint;
function prime(u:longint):boolean;
var i,j:longint;
begin
    for i:=2 to trunc(sqrt(u)) do if u mod i=0 then exit(false);
    exit(true);
end;
begin
    readln(n);
    for m:=1 to 1000 do begin
        if prime(n*m+1)=false then begin
            writeln(m);
            close(input);
            close(output);
            halt;
        end;
    end;
end.

const maxprima = 1999999;
      maxcheck = 1415;
var prima: array [0..maxprima] of boolean;

procedure sieve;
var I, J: longint;
begin
  prima[0]:= false; prima[1]:= false;
  for I:= 2 to maxprima do prima[I]:= true;
  for I:= 2 to maxcheck do
    if prima[I] then begin
      J:= I * I;
      while J <= maxprima do begin
        prima[J]:= false;
        inc(J, I);
      end;
    end;
end;

var N, M: longint;

begin
  sieve;
  readln(N);
  M:= 1;
  while true do begin
    if not prima[N * M + 1] then begin
      writeln(M);
      exit;
    end;
    inc(M);
  end;
end.

    var
		n, b, c, r: int64;
		a: array of integer;

    begin

		readln(n);
		SetLength(a, 10001);

		var i := 2;
		var j: integer;
		while (i <= 10000) do
		begin
			j := i * 2;
			while(j <= 10000) do
			begin
				a[j] += 1;
				j += i;
			end;
			i += 1;
		end;
		a[0] := 1;
		a[1] := 1;
		for var l := 1 to 10000 do
		begin
			if (a[n*l+1] >= 1) then
			begin
				writeln(l);
				break;
			end;
		end;

    end.

var a,b,i,s,d,k: longint;
begin

read(a);
for b:=1 to 1000 do
begin
d:=a*b+1;
s:=round(sqrt(d));
k:=0;
for i:=2 to s do
if d mod i=0 then inc(k);
if k>0 then break;
end;
write(b);

end.

var h,g,f,l,n:integer;
begin
readln(h);
for g:=1 to 1000 do begin
f:=g*h+1;
for l:=f downto 1 do
if f mod l=0 then n:=n+1;
if n>2 then begin writeln(g);break;end;
n:=0;
end;
end.

var
  a, b, c, d, i: int64;

function check(a: int64): boolean;
var
  i: int64;

begin
  i := 2;
  while i * i <= a do begin
    if a mod i = 0 then begin
      check := true;
      exit;
    end;
    inc(i);
  end;
  check := false;
end;

begin
  readln(a);
  i := 1;
  while i <= 1000 do begin
    if check(a * i + 1) then begin
      writeln(i);
      halt();
    end;
    inc(i);
  end;
end.

Var n : Longint;
Begin
Readln(n);
If n <= 2 then Writeln('7') else Writeln(n-2);
End.

Program _755A;
var
  n, m : longint;
function Prost(x : longint) : boolean;
  var
    i : longint;
    b : boolean;
  begin
    b := true;
    for i := 2 to round(sqrt(x)) do
      if x mod i = 0
         then begin
                b := false;
                break;
              end;
    Prost := b;
  end;
begin
  read(n);
  m := 1;
  while prost(n * m + 1) do
    inc(m);
  write(m);
end.

var n,m,i,b,q,j:longint;
begin
  readln(n);
  for i:=1 to 1000 do
    begin
      b:=n*i+1;
      q:=trunc(sqrt(b));
      for j:=2 to q do
        if b mod j=0 then begin
                            writeln(i);
                            halt;
                          end;
    end;
end.

program ret;
var n,m,d,c,k: integer;
begin
readln(n);
K:=0;
for m:=1 to 1000 do
begin
c:=n*m+1;
for d:= 2 to c-1 do
If c/d = trunc(c/d) then k:= k+1;
If k>0 then break;
end;
write(m);
end.

program qq;

var
     n, m, q, i, k: integer;

begin
     read(n);
     k := 0;
     m := 0;
     while k = 0 do
     begin
          m := m + 1;
          q := n * m + 1;
          for i := 2 to q - 1 do
               if q mod i = 0 then k := 1;

     end;
     writeln(m);
end.

program Hypothesis;

var n              : longint;

begin
     readln(n);

     if n < 3
     then n := n + 4;

     writeln(n - 2);
end.

var s,n,i,o,p,k:integer;
begin
read(n);
s:=n;
while p=0 do
begin
inc(o);
n:=n*o+1;
k:=0;
  for i:=1 to 10 do
    if (n mod i=0)then inc(k);
  if (k>2)then p:=o;
n:=s;
end;
write(p);
end.

var n,i,o,p,k:integer;
begin
read(n);
while p=0 do
begin
inc(o);
n:=n*o+1;
  for i:=1 to 10 do
    if (n mod i=0)then inc(k);
    if (k>2)then p:=o;
end;
write(p);
end.

const fi = '';
      fo = '';
var n, i, m, a, j: longint;
    chuan: boolean;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);

  readln(n);
  if n mod 2 = 1 then write(1)
  else
    begin
      m:=1;
      while true do
        begin
          a:=n*m+1;
          chuan:=false;
          for j:=2 to trunc(sqrt(a)) do
            if a mod j = 0 then
              begin
                chuan:=true;
                break;
              end;
          if chuan then break;
          inc(m);
        end;
      write(m);
    end;

  close(input); close(output);
end.

function sodda(a:integer):integer;
var
  i,j,n,m:integer;
begin
  for i:=2 to a-1 do
  begin
  if a mod i=0 then begin sodda:=1; j:=1; break;  end;
  end;
  if j<>1 then sodda:=2;
end;
var
i,j,n,M:integer;
begin
  read(n);
  for i:=1 to n do
  if sodda(n*i+1)=1 then begin writeln(i); exit; end;
end.

var n,m,i:integer;
begin
readln(n);
if n mod 2 <> 0 then m:=1
else
 begin
  repeat
  inc(m);
  until (n*m+1) mod (m+1) = 0;
 end;
writeln(m);
end.

var n,m:integer;
begin
readln(n);
m:=0;
if n mod 2 <> 0 then m:=1
else
 begin
 if n<>2 then
  repeat
  inc(m);
  until ((n*m+1) mod (m+1) = 0)
  else m:=7
 end;
writeln(m);
end.

var n,m:integer;
begin
readln(n);
m:=0;
if n mod 2 <> 0 then m:=1
else
 begin
 if n<>2 then
  repeat
  inc(m);
  until ((n*m+1) mod (n-1) = 0)
  else m:=7
 end;
writeln(m);
end.

var n,m:integer;
begin
readln(n);
m:=0;
if n mod 2 <> 0 then m:=1
else
 begin
 if n<>2 then
  repeat
  inc(m);
  until ((n*m+1) mod (m+1) = 0)
  else m:=4
 end;
writeln(m);
end.

var n,m:integer;
begin
readln(n);
m:=0;
if n mod 2 <> 0 then m:=1
else
 begin
 if n<>2 then
  repeat
  inc(m);
  until ((n*m+1) mod (n-1) = 0)
  else m:=4
 end;
writeln(m);
end.

Var
    m: Int64;

Begin
    Read(m);
    For Var i := 1 to 1000 do
        If (m*i + 1) mod 11 = 0 then Begin
            Write(i);
            Exit
        End
End.

Var
    m: Int64;

Begin
    Read(m);
    For Var i := 1 to 1000 do
        For Var j := 1 to Trunc(sqrt(m*(1000 - i + 1) + 1)) do
            If (m*(1000 - i + 1) + 1) mod j = 0 then Begin
                Write(1000 - i + 1);
                Exit
            End
End.

Var
    m: Int64;

Begin
    Read(m);
    For Var i := 1 to 1000 do
        If ((m*i + 1) mod 11 = 0) and (m*i + 1 <> 11) then Begin
            Write(i);
            Exit
        End
End.

Var
    m: Int64;

Begin
    Read(m);
    If m mod 2 = 1 then
        Write(1)
    Else If m mod 3 = 1 then
        Write(2)
    Else If m mod 3 = 2 then
        Write(1)
    Else If m mod 3 = 0 then
        If m mod 10 = 2 then
            Write(2)
        Else If m mod 10 = 4 then
            Write(1)
        Else If m mod 10 = 6 then
            Write(4)
        Else If m mod 10 = 0 then
            For Var i := 1 to 11 do
                If (m*i + 1) mod 11 = 0 then Begin
                    Write(i);
                    Exit
                End
End.

Var
    n: Int64;

Begin
    Read(n);
    For Var i := 1 to 1000 do
        For Var j := 2 to Trunc(sqrt(n)) + 1 do
            If (n*i + 1) mod j = 0 then Begin
                Write(i);
                Exit
            End
End.

program polsha;
var n,m:integer;
begin
readln(n);
if n mod 2=1 then
m:=1
else if n=2 then
m:=4
else
m:=n-2;
writeln(m);
end.

var n, m : integer;

function is_p (a : integer) : boolean;
  begin
    for var i := 2 to trunc(sqrt(a)) + 1 do
      if (a mod i = 0) then
        begin
          is_p := false;
          exit;
        end;
    is_p := true;
  end;

begin
  read (n);
  for m := 1 to n do
    if (not is_p (n*m + 1)) then
      begin
        write (m);
        exit;
      end;
end.

  const eps=0.000000001;
   besk=2000000000000000008;  nn=200000;
   label 1,2,3;
    type   { real=double;}  {string=ansistring;}
    mas=array [0..nn] of longint;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of longint;mass1=^mass;
    var pp,tt,dx,dy,left,right,mmin,kk,gr,ttt,t,kol,pos,x1,x2,p,z,pmax,imax,p1,p2,p3,p4,l,ot,nm,n,s1,s2,m,s,smin,cen,dl,t2,i1:int64;
    k,dist,xmin,xmax,ymin,ymax,time,jj,step, ii,i,j:longint;
     aa,bb,cc:double;
     ss,ss1:string;
     npx,npy:array[-1000..1000] of int64;
     napx,napy:array[-1..30,-100..100] of int64;
     finzan,zan:array[0..31,-1..10,-200..200,-200..200] of boolean;
     kolnap  :array[0..31,-200..200,-200..200] of longint;
     finnap: array[0..31,-1..20,-200..200,-200..200] of byte;
     c,d,x,y,aold,b,a:array[-10..1000002] of int64;
     dda:array[-10..1200,-10..1200] of int64;
   zanx,zany:array[-10..200000] of boolean;
   polog:array[-10..200004, 0..5] of int64;
    zzan:array[-1000..3000,-1000..3000] of boolean;
    ss2:array[-1000..1000000] of string;
     fl:array[-10000..600000] of boolean;
    sss:string;ch:char;
    pole1,pole :array [-10..2000,-10..2000] of char;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       oldflag,flag,flag1:boolean;
    function al(x,y:extended):extended; var t0,t1,p,s0,s1:extended;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

begin
 {   assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }
      read(n);
      writeln(n+2);

   1:          close(output);
end.

{$APPTYPE CONSOLE}

uses
    SysUtils;

var
    n, m: integer;

function prime(x: integer): boolean;
var
    i: integer;
begin
    if ((x mod 2 = 0) xor (x <> 2)) then
        result := false
    else
        result := true;
    i := 3;
    while ((i <= trunc(sqrt(x)) + 1) and (result)) do begin
        if (x mod i = 0) then
            result := false;
        i := i + 2;
    end;
end;

begin
    read(n);
    m := 3;
    while (prime(n * m + 1)) do
        inc(m);
    write(m);
    readln;
    readln;
end.

{$APPTYPE CONSOLE}

uses
    SysUtils;

var
    n, m: integer;

function prime(x: integer): boolean;
var
    i: integer;
begin
    if (x mod 2 = 0) then
        result := false
    else
        result := true;
    i := 3;
    while ((i <= trunc(sqrt(x)) + 1) and (result)) do begin
        if (x mod i = 0) then
            result := false;
        i := i + 2;
    end;
end;

begin
    read(n);
    m := 1;
    while (prime(n * m + 1)) do
        inc(m);
    write(m);
    readln;
    readln;
end.

{$APPTYPE CONSOLE}
{$R+,Q+,I+,O-}
uses SysUtils,math;
var n,m,i,j,l,k,t:longint;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(n);
  for m:=1 to 1000 do
  begin
    k:=n*m+1;
    t:=trunc(sqrt(k));
    if (t*t<>k) then inc(t);
    for i:=2 to t do
    begin
      if (k mod i=0) then
      begin
        writeln(m);
        halt;
      end;
    end;
  end;
end.

program cntestvadimA;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  n,m   :integer;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(n);
  if (n=1) then m:=0
  else if (n=2) then m:=0
  else if (n=3) then m:=1
  else m:=(n-2);
  write(m);
end.

program cntestvadimA;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  n,m   :integer;
begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(n);
  if (n=1) then m:=3
  else if (n=2) then m:=0
  else if (n=3) then m:=1
  else m:=(n-2);
  write(m);
end.

var n:longint;
begin
 read(n);
 if n=1
  then write(2)
  else write(abs(n mod 2 - 2));
end.

var n:longint;
begin
 read(n);
 if n=1
  then write(3)
  else write(abs(n mod 2 - 2));
end.

var
n,i,k,j:longint;
begin
	readln(n);
	for i:=1 to n do
	begin
	for j:=1 to n*i+1 do
	if ((n*i+1) mod j) = 0 then
	k:=k+1;
	if k>2 then
	begin
	writeln(i);
	break;
	end
	else
	k:=0;
	end;
end.

var m,n,i,j:longint;

Begin
	Readln(n);
	If (n mod 2<>0) then Writeln('1')
	Else Writeln(n-2);
End.

var m,n,i,j:longint;

Begin
	Readln(n);
	If (n mod 2<>0) and (n<>1) then Writeln('3')
	Else Writeln(n-2);
End.

var n,m:longint;

function prost(a:longint): boolean;
  var k,i:longint;
    begin
        k:=round(sqrt(a));
        if(a=2) then
          writeln('prime')
        else
          for i:=2 to k do
            if(a mod i=0) then
              begin
                 prost:=true;
                 break;
              end
            else if(i=k) then
              prost:=false;
    end;

begin
    read(n);
    m:=1;
    while (true) do
      begin
          if(prost(n*m+1)) then
            break;
          inc(m);
      end;
    writeln(m);
end.

var n:LongInt;
begin
readln(n);
writeln(n-2);
end.

var n:LongInt;
begin
readln(n);
case n of
1 : writeln('1');
2 : writeln('4');
else writeln(n-2)
end
end.

program z1;
var a,b,c,d,i,j,k,l,m,n:longint; Z:array['a'..'z'] of longint; P:array['A'..'Z'] of longint;
s1,s:ansistring;

Function min(x,y:longint):longint;
begin
if x<y then exit(x) else exit(y);
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(s);
s1:='Bulbasaur';
for i:=1 to length(s) do
 begin
 if s[i] in ['a'..'z'] then inc(Z[s[i]]) else inc(P[s[i]]);
 end;
a:=P['B']; for i:=2 to length(s1) do begin b:=Z[s1[i]]; if (s1[i]='u') or (s1[i]='a') then b:=b div 2; a:=min(a,b); end;
writeln(a);
end.

var
n,m:integer;
i,l,c,tr:integer;
begin
readln(n);
l:=0;
m:=0;
if n<=3 then begin l:=1; m:=1; end;
while l<>1 do begin
inc(m);
c:=1; tr:=trunc(sqrt(m*n+1));
for i:=2 to tr do begin
if ( ((n*m)+1) mod i)<>0 then inc(c);
end;
if c<>tr then l:=1;

end;

writeln(m);

end.

var n,m,i :integer;
begin
readln(n);
if n > 2 then writeln(n-2);
if n = 2 then writeln('7');
if n = 1 then writeln('1');
end.

var
  n,a,b,i : longint;
begin
  readln(n);
  while (1 = 1) do
  begin
    inc(b);
    a := n*b+1;
    for i := 2 to round(sqrt(a))+1 do
      if (a mod i = 0) then
      begin
        writeln(b);
        exit;
      end;
  end;
end.

var
n,i,q,j:longint;
bol:boolean;
begin

readln(n);
for i:=1 to 10000000 do begin
    q:=n*i+1;
    bol:=true;
    for j:=2 to trunc(sqrt(j)) do begin
        if q mod j = 0 then begin
            bol:=false;
            break;
        end;
    end;
    if bol then begin
    writeln(i);
    break;
    end;
end;
end.

var
n,i,ch,j:longint;
b:boolean;
begin
readln(n);
for i:=1 to n do begin
b:=false;
ch:=n*i+1;
for j:=2 to round(sqrt(ch)) do begin
if ch mod j = 0 then begin
b:=true;
break;
end;
end;
if b then begin
writeln(i);
break;
end;
end;
end.

var
n,i,ch,j:longint;
b:boolean;
begin
readln(n);
if (n=1) or (n=2)then writeln('4')
else
begin
for i:=1 to n do begin
b:=false;
ch:=n*i+1;
for j:=2 to round(sqrt(ch)) do begin
if ch mod j = 0 then begin
b:=true;
break;
end;
end;
if b then begin
writeln(i);
break;
end;
end;
end;
end.

var n : longint;

begin
    readln(n);
    writeln(n + 2);
end.

var n,m: longint;
begin
readln (n);
m:=n-2;
writeln (m);
end.

var n,m: longint;
begin
readln (n);
m:=n-2;
if n=1 then writeln ('3') else
if n=2 then writeln ('2') else writeln (m);
end.

uses math;
const
	fi = '';
	fo = '';
	maxN = 1001;
Var
	n,i,j,m:longint;
	p:array[1..maxN*maxN] of longint;
Begin
	assign(input, fi); reset(input);
	assign(output,fo); rewrite(output);
	for i:=2 to trunc(sqrt(maxN*maxN)) do
		if p[i] = 0 then
		begin
			j:=i*i;
			while j<=maxN*maxN do
			begin
				p[j]:=i;
				j:=j+i;
			end;
		end;
	readln(n);
	for m:=1 to 1000 do
		if p[n*m+1]=1 then
		begin
			writeln(m);
			break;
		end;
	close(input); close(output);
end.

var
	n, i: longword;

function is_prime: boolean;
var
	x, k: longword;
begin
	x:= n * i + 1;
	if x <= 1 then exit(false)
		else if x <= 3 then exit(true)
			else if (x mod 2 = 0) and (x mod 3 = 0) then exit(false);
	k:= 5;
	while k * k < x do
	begin
		if (x mod k = 0) or (x mod (k+2) = 0 ) then exit(false);
		inc(k, 6);
	end;
	is_prime:= true;
end;
begin
	read(n);
	for i:= 1 to n do
		if is_prime then
			begin
				write(i);
				break;
			end;
end.

const
    fi='';
    fo='';
var f,g:text;
    n:longint;
procedure nhap;
begin
    assign(f,fi);
    reset(F);
    readln(f,n);
    close(f);
end;
function kt(n:longint):boolean;
var i:longint;
begin
    if n<2 then exit(false);
    if n=2 then exit(true);
    for i:=2 to trunc(sqrt(n)) do
    if n mod i=0 then exit(false);
    exit(true);
end;
procedure xuli;
var i:longint;
begin
    assign(G,fo);
    rewrite(G);
    if n=1 then write(g,0) else for i:=1 to 1000 do if kt(n*i+1)=false then
    begin
        writeln(g,i);
        break;
    end;
    close(g);
end;
begin
    nhap;
    xuli;
end.

const
    fi='';
    fo='';
var f,g:text;
    n:longint;
procedure nhap;
begin
    assign(f,fi);
    reset(F);
    readln(f,n);
    close(f);
end;
function kt(n:longint):boolean;
var i:longint;
begin
    if n<2 then exit(false);
    if n=2 then exit(true);
    for i:=2 to trunc(sqrt(n)) do
    if n mod i=0 then exit(false);
    exit(true);
end;
procedure xuli;
var i:longint;
begin
    assign(G,fo);
    rewrite(G);
    if n=1 then write(g,0) else for i:=1 to n do if kt(n*i+1)=false then
    begin
        writeln(g,i);
        break;
    end;
    close(g);
end;
begin
    nhap;
    xuli;
end.

var n:longint;
begin
  readln(n);
  if n mod 2 <> 0 then writeln(1) else writeln(2);
end.

var n,i,j:longint;
begin
  readln(n);
  if n mod 2 <> 0 then writeln(3)
    else
      for i:=2 to 1000 do
        for j:=2 to 1000 do
          if n*i+1 mod i <> 0 then begin writeln(i); exit; end;

end.

var n,i,j:longint;
begin
  readln(n);
  if n mod 2 <> 0 then writeln(1)
    else
      for i:=2 to 1000 do
        for j:=2 to 1000 do
          if n*i+1 mod i <> 0 then begin writeln(i); exit; end;

end.

var
  f       : boolean;
  x,n,i,j : longint;
begin
  readln(n);

  if n=1 then begin writeln(3); exit; end;

  for i:=1 to n do begin
    x:=n*i+1;
    f:=true;
    for j:=2 to x div 2 do
      if x mod j =0
        then begin f:=false; break; end;

    if f=false then begin f:=true; writeln(i); exit; end

  end;

end.

var
  f       : boolean;
  x,n,i,j : longint;
begin
  readln(n);

  for i:=1 to n do begin
    x:=n*i+1;
    for j:=2 to x div 2 do
      if x mod j =0 then begin f:=false; break; end;
    if f=false then begin f:=true;continue end
    else begin writeln(i); exit;end;

  end;

end.

var
  f       : boolean;
  x,n,i,j : longint;
begin
  readln(n);

  for i:=1 to n do begin
    x:=n*i+1;
    f:=true;
    for j:=2 to x div 2 do
      if x mod j =0
        then begin f:=false; break; end;

    if f=false then begin f:=true; writeln(i); exit; end

  end;

end.

var n:longint;
begin
 readln(n);
 if n mod 2 = 0 then write(n-1)
  else write(n);
end.

var a,b: longint;
begin
read(a); if a=1 then begin b:=17; write(17); halt end;
if a mod 2 = 1 then begin b:=1;  write('1'); halt end;
if a mod 3 = 0 then begin b:=1; write('1'); halt end;
if a mod 3 = 1 then begin b:=5; write('5'); halt end;
write('4'); b:=4; end.

var a,b: longint;
begin
read(a);
if a mod 2 = 1 then begin b:=1;  write('1'); halt end;
if a mod 3 = 0 then begin b:=1; write('1'); halt end;
if a mod 3 = 1 then begin b:=5; write('5'); halt end;
write('4'); b:=4; end.

    var
		n, b, c, r: int64;
		a: array of integer;

    begin

		readln(n);
		SetLength(a, 1101);

		var i := 2;
		var j: integer;
		while (i <= 1100) do
		begin
			j := i * 2;
			while(j <= 1100) do
			begin
				a[j] += 1;
				j += i;
			end;
			i += 1;
		end;
		a[0] := 1;
		a[1] := 1;

		if (n mod 2 = 1) then
			writeln(1)
		else begin
			for var l := 1 to 1100 do
			begin
				if (a[n*l+1] <> 0) then
				begin
					writeln(l);
					break;
				end;
			end;
		end;

    end.

Var n : Longint;
Begin
Readln(n);
If n mod 2 = 0 then Writeln('997') else Writeln('998');
End.

Var n : Longint;
Begin
Readln(n);
If n mod 2 = 0 then Writeln('998') else Writeln('997');
End.

Var i , n , m : Longint;
Begin
Readln(n);
//For i := 1 to 1000 do
//If Frac(Sqrt(n*m+1)) <> 0 then Break;
//Writeln(i);
If n mod 10 = 1 then Writeln('998') else Writeln('999');
End.

Var n : Longint;
Begin
Readln(n);
Writeln('997');
End.