#include <bits/stdc++.h>
using namespace std;
long long n, m, w;
long long x, y;
const long long N = 1009;
long long a[N], b[N], we[N], dp[N][N], sz[N], pa[N];
const long long inf = 1e17;
vector<long long> v[N + 1];
long long d(int ind, int now) {
  if (now > w) return -inf;
  if (ind == n + 1 && now <= w) return 0;
  if (ind == n + 1) return -inf;
  if (dp[ind][now] != -1) return dp[ind][now];
  dp[ind][now] = d(ind + 1, now);
  if (v[ind].size() == 0) return dp[ind][now];
  long long u = dp[ind][now], re = 0, r = 0;
  for (auto it : v[ind]) {
    re += we[it];
    r += b[it];
    u = max(u, d(ind + 1, now + we[it]) + b[it]);
  }
  return dp[ind][now] = max(u, d(ind + 1, now + re) + r);
}
long long get(long long x) {
  if (pa[x] == x) return x;
  return get(pa[x]);
}
void merge(long long x, long long y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  if (sz[y] > sz[x]) swap(x, y);
  sz[x] += sz[y];
  pa[y] = x;
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  memset(dp, -1, sizeof dp);
  cin >> n >> m >> w;
  for (long long i = 1; i <= n; i++) {
    cin >> we[i];
  }
  for (long long i = 1; i < n + 1; i++) {
    sz[i] = 1;
    pa[i] = i;
  }
  for (long long i = 1; i <= n; i++) cin >> b[i];
  for (long long i = 1; i <= m; i++) {
    cin >> x >> y;
    merge(x, y);
  }
  for (long long i = 1; i < n + 1; i++) {
    v[get(i)].push_back(i);
  }
  cout << d(1, 0);
}
