#include <bits/stdc++.h>
using namespace std;
const long long int N = 2e3 + 10;
long long int n, ma, we, w[N], b[N], x, y, m[N], n2, dp[N], par[N];
vector<long long int> v0, v[N], g[N];
pair<long long int, long long int> p;
pair<long long int, long long int> dfs(long long int s) {
  pair<long long int, long long int> o, r;
  m[s] = 1;
  g[par[s]].push_back(s);
  for (auto y : v[s]) {
    if (!m[y]) {
      par[y] = par[s];
      r = dfs(y);
      o.first += r.first;
      o.second += r.second;
    }
  }
  o.first += w[s];
  o.second += b[s];
  return o;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> ma >> we;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= ma; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  n2 = n;
  for (int i = 1; i <= n; i++) {
    if (!m[i]) {
      par[i] = i;
      v0.push_back(i);
      p = dfs(i);
      n2++;
      w[n2] = p.first;
      b[n2] = p.second;
      g[i].push_back(n2);
    }
  }
  dp[0] = 0;
  for (auto i : v0) {
    for (int o = we; o >= 1; o--)
      for (auto j : g[i])
        if (w[j] <= o) dp[o] = max(dp[o], dp[o - w[j]] + b[j]);
  }
  cout << *max_element(dp, dp + N);
}
