#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int to, next;
} e[1000050];
struct Type {
  int w, b;
} h[1000050];
int n, m, w, ans, tot, now, first[1050], up[1050], arr[1050], f[1050][1050];
int Up(int x) {
  if (up[x] != x) up[x] = Up(up[x]);
  return up[x];
}
void Add(int x, int y) {
  e[++now].to = y;
  e[now].next = first[x];
  first[x] = now;
}
int main() {
  int i, j, x, y, sw, sb, pt, next;
  scanf("%d%d%d", &n, &m, &w);
  for (i = 1; i <= n; i++) scanf("%d", &h[i].w);
  for (i = 1; i <= n; i++) scanf("%d", &h[i].b);
  for (i = 1; i <= n; i++) up[i] = i;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    up[Up(x)] = Up(y);
  }
  for (i = 1; i <= n; i++) Add(Up(i), i);
  for (i = 1; i <= n; i++)
    if (first[i]) arr[++tot] = i;
  memset(f, 128, sizeof(f));
  f[0][0] = 0;
  for (i = 0; i < tot; i++)
    for (j = 0; j <= w; j++)
      if (f[i][j] >= 0) {
        sw = sb = 0;
        for (pt = first[arr[i + 1]]; pt; pt = e[pt].next) {
          next = e[pt].to;
          sw += h[next].w;
          sb += h[next].b;
          if (j + h[next].w <= w)
            f[i + 1][j + h[next].w] =
                max(f[i + 1][j + h[next].w], f[i][j] + h[next].b);
        }
        if (j + sw <= w) f[i + 1][j + sw] = max(f[i + 1][j + sw], f[i][j] + sb);
        f[i + 1][j] = max(f[i + 1][j], f[i][j]);
      }
  for (i = 0; i <= w; i++) ans = max(ans, f[tot][i]);
  printf("%d\n", ans);
  return 0;
}
