#include <bits/stdc++.h>
using namespace std;
long long dp[200100], tmp[200100];
struct hos {
  int w;
  int b;
  int fa;
  int id;
  bool operator<(const hos &p) const { return fa < p.fa; }
} a[200100];
int t[200100];
inline void ff(int x) {
  int cnt = 0;
  while (a[x].fa != a[x].id) {
    t[cnt++] = x;
    x = a[x].fa;
  }
  for (int i = 0; i < cnt; i++) a[t[i]].fa = x;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, m, W, u, v;
  cin >> n >> m >> W;
  for (int i = 1; i <= n; i++) {
    a[i].id = i;
    a[i].fa = i;
  }
  for (int i = 1; i <= n; i++) cin >> a[i].w;
  for (int i = 1; i <= n; i++) cin >> a[i].b;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    ff(u);
    ff(v);
    a[a[u].fa].fa = a[v].fa;
  }
  for (int i = 1; i <= n; i++) ff(i);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n;) {
    int sw = 0, sb = 0, ti = i;
    while (i <= n && (ti == i || a[i].fa == a[i - 1].fa)) {
      for (int j = a[i].w; j <= W; j++)
        tmp[j] = max(dp[j - a[i].w] + a[i].b, tmp[j]);
      sw += a[i].w;
      sb += a[i].b;
      i++;
    }
    for (int j = sw; j <= W; j++) tmp[j] = max(dp[j - sw] + sb, tmp[j]);
    for (int j = 0; j <= W; j++) dp[j] = tmp[j];
  }
  long long mx = 0;
  for (int i = 0; i <= W; i++) mx = max(mx, dp[i]);
  cout << mx << '\n';
  return 0;
}
