#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int MAX = 10000 + 10;
int n, m, v, k;
int f[MAX], dp[MAX];
int val[MAX], vol[MAX];
int save[MAX];
vector<int> s[MAX];
void init() {
  for (int i = 1; i <= n; i++) f[i] = i;
  memset(dp, 0, sizeof(dp));
  memset(save, 0, sizeof(save));
  k = 0;
}
int find(int x) { return x == f[x] ? f[x] : f[x] = find(f[x]); }
int merge(int x, int y) {
  int xt = find(x);
  int yt = find(y);
  if (xt == yt)
    return 1;
  else {
    f[xt] = yt;
    return 0;
  }
}
int main() {
  cin >> n >> m >> v;
  init();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &vol[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &val[i]);
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    merge(x, y);
  }
  for (int i = 1; i <= n; i++) {
    find(i);
    if (f[i] == i) {
      k++;
      save[k] = i;
    }
  }
  for (int i = 1; i <= k; i++) {
    int sum_val = 0;
    int sum_vol = 0;
    int temp = n;
    for (int j = 1; j <= temp; j++) {
      if (f[j] == save[i]) {
        sum_vol += vol[j];
        sum_val += val[j];
        s[i].push_back(j);
      }
    }
    vol[++n] = sum_vol;
    val[n] = sum_val;
    f[n] = save[i];
    s[i].push_back(n);
  }
  for (int i = 1; i <= k; i++) {
    int t = i;
    for (int j = v; j >= 0; j--) {
      for (int ii = 0; ii < s[t].size(); ii++) {
        int l = s[t][ii];
        if (j >= vol[l]) {
          dp[j] = max(dp[j], dp[j - vol[l]] + val[l]);
        }
      }
    }
  }
  cout << dp[v] << endl;
  return 0;
}
