#include <bits/stdc++.h>
using namespace std;
int n, m, w, a[1005], b[1005], f[10005], mem[1005][1005], su[10005], sb[10005],
    dp[1005][1005];
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
void uni(int x, int y) {
  int fx = find(x);
  int fy = find(y);
  if (fx != fy) f[fx] = fy;
}
int main() {
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), f[i] = i;
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 0; i < m; i++) {
    int t1, t2;
    scanf("%d %d", &t1, &t2);
    uni(t1, t2);
  }
  for (int i = 1; i <= n; i++) {
    f[i] = find(i);
    mem[f[i]][++mem[f[i]][0]] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (f[i] != i) continue;
    for (int j = 1; j <= n; j++)
      if (f[j] == i) su[i] += a[j], sb[i] += b[j];
  }
  for (int i = 0, p = 1; p <= n; p++) {
    if (!mem[p][0]) continue;
    i++;
    for (int j = 0; j <= w; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j - su[p] >= 0)
        dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - su[p]] + sb[p]);
      for (int k = 1; k <= mem[p][0]; k++)
        if (j - a[mem[p][k]] >= 0)
          dp[i][j] = max(dp[i][j], dp[i - 1][j - a[mem[p][k]]] + b[mem[p][k]]);
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, dp[i][w]);
  cout << ans;
  return 0;
}
