import java.util.BitSet; import java.util.NoSuchElementException; import java.util.Scanner; public class Main{ static final Scanner s=new Scanner(System.in); public static void main(String args[]){ int n=Math.max(s.nextInt()-101,3),res; PrimeIterator pri = new PrimeIterator(n+100); while((res=pri.next())=0; } public int next(){ if(!hasNext()) throw new NoSuchElementException(); int r=nextV; for(int i=0; ilimit) nextV=-1; return r; } public void reset(){ nextV=2; bitSet.clear(); bitSet.set(0); bitSet.set(1); } }