#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
using namespace std;


using Weight = int;
using Capacity = int;
struct Edge {
	int src, dst; Weight weight; Capacity cap;
	Edge(int s, int d, Weight w, Capacity c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

struct Dinic {
	int n, s, t;
	vector<int> level, prog, que;
	vector<vector<Capacity>> cap, flow;
	vector<vector<int>> g;
	Capacity inf;
	Dinic(const Graph &graph)
		: n(graph.size()),
		cap(n, vector<Capacity>(n)), flow(n, vector<Capacity>(n)),
		g(n, vector<int>()), inf(numeric_limits<Capacity>::max() / 8) {
		for(int i = 0; i < n; i++) {
			for(auto &e : graph[i]) {
				int u = e.src, v = e.dst;
				Capacity c = e.cap;
				cap[u][v] += c; cap[v][u] += c; flow[v][u] += c;
				g[u].push_back(v); g[v].push_back(u);
			}
		}
	}
	inline Capacity residue(int u, int v) { return cap[u][v] - flow[u][v]; }
	Capacity solve(int s_, int t_) {
		this->t = t_, this->s = s_;
		que.resize(n + 1);
		Capacity res = 0;
		while(levelize()) { prog.assign(n, 0); res += augment(s, inf); }
		return res;
	}
	bool levelize() {
		int l = 0, r = 0;
		level.assign(n, -1); level[s] = 0; que[r++] = s;
		while(l != r) {
			int v = que[l++]; if(v == t) break;
			for(const int &d : g[v]) if(level[d] == -1 && residue(v, d) != 0) {
				level[d] = level[v] + 1; que[r++] = d;
			}
		}
		return level[t] != -1;
	}
	Capacity augment(int v, Capacity lim) {
		Capacity res = 0;
		if(v == t) return lim;
		for(int &i = prog[v]; i < (int)g[v].size(); i++) {
			const int &d = g[v][i];
			if(residue(v, d) == 0 || level[v] >= level[d]) continue;
			const Capacity aug = augment(d, min(lim, residue(v, d)));
			flow[v][d] += aug; flow[d][v] -= aug;
			res += aug; lim -= aug;
			if(lim == 0) break;
		}
		return res;
	}
};


const int INF = 1 << 25;
int wf[100][100];
int A[10000];
int B[10000];
int D[10000];
int P[100];
int K[100];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M, L;
	while(cin >> N >> M >> L) {
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
				wf[i][j] = i == j ? 0 : INF;

		for(int i = 0; i < M; i++) {
			cin >> A[i] >> B[i] >> D[i];
			A[i]--, B[i]--;
			wf[A[i]][B[i]] = wf[B[i]][A[i]] = D[i];
		}
		for(int i = 0; i < N; i++) {
			cin >> P[i];
		}
		for(int i = 0; i < N; i++) {
			cin >> K[i];
		}

		for(int k = 0; k < N; k++)
			for(int i = 0; i < N; i++)
				for(int j = 0; j < N; j++)
					wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);

		Graph G(N + N + 2);
		int S = N + N, T = N + N + 1;
		for(int i = 0; i < N; i++) {
			G[i].push_back(Edge(S, i, 0, P[i]));
			G[N + i].push_back(Edge(N + i, T, 0, K[i]));
			for(int j = 0; j < N; j++) {
				if(wf[i][j] < L) {
					G[i].push_back(Edge(i, N + j, 0, P[i]));
				}
			}
		}

		Dinic dinic(G);
		cout << dinic.solve(S, T) << endl;
	}
}