#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
inline int safe_mul(int x, int y) __attribute__((warn_unused_result));
int const maxn = 1006;
array<vector<int>, maxn> gr;
array<int, maxn> b, w, d, dprev, used;
vector<int> vert;
void dfs(int v, int num) {
  used[v] = num;
  vert.push_back(v);
  for (int ne : gr[v])
    if (!used[ne]) dfs(ne, num);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, allW;
  cin >> n >> m >> allW;
  for (int i = 0; i < n; ++i) cin >> w[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  for (int i = 0; i < n; ++i)
    if (!used[i]) dfs(i, i + 1);
  int sumw = 0;
  int sumb = 0;
  int last = 0;
  for (int v : vert) {
    if (used[v] != last) {
      for (int x = allW - sumw; x >= 0; --x)
        d[x + sumw] = max(dprev[x] + sumb, d[x + sumw]);
      dprev = d;
      sumw = sumb = 0;
    }
    last = used[v];
    for (int x = allW - w[v]; x >= 0; --x)
      d[x + w[v]] = max(dprev[x] + b[v], d[x + w[v]]);
    sumw += w[v];
    sumb += b[v];
  }
  for (int x = allW - sumw; x >= 0; --x)
    d[x + sumw] = max(dprev[x] + sumb, d[x + sumw]);
  cout << *max_element(d.begin(), d.end()) << endl;
}
