#include <bits/stdc++.h>
using namespace std;
int n, m, W, N, w[1234], b[1234], memo[1234][1234];
vector<vector<int> > G(123456), grp(123456);
vector<bool> visit(123456, false);
void dfs(int u, int root) {
  visit[u] = true;
  grp[root].push_back(u);
  for (int j = 0; j < G[u].size(); j++) {
    int v = G[u][j];
    if (!visit[v]) dfs(v, root);
  }
}
int solve(int i, int wt) {
  if (wt > W) return -1e9;
  if (i == N + 1) return 0;
  int &ret = memo[i][wt];
  if (ret != -1) return ret;
  ret = -1e9;
  int s1 = 0, s2 = 0;
  ret = solve(i + 1, wt);
  for (int j = 0; j < grp[i].size(); j++) {
    int v = grp[i][j];
    s1 += w[v];
    s2 += b[v];
    ret = max(ret, solve(i + 1, wt + w[v]) + b[v]);
  }
  ret = max(ret, solve(i + 1, wt + s1) + s2);
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> W;
  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 <= m; i++) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (!visit[i]) {
      N++;
      dfs(i, N);
    }
  memset(memo, -1, sizeof memo);
  cout << solve(1, 0);
  return 0;
}
