#include <bits/stdc++.h>
using namespace std;
vector<int> group[1010];
vector<int> graph[1010];
int w[1010], b[1010];
int dp[1010][1010];
int group_count = 0;
bool visited[1010];
void dfs(int src) {
  visited[src] = true;
  group[group_count].push_back(src);
  for (int k : graph[src])
    if (!visited[k]) dfs(k);
}
int main() {
  int n, m, W;
  cin >> n >> m >> W;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      group_count++;
      dfs(i);
    }
  }
  for (int i = 0; i <= W; i++) dp[0][i] = 0;
  for (int i = 1; i <= group_count; i++) {
    int sum_w = 0, sum_b = 0;
    for (int k : group[i]) {
      sum_w += w[k];
      sum_b += b[k];
    }
    for (int j = 0; j <= W; j++) {
      dp[i][j] = dp[i - 1][j];
      for (int k : group[i])
        if (j >= w[k]) dp[i][j] = max(dp[i][j], dp[i - 1][j - w[k]] + b[k]);
      if (j >= sum_w) dp[i][j] = max(dp[i][j], dp[i - 1][j - sum_w] + sum_b);
    }
  }
  cout << dp[group_count][W] << endl;
  return 0;
}
