#include <bits/stdc++.h>
using namespace std;
int fa[1010], n, m, W, w[1010], b[1010];
int f[1010], st[1010], w_[1010], b_[1010];
int find(int a) { return (fa[a] == a ? a : (fa[a] = find(fa[a]))); }
int main() {
  scanf("%d %d %d", &n, &m, &W);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]), w_[i] = w[i];
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), b_[i] = b[i];
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (find(x) == find(y)) continue;
    w[fa[y]] += w[fa[x]];
    b[fa[y]] += b[fa[x]];
    fa[fa[x]] = fa[y];
  }
  for (int i = 1; i <= n; i++) find(i);
  for (int i = 1; i <= n; i++) {
    if (fa[i] != i) continue;
    int tp = 0;
    for (int j = 1; j <= n; j++)
      if (fa[j] == i) st[++tp] = j;
    for (int j = W; j >= 0; j--) {
      if (j >= w[i]) f[j] = max(f[j], f[j - w[i]] + b[i]);
      for (int k = 1; k <= tp; k++)
        if (j >= w_[st[k]]) f[j] = max(f[j], f[j - w_[st[k]]] + b_[st[k]]);
    }
  }
  printf("%d", f[W]);
  return 0;
}
