program gen_random;

{$APPTYPE CONSOLE}

uses SysUtils;

const
	MAXN = 1000;

var
  i, n: integer;
  
begin
	i:=1;
	while (FileExists(IntToStr(i)+'.in')) do inc(i);
	rewrite(output,IntToStr(i)+'.in');
	
  randomize;
  
  if paramcount > 0 then n := strtoint(paramstr(1)) else n := random(MAXN)+1;
  
  writeln(n);
  
  sleep(30);
end.