#include <bits/stdc++.h>
using namespace std;
int pre[1000010];
int find(int x) {
  int r = x;
  while (pre[r] != r) r = pre[r];
  int i = x, j;
  while (i != j) {
    j = pre[i];
    pre[i] = r;
    i = j;
  }
  return r;
}
void join(int x, int y) {
  int fx = find(x), fy = find(y);
  if (fx != fy) pre[fx] = fy;
}
int w[1010], b[1010], belong[1010], scc = 0;
int ww[1010], bb[1010], dp[1010][1010];
map<int, int> mp;
vector<int> v[1010];
int main() {
  int n, m, h;
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i < 1010; i++) pre[i] = i;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    join(x, y);
  }
  for (int i = 1; i <= n; i++) {
    belong[i] = find(i);
  }
  for (int i = 1; i <= n; i++) {
    if (!mp[belong[i]]) {
      mp[belong[i]] = ++scc;
      belong[i] = scc;
    } else
      belong[i] = mp[belong[i]];
    ww[belong[i]] += w[i];
    bb[belong[i]] += b[i];
    v[belong[i]].push_back(i);
  }
  for (int i = 1; i <= scc; i++) {
    for (int j = 0; j <= h; j++) {
      if (j >= ww[i])
        dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - ww[i]] + bb[i]);
      else
        dp[i][j] = dp[i - 1][j];
    }
    int sz = v[i].size();
    for (int j = 0; j <= h; j++) {
      for (int k = 0; k < sz; k++) {
        if (j >= w[v[i][k]])
          dp[i][j] = max(dp[i][j], max(dp[i - 1][j],
                                       dp[i - 1][j - w[v[i][k]]] + b[v[i][k]]));
      }
    }
  }
  printf("%d\n", dp[scc][h]);
}
