#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
int n, m, w, p[N], sz[N], we[N], b[N], dp[N][N], fb[N], fw[N];
vector<vector<int>> ad;
vector<int> v[N];
void init() {
  for (int i = 1; i <= n; i++) p[i] = i, sz[i] = 1;
}
int find(int v) {
  if (p[v] == v) return v;
  return p[v] = find(p[v]);
}
void uni(int a, int b) {
  a = find(a);
  b = find(b);
  if (a != b) {
    if (sz[a] < sz[b]) swap(a, b);
    p[b] = a;
    sz[a] += sz[b];
  }
}
int solve(int i, int sum) {
  if (sum < 0) return -1e9;
  if (i == (int)ad.size()) return 0;
  int &re = dp[i][sum];
  if (re != -1) return re;
  int mx = 0;
  mx = solve(i + 1, sum);
  mx = max(solve(i + 1, sum - fw[find(ad[i][0])]) + fb[find(ad[i][0])], mx);
  for (int u : ad[i]) mx = max(mx, solve(i + 1, sum - we[u]) + b[u]);
  return re = mx;
}
int main() {
  scanf("%d%d%d", &n, &m, &w);
  init();
  for (int i = 1; i <= n; i++) scanf("%d", we + i);
  for (int i = 1; i <= n; i++) scanf("%d", b + i);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    uni(x, y);
  }
  for (int i = 1; i <= n; i++) {
    fb[find(i)] += b[i];
    fw[find(i)] += we[i];
  }
  for (int i = 1; i <= n; i++) v[find(i)].push_back(i);
  for (int i = 1; i <= n; i++) {
    if (!v[i].size()) continue;
    vector<int> t;
    for (auto u : v[i]) t.push_back(u);
    ad.push_back(t);
  }
  memset(dp, -1, sizeof(dp));
  printf("%d\n", solve(0, w));
  return 0;
}
