#include<iostream>#include<cmath>#include<cstring>#include<cstdio>#include<algorithm>#define db doubleusingnamespacestd;
constint maxn=2005,maxn1=305;
int g[maxn1][maxn1],c[maxn],d[maxn];
int n,m,v,e,i,t,j,k,l,x,y,z;
db p[maxn],f[maxn][maxn][2],xx,yy,ans;
int main(){
freopen("data.in","r",stdin);freopen("classroom.out","w",stdout);
scanf("%d%d%d%d",&n,&m,&v,&e);
for (i=1;i<=n;i++)
scanf("%d",&c[i]);
for (i=1;i<=n;i++)
scanf("%d",&d[i]);
for (i=1;i<=n;i++)
scanf("%lf",&p[i]);
memset(g,127,sizeof(g));l=g[1][1];
for (i=1;i<=v;i++)
g[i][i]=0,g[0][i]=0;
for (i=1;i<=e;i++)
scanf("%d%d%d",&x,&y,&z),g[x][y]=g[y][x]=min(g[x][y],z);
for (k=1;k<=v;k++)
for (i=1;i<=v;i++)
if (i!=k && g[i][k]!=l)
for (j=1;j<=v;j++)
if (k!=j && i!=j && g[k][j]!=l && g[i][k]+g[k][j]<g[i][j])g[i][j]=g[i][k]+g[k][j];
for (i=0;i<=n;i++)
for (j=0;j<=m;j++)
f[i][j][0]=f[i][j][1]=10000000;
f[0][0][0]=0;
for (i=1;i<=n;i++){
for (j=1;j<=m;j++){
if (j>i) break;
f[i][j][0]=min(f[i-1][j][0]+g[c[i-1]][c[i]],f[i-1][j][1]+g[d[i-1]][c[i]]*p[i-1]+g[c[i-1]][c[i]]*(1-p[i-1]));
xx=f[i-1][j-1][0]+g[c[i-1]][d[i]]*p[i]+g[c[i-1]][c[i]]*(1-p[i]);
yy=f[i-1][j-1][1]+(g[d[i-1]][d[i]]*p[i-1]+g[c[i-1]][d[i]]*(1-p[i-1]))*p[i]+(g[d[i-1]][c[i]]*p[i-1]+g[c[i-1]][c[i]]*(1-p[i-1]))*(1-p[i]);
f[i][j][1]=min(xx,yy);
}
f[i][0][0]=f[i-1][0][0]+g[c[i-1]][c[i]];
}
ans=1e7;
for(j=0;j<=m;j++)
ans=min(ans,min(f[n][j][0],f[n][j][1]));
printf("%.2lf\n",ans);
return0;
}