ll n,u,z,a,b[3d5],c[3d5]; { rd(n); rep(n)rd(a),++c[a],z+=a; z*=n; rrep(a,1,2d5+1){ b[a]=b[a+1]+c[a]; u=0; rep(t,a,2d5+1,a)u-=b[t]; z+=u*a*c[a]; } wt(z); }