const maxn=1000000007; var cas,xx,n,i:longint; ans:int64; a,b,st,ed,shit,num,x,y:array[0..300010]of longint; mi:array[0..200010]of int64; procedure qsort(l,r:longint); var i,j,mid,p:longint; begin i:=l; j:=r; mid:=a[(l+r) div 2]; repeat while a[i]mid do dec(j); if i<=j then begin p:=a[i]; a[i]:=a[j]; a[j]:=p; p:=b[i]; b[i]:=b[j]; b[j]:=p; inc(i); dec(j); end; until i>j; if l2*n then ans:=(ans+(mi[n]-mi[n-shit[i]]+maxn) mod maxn*num[i]) mod maxn; end; writeln(ans); end; end.