#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007ll;
vector<int> adj[100005];
vector<pair<int, int> > grop[100005];
int now;
int weig[100005];
int bu[100005];
int flag[100005];
pair<int, int> dfs(int u) {
  if (flag[u]) return make_pair(0, 0);
  flag[u] = 1;
  pair<int, int> res = make_pair(0, 0);
  for (int i = 0; i < adj[u].size(); i++) {
    pair<int, int> tem = dfs(adj[u][i]);
    res.first += tem.first;
    res.second += tem.second;
  }
  res.first += weig[u];
  res.second += bu[u];
  grop[now].push_back(make_pair(weig[u], bu[u]));
  return res;
}
long long dp[100005];
int main() {
  int n, m, w;
  scanf("%d %d %d", &n, &m, &w);
  for (int i = 1; i <= n; i++) scanf("%d", &weig[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &bu[i]);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (flag[i]) continue;
    now++;
    pair<int, int> tem = dfs(i);
    grop[now].push_back(tem);
  }
  for (int i = 1; i <= now; i++) {
    for (int j = w; j > 0; j--) {
      for (int k = 0; k < grop[i].size(); k++) {
        if (grop[i][k].first > j) continue;
        dp[j] = max(dp[j], grop[i][k].second + dp[j - grop[i][k].first]);
      }
    }
  }
  long long res = 0;
  for (int i = 0; i <= w; i++) res = max(res, dp[i]);
  printf("%I64d\n", res);
  return 0;
}
