#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, m, W;
int w[N], b[N], dp[N], F[N];
int grow[N], grob[N];
vector<int> v[N];
int Find(int x) { return (x == F[x]) ? x : Find(F[x]); }
void unite(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (x != y) {
    F[y] = x;
  }
}
int main() {
  int x, y;
  memset(w, 0, sizeof(w));
  memset(b, 0, sizeof(b));
  memset(grow, 0, sizeof(grow));
  memset(grob, 0, sizeof(grob));
  memset(dp, 0, sizeof(dp));
  scanf("%d%d%d", &n, &m, &W);
  for (int i = 1; i <= n; i++) {
    F[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    unite(x, y);
  }
  for (int i = 1; i <= n; i++) {
    grow[Find(i)] += w[i];
    grob[Find(i)] += b[i];
    v[Find(i)].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (i != F[i]) continue;
    for (int j = W; j >= 0; j--) {
      for (int k = 0; k < v[Find(i)].size(); k++) {
        int tem = v[Find(i)][k];
        if (j >= w[tem]) {
          dp[j] = max(dp[j], dp[j - w[tem]] + b[tem]);
        }
      }
      if (j >= grow[Find(i)]) {
        dp[j] = max(dp[j], dp[j - grow[i]] + grob[i]);
      }
    }
  }
  printf("%d\n", dp[W]);
  return 0;
}
