#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000;
vector<vector<int> > g;
vector<vector<int> > comp;
vector<int> wt, bt, sumw, sumb;
bool used[MAXN];
void dfs(int v) {
  used[v] = 1;
  sumw.back() += wt[v];
  sumb.back() += bt[v];
  comp.back().push_back(v);
  for (int u : g[v])
    if (!used[u]) dfs(u);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, w;
  cin >> n >> m >> w;
  g.resize(n);
  wt.resize(n);
  bt.resize(n);
  for (int i = 0; i < n; ++i) cin >> wt[i];
  for (int i = 0; i < n; ++i) cin >> bt[i];
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    if (!used[i]) {
      comp.resize(comp.size() + 1);
      sumb.push_back(0);
      sumw.push_back(0);
      dfs(i);
    }
  }
  int am = comp.size();
  int dp[am + 1][w + 1];
  for (int i = 0; i <= w; ++i)
    for (int j = 0; j <= am; ++j) dp[j][i] = 0;
  for (int i = 1; i <= am; ++i) {
    for (int j = 0; j <= w; ++j) {
      dp[i][j] = dp[i - 1][j];
      for (int k : comp[i - 1]) {
        if (wt[k] <= j) dp[i][j] = max(dp[i][j], dp[i - 1][j - wt[k]] + bt[k]);
      }
      if (j >= sumw[i - 1])
        dp[i][j] = max(dp[i][j], dp[i - 1][j - sumw[i - 1]] + sumb[i - 1]);
    }
  }
  int ans = 0;
  for (int i = 0; i <= w; ++i) ans = max(ans, dp[am][i]);
  cout << ans << endl;
}
