#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > groups, DP, adj;
vector<int> weight, beauty, vis, sumWeight, sumBeauty;
int maxW;
void dfs(int v, int ind) {
  vis[v] = 1;
  sumWeight[ind] += weight[v];
  sumBeauty[ind] += beauty[v];
  groups[ind].push_back(v);
  for (int i = 0; i < adj[v].size(); ++i) {
    int to = adj[v][i];
    if (!vis[to]) dfs(to, ind);
  }
}
int dp(int pos, int wei) {
  if (wei > maxW) return -1;
  if (pos == groups.size()) return 0;
  if (DP[pos][wei] != 0) return DP[pos][wei];
  int maxi = dp(pos + 1, wei);
  int aux = dp(pos + 1, wei + sumWeight[pos]);
  if (aux != -1) maxi = max(maxi, sumBeauty[pos] + aux);
  for (int i = 0; i < groups[pos].size(); ++i) {
    int v = groups[pos][i];
    aux = dp(pos + 1, wei + weight[v]);
    if (aux != -1) maxi = max(maxi, beauty[v] + aux);
  }
  return DP[pos][wei] = maxi;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m >> maxW;
  weight = beauty = vis = vector<int>(n);
  adj = vector<vector<int> >(n);
  for (int i = 0; i < n; ++i) cin >> weight[i];
  for (int i = 0; i < n; ++i) cin >> beauty[i];
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    adj[a - 1].push_back(b - 1);
    adj[b - 1].push_back(a - 1);
  }
  int ind = 0, maxi = 0;
  for (int i = 0; i < n; ++i) {
    if (!vis[i]) {
      sumWeight.push_back(0);
      sumBeauty.push_back(0);
      groups.push_back(vector<int>(0));
      dfs(i, ind);
      maxi += sumBeauty[ind];
      ind++;
    }
  }
  DP = vector<vector<int> >(groups.size(), vector<int>(maxW + 2));
  cout << dp(0, 0) << "\n";
  return 0;
}
