#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
int dp[N];
int w[N], b[N];
int father[N];
vector<int> q[1005];
void init(int n) {
  for (int i = 1; i <= n; i++) {
    father[i] = i;
  }
}
int findfa(int x) { return father[x] == x ? x : father[x] = findfa(father[x]); }
void unite(int x, int y) {
  x = findfa(x);
  y = findfa(y);
  if (x != y) father[x] = y;
}
int main() {
  int n, m, mw;
  scanf("%d %d %d", &n, &m, &mw);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  init(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    unite(x, y);
  }
  for (int i = 1; i <= n; i++) q[findfa(i)].push_back(i);
  for (int i = 1; i <= n; i++) {
    if (father[i] != i) continue;
    for (int j = mw; j >= 0; j--) {
      int sw = 0, sb = 0;
      for (int k = 0; k < q[i].size(); k++) {
        sw += w[q[i][k]];
        sb += b[q[i][k]];
        if (j >= w[q[i][k]])
          dp[j] = max(dp[j], dp[j - w[q[i][k]]] + b[q[i][k]]);
      }
      if (j >= sw) dp[j] = max(dp[j], dp[j - sw] + sb);
    }
  }
  printf("%d\n", dp[mw]);
  return 0;
}
