p[1300],w[9999],n,s,j;main(i){for(scanf("%d",&n);s=i++