unsigned i,j,t,x,y=1,z=2,w=3,a[7d6];ll s;{rd(s);x=s;rep(1d7+1)t=x^x<<11,x=y,y=z,z=w,w^=w>>19^t^t>>8,w<3e9?a[j++]=w:0;sort(a,a+j);wt(s=a[5d6]);}