#include <bits/stdc++.h>
using namespace std;
int n, m, W;
int w[1100], b[1100], pre[1100], dp[1100];
vector<int> v[1100];
queue<int> q;
int find(int x) { return pre[x] == x ? x : pre[x] = find(pre[x]); }
void join(int x, int y) {
  x = find(x);
  y = find(y);
  if (x != y) pre[y] = x;
}
int main(int argc, char const *argv[]) {
  scanf("%d%d%d", &n, &m, &W);
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= n; i++) pre[i] = i;
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    join(x, y);
  }
  for (i = 1; i <= n; i++) {
    int f = find(i);
    v[f].push_back(i);
    if (f == i) q.push(i);
  }
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (i = W; i >= 0; i--) {
      int sb = 0, sw = 0;
      for (j = 0; j < v[u].size(); j++) {
        sb += b[v[u][j]];
        sw += w[v[u][j]];
        if (i >= w[v[u][j]])
          dp[i] = max(dp[i], dp[i - w[v[u][j]]] + b[v[u][j]]);
      }
      if (i >= sw) dp[i] = max(dp[i], dp[i - sw] + sb);
    }
  }
  printf("%d\n", dp[W]);
  return 0;
}
