#include <bits/stdc++.h>
using namespace std;
int w[1010], b[1010], fa[1010];
int dp[1010][1010];
bool vis[1010];
int n, m, W;
int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); }
int main() {
  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 <= n; i++) fa[i] = i;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    fa[getfa(y)] = getfa(x);
  }
  vector<int> g[1010];
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    vector<int> tmp;
    int totw = 0, totb = 0;
    for (int j = 1; j <= n; j++)
      if (getfa(j) == i) {
        tmp.push_back(j);
        totw += w[j];
        totb += b[j];
      }
    if (tmp.size() > 0) {
      tmp.push_back(totw);
      tmp.push_back(totb);
      g[cnt++] = tmp;
    }
  }
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= cnt; i++)
    for (int j = 0; j <= W; j++) {
      int totw = g[i - 1][g[i - 1].size() - 2],
          totb = g[i - 1][g[i - 1].size() - 1];
      dp[i][j] = dp[i - 1][j];
      if (j >= totw) dp[i][j] = max(dp[i][j], dp[i - 1][j - totw] + totb);
      for (int k = 0; k < g[i - 1].size() - 2; k++)
        if (j >= w[g[i - 1][k]])
          dp[i][j] =
              max(dp[i][j], dp[i - 1][j - w[g[i - 1][k]]] + b[g[i - 1][k]]);
    }
  cout << dp[cnt][W] << endl;
  return 0;
}
