#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 4;
const int inf = 0x3f3f3f3f;
int par[maxn], r[maxn];
int n, m, W;
void init(int n) {
  for (int i = 0; i < n; i++) {
    par[i] = i;
    r[i] = 0;
  }
}
int find(int x) {
  if (par[x] == x) return x;
  return par[x] = find(par[x]);
}
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (r[x] < r[y])
    par[x] = y;
  else {
    par[y] = x;
    if (r[x] == r[y]) r[x]++;
  }
}
int pack[1010][1010];
int cnt[1010];
int dp[1010];
int w[maxn], b[maxn];
int main() {
  while (scanf("%d%d%d", &n, &m, &W) != EOF) {
    init(n);
    for (int i = 0; i < n; i++) scanf("%d", w + i);
    for (int i = 0; i < n; i++) scanf("%d", b + i);
    for (int i = 0; i < m; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      unite(x - 1, y - 1);
    }
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; i++) {
      int x = find(i);
      pack[x][cnt[x]++] = i;
    }
    int tmp = n;
    for (int i = 0; i < n; i++) {
      if (cnt[i] == 0) continue;
      int sumb = 0, sumw = 0;
      for (int j = 0; j < cnt[i]; j++) {
        sumb += b[pack[i][j]];
        sumw += w[pack[i][j]];
      }
      b[tmp] = sumb;
      w[tmp] = sumw;
      pack[i][cnt[i]++] = tmp++;
    }
    memset(dp, 0, sizeof dp);
    for (int i = 0; i < n; i++) {
      if (cnt[i] == 0) continue;
      for (int v = W; v >= 0; v--) {
        for (int j = 0; j < cnt[i]; j++) {
          if (v - w[pack[i][j]] >= 0)
            dp[v] = max(dp[v], dp[v - w[pack[i][j]]] + b[pack[i][j]]);
        }
      }
    }
    printf("%d\n", dp[W]);
  }
}
