#include <bits/stdc++.h>
using namespace std;
int v[1005], w[1005], f[1005];
int d[1005][1005];
struct node {
  int w;
  int v;
};
vector<node> ve[1005];
int FD(int x) {
  if (f[x] == -1) {
    return x;
  } else {
    return f[x] = FD(f[x]);
  }
}
void LJ(int x, int y) {
  x = FD(x), y = FD(y);
  if (x != y) {
    f[x] = y;
  }
}
int main() {
  memset(f, -1, sizeof(f));
  int n, m, s, a, b;
  scanf("%d%d%d", &n, &m, &s);
  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", &a, &b);
    LJ(a, b);
  }
  for (int i = 1; i <= n; i++) {
    ve[FD(i)].push_back(node{w[i], v[i]});
  }
  for (int i = 1; i <= n; i++) {
    int sw = 0, sv = 0;
    for (int j = 0; j < ve[i].size(); j++) {
      sw += ve[i][j].w;
      sv += ve[i][j].v;
    }
    ve[i].push_back(node{sw, sv});
  }
  for (int i = 1; i <= n; i++) {
    for (int j = s; j >= 0; j--) {
      for (int k = 0; k < ve[i].size(); k++) {
        d[i][j] = max(d[i][j], d[i - 1][j]);
        if (j >= ve[i][k].w) {
          d[i][j] = max(d[i][j], d[i - 1][j - ve[i][k].w] + ve[i][k].v);
        }
      }
    }
  }
  printf("%d\n", d[n][s]);
  return 0;
}
