#include <bits/stdc++.h>
using namespace std;
long long int n, m, w, wa[1003], ba[1003], fa[1003], t, p, x, y, D[1003],
    T[1003], dp[1005][10005];
long long int dsu(long long int atr) {
  if (atr == fa[atr])
    return atr;
  else
    return fa[atr] = dsu(fa[atr]);
}
vector<long long int> v[1003];
long long int dfs(long long int ttt, long long int weight) {
  long long int rec = INT_MIN;
  if (weight > w) {
    return -9210000000000000000;
  }
  if (dp[ttt][weight] != -1) {
    return dp[ttt][weight];
  }
  if (ttt == n + 1) {
    if (weight <= w)
      return 0;
    else
      return -9210000000000000000;
  }
  rec = max(rec, dfs(ttt + 1, weight));
  rec = max(rec, dfs(ttt + 1, weight + T[ttt]) + D[ttt]);
  for (int qwerty = 0; qwerty < (int)v[ttt].size(); qwerty++) {
    rec = max(rec,
              dfs(ttt + 1, weight + wa[v[ttt][qwerty]]) + ba[v[ttt][qwerty]]);
  }
  return dp[ttt][weight] = rec;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%lld %lld %lld", &n, &m, &w);
  for (int i = 1; i <= n; i++) {
    fa[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &wa[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &ba[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%lld %lld", &x, &y);
    t = dsu(x);
    p = dsu(y);
    fa[max(t, p)] = min(t, p);
  }
  for (int i = 1; i <= n; i++) {
    fa[i] = dsu(i);
  }
  for (int i = 1; i <= n; i++) {
    T[fa[i]] += wa[i];
    D[fa[i]] += ba[i];
    v[fa[i]].push_back(i);
  }
  printf("%lld", dfs(1, 0));
  return 0;
}
