#include <bits/stdc++.h>
using namespace std;
const int nmax = 1011;
vector<int> e[nmax], st;
int n, m, b[nmax], w[nmax], W, nex[nmax], lab[nmax], sumw[nmax], sumb[nmax], cc,
    f[nmax][nmax];
void dfs(int x) {
  if (lab[x]) return;
  st.push_back(x);
  lab[x] = cc;
  for (int y : e[x]) dfs(y);
}
int tinh(int i, int W) {
  if (W < 0) return -1000000000;
  if (i == n) return 0;
  if (f[i][W]) return f[i][W] - 1;
  int res = 0;
  res = max(tinh(i + 1, W),
            max(tinh(nex[i], W - w[st[i]]) + b[st[i]],
                tinh(nex[i], W - sumw[lab[st[i]]]) + sumb[lab[st[i]]]));
  f[i][W] = res + 1;
  return res;
}
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];
  while (m--) {
    int u, v;
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (!lab[i]) {
      cc++;
      dfs(i);
    }
  for (int i = 1; i <= n; i++) {
    sumw[lab[i]] += w[i];
    sumb[lab[i]] += b[i];
  }
  nex[n - 1] = n;
  for (int i = n - 2; i >= 0; i--)
    if (lab[st[i]] == lab[st[i + 1]])
      nex[i] = nex[i + 1];
    else
      nex[i] = i + 1;
  cout << tinh(0, W);
}
