#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define endl '\n'
#define pb push_back
#define mp make_pair
typedef pair<int,int> P;
typedef vector<P> vp;
typedef vector<int> vi;
vp e;
struct InputNode{
int u,v;
}xy[2010];
struct Node1{
int u,v;
long long w;
};
int n,tot=0;
int c[2010];
int k[2010];
bool vist[2010];
Node1 I[2010*2010];
long long ans=0;
bool comp(Node1 a,Node1 b){
return a.w<b.w;
}
class fl{
public:
int fa[2010],link[2010];
int InitSet(int len){
for(int i=1;i<=len;i++)fa[i]=link[i]=i;
}
int GetFather(int x){
return fa[x]==x?x:fa[x]=GetFather(fa[x]);
}
int GetLink(int x){
return link[x]==x?x:link[x]=GetLink(link[x]);
}
int SameFather(int x,int y){
return GetFather(x)==GetFather(y);
}
void Union(int x,int y,long long w){
int lx=GetLink(x),ly=GetLink(y);
// fa[lx]=ly;
// ans+=w;
if(c[lx]<c[ly])swap(lx,ly);
if(c[lx]>=w){
ans+=w-c[lx];
link[lx]=ly;
e.pb(mp(x,y));
}
fa[lx]=ly;
}
};
fl S;
long long manhattan(int x1,int y1,int x2,int y2){
return abs(x1-x2)+abs(y1-y2);
}
long long DJ(int i,int j){
return (long long)(k[i]+k[j])*manhattan(xy[i].u,xy[i].v,xy[j].u,xy[j].v);
}
int main(){
cin>>n;
for(int i=1;i<=n;i++)cin>>xy[i].u>>xy[i].v;
for(int i=1;i<=n;i++)cin>>c[i];
for(int i=1;i<=n;i++)cin>>k[i];
S.InitSet(n);
for(int i=1;i<=n;i++){
ans+=(long long)c[i];
for(int j=1;j<=n;j++){
I[++tot].u=i,I[tot].v=j,I[tot].w=DJ(i,j);
}
}
sort(I+1,I+1+tot,comp);
for(int i=1;i<=tot;i++){
if(S.SameFather(I[i].u,I[i].v))continue;
S.Union(I[i].u,I[i].v,I[i].w);
}
cout<<ans<<'\n';
vi Res;
int tl=0;
for(int i=1;i<=n;i++)vist[S.GetLink(i)]=true;
for(int i=1;i<=n;i++){
if(vist[i]){
Res.pb(i);
tl++;
}
}
cout<<tl<<'\n';
for(auto i:Res)cout<<i<<' ';
cout<<'\n'<<n-tl<<'\n';
for(int i=0;i<n-tl;i++)cout<<e[i].f<<' '<<e[i].s<<'\n';
return 0;
}
Input
3
2 3
1 1
3 2
3 2 3
3 2 3
谁也不知道怎么TLE了