#include <bits/stdc++.h>
using namespace std;
int dp[1005][1005], n, m, W;
int val[1005], w[1005];
int fa[1005];
int get_fa(int x) {
  if (x == fa[x]) return x;
  return fa[x] = get_fa(fa[x]);
}
void Union(int x, int y) {
  x = get_fa(x), y = get_fa(y);
  if (x == y) return;
  fa[x] = fa[y] = min(x, y);
}
void init() {
  cin >> n >> m >> W;
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  while (m--) {
    int x, y;
    scanf("%d %d", &x, &y);
    Union(x, y);
  }
  for (int i = 1; i <= n; i++) get_fa(i);
}
void DP(int i, int _w, int _v) {
  for (int sum = 1000; sum >= _w; sum--) {
    dp[i][sum] = max(dp[i][sum], dp[i - 1][sum - _w] + _v);
  }
}
int main() {
  init();
  memset(dp, 0, sizeof(dp));
  for (int f = 1; f <= n; f++) {
    int sumw = 0, sumv = 0;
    for (int i = 1; i <= n; i++)
      if (fa[i] == f) {
        sumw += w[i], sumv += val[i];
        DP(f, w[i], val[i]);
      }
    DP(f, 0, 0);
    DP(f, sumw, sumv);
  }
  int MAX = 0;
  for (int i = 0; i <= W; i++) MAX = max(MAX, dp[n][i]);
  cout << MAX << endl;
  return 0;
}
