#include <bits/stdc++.h>
using namespace std;
int a[1010], b[1010], dp[1010];
struct ro {
  int w, b;
  vector<int> t;
} c[1010];
int father[1010];
int find(int x) {
  if (father[x] == x) return x;
  return father[x] = find(father[x]);
}
void Union(int x, int y) {
  x = find(x);
  y = find(y);
  if (x > y) father[x] = y;
  if (x < y) father[y] = x;
}
int main() {
  int n, m, w;
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  int x, y;
  for (int i = 1; i <= n; i++) father[i] = i;
  while (m--) {
    scanf("%d%d", &x, &y);
    Union(x, y);
  }
  for (int i = 1; i <= n; i++) c[i].b = 0, c[i].w = 0;
  for (int i = 1; i <= n; i++) {
    x = find(i);
    c[x].b += b[i];
    c[x].w += a[i];
    c[x].t.push_back(i);
  }
  vector<ro> p;
  for (int i = 1; i <= n; i++)
    if (c[i].b != 0) p.push_back(c[i]);
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < p.size(); i++) {
    for (int j = w; j >= 0; j--) {
      if (j - p[i].w >= 0) dp[j] = max(dp[j], dp[j - p[i].w] + p[i].b);
      x = p[i].t.size();
      for (int k = 0; k < x; k++) {
        y = p[i].t[k];
        if (j - a[y] >= 0) dp[j] = max(dp[j], dp[j - a[y]] + b[y]);
      }
    }
  }
  printf("%d\n", dp[w]);
  return 0;
}
