#include <bits/stdc++.h>
using namespace std;
long long mod(long long x) {
  return ((x % 1000000007 + 1000000007) % 1000000007);
}
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long mul(long long a, long long b) { return mod(mod(a) * mod(b)); }
vector<long long> v[1001];
map<long long, vector<long long>> m;
map<long long, pair<long long, long long>> ma;
long long w[1001];
long long a[1001], vis[1001];
long long dp[1001][1001];
void dfs(long long src, long long &g, long long &ww, long long &vv) {
  vis[src] = 1;
  ww += w[src];
  vv += a[src];
  m[g].push_back(src);
  for (auto it : v[src]) {
    if (vis[it] == 0) dfs(it, g, ww, vv);
  }
}
long long n, maxw;
long long maxn;
long long rec(long long we, long long g) {
  if (we >= maxw) return 0;
  if (g == maxn) return 0;
  if (dp[g][we] != -1) return dp[g][we];
  long long ans = 0;
  if (ma[g].first + we <= maxw)
    ans = max(ans, rec(we + ma[g].first, g + 1) + ma[g].second);
  ans = max(ans, rec(we, g + 1));
  for (auto it : m[g]) {
    if (w[it] + we <= maxw) ans = max(ans, rec(we + w[it], g + 1) + a[it]);
  }
  return dp[g][we] = ans;
}
void solve() {
  memset(dp, -1, sizeof dp);
  long long m;
  cin >> n >> m >> maxw;
  for (long long i = 1; i < n + 1; i++) cin >> w[i];
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  long long g = 1;
  for (long long i = 1; i < n + 1; i++) {
    if (vis[i] == 0) {
      long long ww = 0, vv = 0;
      dfs(i, g, ww, vv);
      ma[g] = {ww, vv};
      g++;
    }
  }
  maxn = g;
  cout << rec(0, 1);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
