#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1001;
int n, m, mw;
vector<int> g[MAXN];
int w[MAXN], b[MAXN];
int comp[MAXN];
int compw[MAXN], compb[MAXN], ncomps = 0;
long long ans[MAXN][MAXN + 5];
vector<int> compv[MAXN];
void dfs(int v, int nc) {
  comp[v] = nc;
  compw[nc] += w[v];
  compb[nc] += b[v];
  compv[nc].push_back(v);
  for (auto to : g[v]) {
    if (comp[to] < 0) {
      dfs(to, nc);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> mw;
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    comp[i] = -1;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < m; i++) {
    int fr, to;
    cin >> fr >> to;
    --fr, --to;
    g[fr].push_back(to);
    g[to].push_back(fr);
  }
  for (int i = 0; i < n; i++) {
    if (comp[i] < 0) {
      dfs(i, ncomps);
      ncomps++;
    }
  }
  for (int cw = 1; cw <= mw; cw++) {
    for (int i = 0; i < ncomps; i++) {
      if (i) ans[i][cw] = ans[i - 1][cw];
      if (cw - compw[i] >= 0) {
        long long prev = i > 0 ? ans[i - 1][cw - compw[i]] : 0;
        ans[i][cw] = max(ans[i][cw], prev + compb[i]);
      }
      for (auto cg : compv[i]) {
        if (cw - w[cg] >= 0) {
          long long prev = i > 0 ? ans[i - 1][cw - w[cg]] : 0;
          ans[i][cw] = max(ans[i][cw], prev + b[cg]);
        }
      }
    }
  }
  long long best = 0;
  for (int i = 0; i < n; i++) {
    best = max(best, ans[i][mw]);
  }
  cout << best;
}
