#include <bits/stdc++.h>
using namespace std;
long long w[1005], s[1005], sumw[1005], sums[1005];
int pre[1005];
int find(int x) {
  int r = x;
  while (pre[r] != r) r = pre[r];
  while (pre[x] != x) {
    int t = pre[x];
    pre[x] = r;
    x = t;
  }
  return r;
}
void mix(int a, int b) {
  int fa = find(a), fb = find(b);
  if (fa != fb) pre[fa] = fb;
}
long long dp[1005];
vector<int> g[1005];
vector<int> v;
int getid(int x) { return lower_bound(v.begin(), v.end(), x) - v.begin() + 1; }
int main() {
  int n, m, k, x, y;
  scanf("%d%d%d", &n, &m, &k);
  memset(dp, -1, sizeof(dp));
  memset(sums, 0, sizeof(sums));
  memset(sumw, 0, sizeof(sumw));
  for (int i = 1; i <= n; ++i) pre[i] = i;
  for (int i = 1; i <= n; ++i) scanf("%I64d", &w[i]);
  for (int i = 1; i <= n; ++i) scanf("%I64d", &s[i]);
  for (int i = 0; i < m; ++i) scanf("%d%d", &x, &y), mix(x, y);
  for (int i = 1; i <= n; ++i)
    if (pre[i] == i) v.push_back(i);
  sort(v.begin(), v.end());
  for (int i = 1; i <= n; ++i) {
    int tmp = getid(find(i));
    g[tmp].push_back(i), sumw[tmp] += w[i], sums[tmp] += s[i];
  }
  dp[0] = 0;
  for (int i = 1; i <= v.size(); ++i) {
    for (int j = k; j >= 0; --j) {
      if (dp[j] == -1) continue;
      for (int u = 0; u < g[i].size(); ++u) {
        if (j + w[g[i][u]] <= k)
          dp[j + w[g[i][u]]] = max(dp[j + w[g[i][u]]], dp[j] + s[g[i][u]]);
      }
      if (j + sumw[i] <= k)
        dp[j + sumw[i]] = max(dp[j + sumw[i]], dp[j] + sums[i]);
    }
  }
  long long ans = -1;
  for (int i = 0; i <= k; ++i) {
    ans = max(dp[i], ans);
  }
  printf("%I64d\n", ans);
}
