#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void add_edge2(Graph &g, int s, int d, Weight w){
  g[s].push_back(Edge(s,d,w));
  g[d].push_back(Edge(d,s,0));
}

#define RESIDUE(s,t) (capacity[s][t]-flow[s][t])
Weight augment(const Graph &g, const Matrix &capacity, Matrix &flow,
    const vector<int> &level, vector<bool> &finished, int u, int t, Weight cur) {
  if (u == t || cur == 0) return cur;
  if (finished[u]) return 0;
  finished[u] = true;
  FOR(e, g[u]) if (level[e->dst] > level[u]) {
    Weight f = augment(g, capacity, flow, level, finished,
        e->dst, t, min(cur, RESIDUE(u, e->dst)));
    if (f > 0) {
      flow[u][e->dst] += f; flow[e->dst][u] -= f;
      finished[u] = false;
      return f;
    }
  }
  return 0;
}
Weight maximumFlow(const Graph &g, int s, int t) {
  int n = g.size();
  Matrix flow(n, Array(n)), capacity(n, Array(n)); // adj. matrix
  REP(u,n) FOR(e,g[u]) capacity[e->src][e->dst] += e->weight;

  Weight total = 0;
  for (bool cont = true; cont; ) {
    cont = false;
    vector<int> level(n, -1); level[s] = 0; // make layered network
    queue<int> Q; Q.push(s);
    for (int d = n; !Q.empty() && level[Q.front()] < d; ) {
      int u = Q.front(); Q.pop();
      if (u == t) d = level[u];
      FOR(e, g[u]) if (RESIDUE(u,e->dst) > 0 && level[e->dst] == -1)
        Q.push(e->dst), level[e->dst] = level[u] + 1;
    }
    vector<bool> finished(n); // make blocking flows
    for (Weight f = 1; f > 0; ) {
      f = augment(g, capacity, flow, level, finished, s, t, INF);
      if (f == 0) break;
      total += f; cont = true;
    }
  }
  return total;
}

int adj[100][100];
int P[100], K[100];
int n,m,l;

int IN(int i) { return i; }
int OUT(int i) { return n+i; }
int SRC() { return n*2; }
int SINK() {return n*2+1; }
int main() {
  while(cin>>n>>m>>l) {
    REP(i,n)REP(j,n)adj[i][j] = INF;
    REP(i,n)adj[i][i]=0;
    REP(i, m) {
      int a,b,c;cin>>a>>b>>c;
      a--;b--;
      adj[a][b] = adj[b][a] = c;
    }
    REP(i, n) cin >> P[i];
    REP(i, n) cin >> K[i];
    REP(k,n)REP(i,n)REP(j,n)
      adj[i][j] = min(adj[i][j], adj[i][k]+adj[k][j]);
    Graph g(n+n+2);
    REP(i,n) {
      add_edge2(g, SRC(), IN(i), P[i]);
      add_edge2(g, OUT(i), SINK(), K[i]);
    }
    REP(i,n) {
      REP(j,n) {
        if (adj[i][j] < l) {
          add_edge2(g, IN(i), OUT(j), INF);
        }
      }
    }
    cout << maximumFlow(g, SRC(), SINK()) << endl;
  }
}

Measured memory_bytes: 1580