#include <bits/stdc++.h>
using namespace std;
vector<int> graph[1007];
int visited[1007];
int weight[1007], beauty[1007], group_weight[1007], group_beauty[1007];
int total_group = 0, n, m, w;
vector<pair<int, int> > group_member[1007];
int dp[1007][1007];
void dfs(int u, int p) {
  if (visited[u] == 1) return;
  visited[u] = 1;
  group_weight[total_group] += weight[u];
  group_beauty[total_group] += beauty[u];
  group_member[total_group].push_back({weight[u], beauty[u]});
  for (auto v : graph[u]) {
    dfs(v, u);
  }
}
int sol(int current_group, int current_weight) {
  if (current_weight > w) return -(1e9 + 7);
  if (current_group >= total_group) return 0;
  int &ans = dp[current_group][current_weight];
  if (~ans) return ans;
  ans = -(1e9 + 7);
  ans = max(ans, sol(current_group + 1,
                     current_weight + group_weight[current_group]) +
                     group_beauty[current_group]);
  ans = max(ans, sol(current_group + 1, current_weight));
  for (auto hoses : group_member[current_group]) {
    ans = max(ans, sol(current_group + 1, current_weight + hoses.first) +
                       hoses.second);
  }
  return ans;
}
int main() {
  memset(dp, -1, sizeof(dp));
  int u, v;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; ++i) cin >> weight[i];
  for (int i = 1; i <= n; ++i) cin >> beauty[i];
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    if (!visited[i]) {
      dfs(i, -1);
      total_group++;
    }
  }
  cout << sol(0, 0) << endl;
  return 0;
}
