#include <bits/stdc++.h>
template <typename T>
inline bool chkmin(T &a, T b) {
  return b < a ? a = b, true : false;
}
template <typename T>
inline bool chkmax(T &a, T b) {
  return b > a ? a = b, true : false;
}
template <class T>
inline T read(T &x) {
  int sign = 1;
  char c = getchar_unlocked();
  for (; !isdigit(c); c = getchar_unlocked())
    if (c == '-') sign = -1;
  for (x = 0; isdigit(c); c = getchar_unlocked()) x = x * 10 + c - '0';
  return x *= sign;
}
template <class T>
inline void write(T x) {
  if (x == 0) {
    putchar_unlocked('0');
    return;
  }
  if (x < 0) {
    putchar_unlocked('-');
    x = -x;
  }
  static char s[20];
  int top = 0;
  for (; x; x /= 10) s[++top] = x % 10 + '0';
  while (top) putchar_unlocked(s[top--]);
}
const int maxN = 1e3 + 100;
int n, m, W;
int w[maxN], v[maxN];
int f[maxN][maxN];
int father[maxN];
int sum[maxN], sumw[maxN];
std::vector<int> p[maxN];
int find(int u) { return father[u] == u ? u : father[u] = find(father[u]); }
int main() {
  if (fopen("tmp.in", "r")) {
    freopen("tmp.in", "r", stdin);
    freopen("tmp.out", "w", stdout);
  }
  read(n), read(m), read(W);
  for (int i = 1; i <= n; ++i) read(w[i]);
  for (int i = 1; i <= n; ++i) read(v[i]);
  for (int i = 1; i <= n; ++i) father[i] = i;
  while (m--) {
    int u, v;
    read(u), read(v);
    u = find(u), v = find(v);
    if (u != v) father[u] = v;
  }
  for (int i = 1; i <= n; ++i) {
    p[find(i)].push_back(i);
    sum[find(i)] += v[i];
    sumw[find(i)] += w[i];
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= W; ++j) {
      f[i][j] = f[i - 1][j];
      for (std::vector<int>::iterator it = p[i].begin(); it != p[i].end();
           ++it) {
        if (j >= w[*it]) chkmax(f[i][j], f[i - 1][j - w[*it]] + v[*it]);
        if (j >= sumw[i]) chkmax(f[i][j], f[i - 1][j - sumw[i]] + sum[i]);
      }
      chkmax(ans, f[i][j]);
    }
  }
  write(ans), putchar_unlocked('\n');
  return 0;
}
