#include <bits/stdc++.h>
using namespace std;
long long wt, i, j, id, vis[100005], dp[1005][1005], w[10005], b[10005], n, m,
    u, uu, mat[1005][1005], ans;
vector<long long> g[1005], v[1005];
long long go(long long i, long long cwt) {
  if (cwt > wt) return -(1e10);
  if (i == id) return 0;
  if (dp[i][cwt] != -1) return dp[i][cwt];
  long long ans = 0;
  long long swt = 0;
  long long bwt = 0;
  ans = max(ans, go(i + 1, cwt));
  for (long long j = 0; j < v[i].size(); j++) {
    swt += w[v[i][j]];
    bwt += b[v[i][j]];
    ans = max(ans, b[v[i][j]] + go(i + 1, cwt + w[v[i][j]]));
  }
  ans = max(ans, bwt + go(i + 1, cwt + swt));
  return dp[i][cwt] = ans;
}
void dfs(long long i) {
  if (vis[i]) return;
  v[id].push_back(i);
  vis[i] = 1;
  for (long long j = 0; j < g[i].size(); j++) {
    dfs(g[i][j]);
  }
}
int main() {
  cin >> n >> m >> wt;
  memset(vis, 0, sizeof vis);
  memset(dp, -1, sizeof dp);
  memset(mat, 0, sizeof mat);
  for (i = 0; i < n; i++) {
    cin >> w[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (i = 0; i < m; i++) {
    cin >> u >> uu;
    u--;
    uu--;
    if (u > uu) swap(u, uu);
    if (!mat[u][uu]) {
      g[u].push_back(uu);
      g[uu].push_back(u);
    }
    mat[u][uu] = 1;
  }
  id = 0;
  for (i = 0; i < n; i++) {
    if (!vis[i]) {
      dfs(i);
      id++;
    }
  }
  ans = go(0, 0);
  cout << ans << endl;
  return 0;
}
