#include <bits/stdc++.h>
using namespace std;
int N, M, W, t1, t2, Id = 1;
int b[1005], w[1005], visit[1005], dp[1005][1005];
vector<int> g[1005], v[1005];
void dfs(int id, int p) {
  v[id].push_back(p);
  for (int i = 0; i < g[p].size(); i++) {
    int child = g[p][i];
    if (!visit[child]) {
      visit[child] = 1;
      dfs(id, child);
    }
  }
}
int solve(int id, int rw) {
  if (id == Id) return 0;
  int ans = solve(id + 1, rw);
  int wt = 0, bt = 0;
  for (int i = 0; i < v[id].size(); i++) {
    if (rw >= w[v[id][i]])
      ans = max(ans, b[v[id][i]] + solve(id + 1, rw - w[v[id][i]]));
    wt += w[v[id][i]];
    bt += b[v[id][i]];
  }
  if (rw >= wt) ans = max(ans, bt + solve(id + 1, rw - wt));
  return ans;
}
void sol() {
  int bt, wt;
  for (int i = 1; i < Id; i++) {
    for (int j = 1; j <= W; j++) {
      dp[i][j] = dp[i - 1][j];
      bt = 0, wt = 0;
      for (int k = 0; k < v[i].size(); k++) {
        int child = v[i][k];
        if (j >= w[child])
          dp[i][j] = max(dp[i][j], dp[i - 1][j - w[child]] + b[child]);
        bt += b[child];
        wt += w[child];
      }
      if (j >= wt) dp[i][j] = max(dp[i][j], bt + dp[i - 1][j - wt]);
    }
  }
  cout << dp[Id - 1][W] << endl;
}
int main() {
  scanf("%d%d%d", &N, &M, &W);
  for (int i = 1; i <= N; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= N; i++) scanf("%d", &b[i]);
  for (int i = 0; i < M; i++) {
    scanf("%d%d", &t1, &t2);
    g[t1].push_back(t2);
    g[t2].push_back(t1);
  }
  for (int i = 0; i < 1005; i++) visit[i] = 0;
  for (int i = 0; i < N; i++) {
    if (!visit[i + 1]) {
      visit[i + 1] = 1;
      dfs(Id++, i + 1);
    }
  }
  sol();
  return 0;
}
