#include <bits/stdc++.h>
using namespace std;
long long int w[2001], b[2001];
long long int group[2001];
bool met[2001];
vector<long long int> path[2001], in_group[2001];
long long int dp[2001][2001];
void friend_group(long long int cur, long long int indx) {
  if (met[cur]) return;
  met[cur] = true;
  group[cur] = indx;
  in_group[indx].push_back(cur);
  for (long long int f : path[cur]) friend_group(f, indx);
}
int main() {
  long long int N, M, W;
  cin >> N >> M >> W;
  for (long long int i = 1; i <= N; i++) cin >> w[i];
  for (long long int i = 1; i <= N; i++) cin >> b[i];
  for (long long int i = 0; i < M; i++) {
    long long int a, b;
    cin >> a >> b;
    path[a].push_back(b);
    path[b].push_back(a);
  }
  long long int f = 1;
  for (long long int i = 1; i <= N; i++) {
    if (met[i]) continue;
    friend_group(i, f);
    f++;
  }
  long long int ans = 0;
  for (long long int i = 1; i <= f; i++) {
    for (long long int k = 1; k <= W; k++) {
      dp[i][k] = dp[i - 1][k];
      long long int total_weight = 0, total_beauty = 0;
      for (long long int f : in_group[i]) {
        total_weight += w[f];
        total_beauty += b[f];
        if (k >= w[f]) dp[i][k] = max(dp[i][k], dp[i - 1][k - w[f]] + b[f]);
      }
      if (k >= total_weight) {
        dp[i][k] = max(dp[i][k], dp[i - 1][k - total_weight] + total_beauty);
      }
      ans = max(ans, dp[i][k]);
    }
  }
  cout << ans << "\n";
  return 0;
}
