#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30, maxn = 1000 + 100, maxm = 100000 + 1000;
int n, m, V, x, y, tot = 0, cnt = 0, tmp = 0, w[maxn], v[maxn], head[maxn],
                   tw[maxn], tv[maxn], q[maxn], f[maxn * 2][maxn];
struct Edge {
  int last, to;
} e[maxm * 2], E[maxm];
bool used[maxn];
void build(int from, int to) {
  e[++tot].last = head[from];
  e[tot].to = to;
  head[from] = tot;
}
void Build(int from, int to) {
  E[++cnt].last = q[from];
  E[cnt].to = to;
  q[from] = cnt;
}
void dfs(int u) {
  used[u] = true;
  Build(tmp, u);
  tw[tmp] += w[u], tv[tmp] += v[u];
  for (int i = head[u]; i; i = e[i].last)
    if (!used[e[i].to]) dfs(e[i].to);
}
void Init() {
  scanf("%d%d%d", &n, &m, &V);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    build(x, y), build(y, x);
  }
}
void Solve() {
  for (int i = 1; i <= n; ++i)
    if (!used[i]) {
      tmp++;
      dfs(i);
    }
  int sum = 0;
  for (int i = 1; i <= tmp; ++i) {
    int num = 0;
    for (int j = q[i]; j; j = E[j].last) {
      int u = E[j].to;
      num++;
      for (int k = 0; k <= V; ++k) {
        f[sum + num][k] = max(f[sum + num][k], f[sum + num - 1][k]);
        if (k >= w[u])
          f[sum + num][k] = max(f[sum + num][k], f[sum][k - w[u]] + v[u]);
      }
    }
    num++;
    for (int j = 0; j <= V; ++j) {
      f[sum + num][j] = max(f[sum + num][j], f[sum + num - 1][j]);
      if (j >= tw[i])
        f[sum + num][j] = max(f[sum + num][j], f[sum][j - tw[i]] + tv[i]);
    }
    sum += num;
  }
  int ans = 0;
  for (int j = 0; j <= V; ++j) ans = max(ans, f[sum][j]);
  printf("%d\n", ans);
}
int main() {
  Init();
  Solve();
  return 0;
}
