#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int w[N], b[N], fa[N], totw[N], totb[N], f[N];
vector<int> G[N];
int getf(int x) { return fa[x] == x ? x : fa[x] = getf(fa[x]); }
int main() {
  int n, m, ww;
  scanf("%d%d%d", &n, &m, &ww);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  for (int i = 1; i <= n; ++i) fa[i] = i;
  for (int i = 1; i <= m; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    fa[getf(l)] = getf(r);
  }
  for (int i = 1; i <= n; ++i) {
    G[getf(i)].push_back(i);
    totw[getf(i)] += w[i];
    totb[getf(i)] += b[i];
  }
  for (int i = 1; i <= n; ++i)
    if (fa[i] == i) {
      for (int j = ww; j >= 0; --j) {
        if (j - totw[i] >= 0) f[j] = max(f[j], f[j - totw[i]] + totb[i]);
        for (int k = 0; k < G[i].size(); ++k)
          if (j - w[G[i][k]] >= 0)
            f[j] = max(f[j], f[j - w[G[i][k]]] + b[G[i][k]]);
      }
    }
  printf("%d", f[ww]);
}
