#include <bits/stdc++.h>
using namespace std;
const int maxn = 1001;
struct Tgraph {
  struct Tedge {
    int son;
    Tedge *pre;
    void add(int s, Tedge *p) { son = s, pre = p; }
  } * now[maxn], edge[2010000];
  int tot;
  void clear() {
    tot = 0;
    memset(now, 0, sizeof(now));
  }
  void add(int x, int y) {
    edge[++tot].add(y, now[x]);
    now[x] = &edge[tot];
    edge[++tot].add(x, now[y]);
    now[y] = &edge[tot];
  }
} G;
int n, m, limit;
int w[maxn], b[maxn];
long long group[maxn][2];
void init() {
  G.clear();
  cin >> n >> m >> limit;
  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 <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    G.add(a, b);
  }
}
bool ok[maxn];
int h[maxn], tot;
int sb[maxn][maxn];
void bfs(int st) {
  int ww = 0, tt = 0;
  h[++ww] = 1;
  ok[st] = 1;
  long long sumw = w[st], sumb = b[st];
  int asd = 0;
  tot++;
  sb[tot][++asd] = st;
  h[1] = st;
  while (tt != ww) {
    tt++;
    for (Tgraph::Tedge *p = G.now[h[tt]]; p; p = p->pre)
      if (!ok[p->son]) {
        ok[p->son] = 1;
        h[++ww] = p->son;
        sumw += w[p->son];
        sumb += b[p->son];
        sb[tot][++asd] = p->son;
      }
  }
  group[tot][0] = sumw, group[tot][1] = sumb;
  sb[tot][0] = asd;
}
long long f[maxn], g[maxn], k[maxn];
void work() {
  for (int i = 1; i <= n; i++)
    if (!ok[i]) bfs(i);
  for (int i = 1; i <= tot; i++)
    for (int j = limit; j; j--) {
      if (j >= group[i][0]) f[j] = max(f[j], f[j - group[i][0]] + group[i][1]);
      for (int k = 1; k <= sb[i][0]; k++) {
        int x = sb[i][k];
        if (j >= w[x]) f[j] = max(f[j], f[j - w[x]] + b[x]);
      }
    }
  long long ans = 0;
  for (int i = 1; i <= limit; i++) ans = max(ans, f[i]);
  cout << ans << endl;
}
int main() {
  init();
  work();
  return 0;
}
