#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char rbuf[500000]; char e[10000001]; int s; main(){ read(0,rbuf,sizeof rbuf); char*r=rbuf; int c; int n=0; while(c=*r++-48,c>=0)n=n*10+c; while(n--){ int a=0; while(c=*r++-48,c>=0)a=a*10+c; e[s+=a]=1; } int i; for(i=0;++i<=3162;){ int a; for(a=0;(a+=i)