#include <bits/stdc++.h>
using namespace std;
int M = 1e9 + 7;
int vis[1002] = {0}, cnt = 0, dp[1002][1002];
vector<int> v[1002], ad[1002];
void dfs(int node) {
  vis[node] = 1;
  ad[cnt].push_back(node);
  for (auto it : v[node]) {
    if (vis[it] == 0) dfs(it);
  }
}
void solve() {
  int n, m, w;
  cin >> n >> m >> w;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x - 1].push_back(y - 1);
    v[y - 1].push_back(x - 1);
  }
  for (int i = 0; i < n; i++) {
    if (vis[i] == 0) {
      cnt++;
      dfs(i);
    }
  }
  for (int i = 1; i <= cnt; i++) {
    int x = 0, y = 0;
    for (auto k : ad[i]) {
      x += a[k];
      y += b[k];
    }
    for (int j = 0; j <= w; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j >= x) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j - x] + y);
      }
      for (auto it : ad[i]) {
        if (j >= a[it]) dp[i][j] = max(dp[i][j], dp[i - 1][j - a[it]] + b[it]);
      }
    }
  }
  int ans = dp[cnt][w];
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
