#include <bits/stdc++.h>
using namespace std;
const long long mod = 7;
void rd(int &x) {
  x = 0;
  char s;
  s = getchar();
  int f = 1;
  while (!isdigit(s)) {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (isdigit(s)) {
    x = x * 10 + s - '0';
    s = getchar();
  }
  x *= f;
}
bool isp(long long x) {
  long long tt = sqrt(x * 1.0);
  for (long long i = 2; i <= tt; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
int lowbit(int x) { return x & -x; }
int f[1111], n, m, W, w[1111], b[1111];
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
int dp[1111];
vector<pair<int, int> > vec[1111];
;
int sum_w[1111], sum_b[1111];
signed main() {
  cin >> n >> m >> W;
  for (int i = 1; i <= n; i++) {
    f[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    rd(w[i]);
  }
  for (int i = 1; i <= n; i++) {
    rd(b[i]);
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    rd(x), rd(y);
    int xx = find(x);
    int yy = find(y);
    if (xx == yy)
      continue;
    else {
      f[xx] = yy;
    }
  }
  for (int i = 1; i <= n; i++) {
    int root = find(i);
    vec[root].push_back({w[i], b[i]});
    sum_w[root] += w[i];
    sum_b[root] += b[i];
  }
  for (int i = 1; i <= n; i++) {
    if (!vec[i].size()) continue;
    vec[i].push_back({sum_w[i], sum_b[i]});
  }
  for (int i = 1; i <= n; i++) {
    if (!vec[i].size()) continue;
    for (int j = W; j >= 1; --j) {
      for (int k = 0; k < vec[i].size(); k++) {
        if (j - vec[i][k].first >= 0)
          dp[j] = max(dp[j], dp[j - vec[i][k].first] + vec[i][k].second);
      }
    }
  }
  cout << dp[W] << '\n';
  return 0;
}
