#include <bits/stdc++.h>
using namespace std;
vector<int> p[1010];
vector<int> q[1010];
int a[1010], b[1010], vis[1010];
int s[1010], n, m, w;
void dfs(int x, int y) {
  int i, j, k;
  k = p[x].size();
  for (i = 0; i < k; i++) {
    j = p[x][i];
    if (vis[j] == 0) {
      vis[j] = y;
      dfs(j, y);
    }
  }
}
int main() {
  int i, j, k, u, v, x, y;
  scanf("%d%d%d", &n, &m, &w);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    p[x].push_back(y);
    p[y].push_back(x);
  }
  k = 1;
  memset(vis, 0, sizeof(vis));
  for (i = 1; i <= n; i++) {
    if (vis[i]) continue;
    vis[i] = k;
    dfs(i, k);
    k++;
  }
  memset(s, 0, sizeof(s));
  for (i = 1; i <= n; i++) q[vis[i]].push_back(i);
  int t = k;
  for (i = 1; i < t; i++) {
    for (j = 0; j <= w; j++) {
      u = 0;
      v = 0;
      for (k = 0; k < q[i].size(); k++) {
        u = u + a[q[i][k]];
        v = v + b[q[i][k]];
        if (j >= a[q[i][k]])
          s[j - a[q[i][k]]] = max(s[j - a[q[i][k]]], s[j] + b[q[i][k]]);
      }
      if (j >= u) s[j - u] = max(s[j - u], s[j] + v);
    }
  }
  printf("%d\n", s[0]);
  return 0;
}
