#include <bits/stdc++.h>
using namespace std;
int CLR = 0;
vector<vector<int> > groups;
void dfs(int v, vector<vector<int> > &g, vector<int> &used) {
  used[v] = CLR;
  groups[CLR - 1].push_back(v);
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (!used[to]) dfs(to, g, used);
  }
}
int main() {
  int n, m, W;
  cin >> n >> m >> W;
  vector<int> b(n), w(n);
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  vector<vector<int> > g(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  vector<int> used(n, 0);
  vector<int> total_w;
  vector<int> total_b;
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      groups.push_back({});
      total_b.push_back(0);
      total_w.push_back(0);
      CLR++;
      dfs(i, g, used);
      for (auto j : groups[CLR - 1]) {
        total_w[CLR - 1] += w[j];
        total_b[CLR - 1] += b[j];
      }
    }
  }
  vector<vector<int> > dp(W + 1, vector<int>(CLR, 0));
  for (int i = 0; i <= W; i++) {
    for (int j = 0; j < CLR; j++) {
      if (j != 0) dp[i][j] = dp[i][j - 1];
      if (i - total_w[j] >= 0) {
        if (j > 0)
          dp[i][j] = max(dp[i][j], dp[i - total_w[j]][j - 1] + total_b[j]);
        else
          dp[i][j] = max(dp[i][j], total_b[j]);
      }
      for (auto k : groups[j]) {
        if (i - w[k] >= 0) {
          if (j > 0)
            dp[i][j] = max(dp[i][j], dp[i - w[k]][j - 1] + b[k]);
          else
            dp[i][j] = max(dp[i][j], b[k]);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= W; i++) {
    ans = max(ans, dp[i][CLR - 1]);
  }
  cout << ans;
  return 0;
}
