#include <bits/stdc++.h>
const long long MAXN = 1e3 + 5;
using namespace std;
long long dp[MAXN][MAXN];
void dfs(vector<long long> v[], vector<bool> &vis, vector<long long> &vt,
         long long x) {
  vis[x] = true;
  vt.push_back(x);
  for (auto z : v[x])
    if (!vis[z]) dfs(v, vis, vt, z);
}
long long rec(vector<vector<long long>> &adj, long long wt[], long long bt[],
              long long sz, long long w) {
  if (sz == 0 || wt == 0) return 0;
  long long ans = LLONG_MIN, sum_wt = 0, sum_bt = 0;
  auto &ret = dp[sz][w];
  if (~ret) return dp[sz][w];
  for (auto x : adj[sz - 1]) {
    sum_wt += wt[x];
    sum_bt += bt[x];
  }
  for (auto x : adj[sz - 1]) {
    if (wt[x] <= w) ans = max(bt[x] + rec(adj, wt, bt, sz - 1, w - wt[x]), ans);
  }
  if (sum_wt <= w)
    ans = max(sum_bt + rec(adj, wt, bt, sz - 1, w - sum_wt), ans);
  ans = max(rec(adj, wt, bt, sz - 1, w), ans);
  return ret = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, w, l, r, sz;
  cin >> n >> k >> w;
  long long wt[n], bt[n], res;
  vector<long long> v[n + 1];
  vector<vector<long long>> adj;
  vector<long long> vt;
  vector<bool> vis(n + 1, false);
  for (long long i = 1; i <= n; ++i) cin >> wt[i];
  for (long long i = 1; i <= n; ++i) cin >> bt[i];
  memset(dp, -1, sizeof(dp));
  while (k--) {
    cin >> l >> r;
    v[l].push_back(r);
    v[r].push_back(l);
  }
  for (long long i = 1; i <= n; ++i) {
    vt.clear();
    if (!vis[i]) {
      dfs(v, vis, vt, i);
      adj.push_back(vt);
    }
  }
  sz = adj.size();
  res = rec(adj, wt, bt, sz, w);
  cout << res << "\n";
  return 0;
}
