这就很水了
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long ll;
int n,a[100005];
ll ans;
int main(){
freopen("t.in","r",stdin);
freopen("t.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++)
scanf("%d",a+i);
sort(a+1,a+n+1);
for (int i=1;i<=n;i++)
ans+=(ll)a[i]*a[n-i+1]%10007LL,ans%=10007LL;
printf("%I64d\n",ans);
return 0;
}