#include <bits/stdc++.h>
using namespace std;
bool vis[1005][1005];
int dp[1005][1005], w[1005], b[1005], ow[1005], ob[1005], gc, par[1005],
    gl[1005];
vector<int> gm[1005];
int solve(int i, int rem) {
  if (i == gc) {
    return 0;
  }
  if (vis[i][rem]) {
    return dp[i][rem];
  }
  vis[i][rem] = true;
  int x = gl[i], ans = solve(i + 1, rem);
  if (rem >= w[x]) {
    ans = max(ans, b[x] + solve(i + 1, rem - w[x]));
  }
  int y;
  for (int j = 0; j < gm[x].size(); j++) {
    y = gm[x][j];
    if (rem >= ow[y]) {
      ans = max(ans, ob[y] + solve(i + 1, rem - ow[y]));
    }
  }
  return dp[i][rem] = ans;
}
int fp(int x) {
  if (par[x] == x) {
    return x;
  }
  return par[x] = fp(par[x]);
}
void join(int x, int y) {
  x = fp(x);
  y = fp(y);
  if (x == y) {
    return;
  }
  w[x] += w[y];
  b[x] += b[y];
  par[y] = x;
}
int main() {
  int n, m, mw;
  cin >> n >> m >> mw;
  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++) {
    ow[i] = w[i], ob[i] = b[i];
  }
  for (int i = 1; i <= n; i++) {
    par[i] = i;
  }
  int x, y;
  while (m--) {
    cin >> x >> y;
    join(x, y);
  }
  set<int> g;
  for (int i = 1; i <= n; i++) {
    gm[fp(i)].push_back(i);
    g.insert(fp(i));
  }
  gc = g.size();
  int in = 0;
  for (set<int>::iterator it = g.begin(); it != g.end(); it++) {
    gl[in++] = *it;
  }
  cout << solve(0, mw) << endl;
}
