#include <bits/stdc++.h>
using namespace std;
int n, m, w;
int W[1010];
long long B[1010];
int p[1010];
int S[1010];
long long TB[1010];
int find(int x) {
  if (p[x] == x) return x;
  return p[x] = find(p[x]);
}
void join(int x, int y) {
  int xroot = find(x), yroot = find(y);
  if (xroot == yroot) return;
  S[yroot] += S[xroot];
  TB[yroot] += TB[xroot];
  p[xroot] = yroot;
}
vector<int> G[1010];
bool v[1010];
int ids[1010];
bool mark[1010][1010];
long long memo[1010][1010];
int groups;
int num[1010];
long long dp(int gi, int wi) {
  if (gi == groups) return 0;
  long long& best = memo[gi][wi];
  if (mark[gi][wi]) return best;
  mark[gi][wi] = true;
  best = 0;
  if (S[ids[gi]] + wi <= w) best = dp(gi + 1, S[ids[gi]] + wi) + TB[ids[gi]];
  for (int i = 0; i < (int)G[gi].size(); i++) {
    if (W[G[gi][i]] + wi <= w)
      best = max(best, dp(gi + 1, W[G[gi][i]] + wi) + B[G[gi][i]]);
  }
  best = max(best, dp(gi + 1, wi));
  return best;
}
int main() {
  scanf("%d %d %d", &n, &m, &w);
  for (int i = 1; i <= n; i++) scanf("%d", &W[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &B[i]);
  for (int x = 1; x <= n; x++) {
    p[x] = x;
    S[x] = W[x];
    TB[x] = B[x];
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    join(x, y);
  }
  groups = 0;
  for (int i = 1; i <= n; i++) {
    int root = find(i);
    if (v[root]) continue;
    v[root] = true;
    ids[groups] = root;
    num[root] = groups++;
  }
  for (int i = 1; i <= n; i++) {
    G[num[find(i)]].push_back(i);
  }
  cout << dp(0, 0);
  return 0;
}
