#include <bits/stdc++.h>
using namespace std;
const long long INF = -10000000;
struct Girl {
  int Beauty;
  int Weight;
  vector<int> Friends;
  bool Was;
  Girl(int beauty, int weight) : Beauty(beauty), Weight(weight) {}
  Girl() : Was(false) {}
};
vector<Girl> girls;
struct GroupOfGirls {
  int TotalBeauty;
  int TotalWeight;
  vector<int> Girls;
  GroupOfGirls() : TotalBeauty(0), TotalWeight(0) {}
};
vector<GroupOfGirls> groups;
void DFS(int v, int number) {
  if (girls[v].Was) return;
  girls[v].Was = true;
  groups[number].TotalBeauty += girls[v].Beauty;
  groups[number].TotalWeight += girls[v].Weight;
  groups[number].Girls.push_back(v);
  for (int i = 0; i < int(girls[v].Friends.size()); ++i) {
    DFS(girls[v].Friends[i], number);
  }
}
const int MAXN = 1003;
int dp[MAXN][MAXN];
void upgrade_dp(int i, int j, int weight, int beauty, int w) {
  if (weight > w) return;
  dp[i + 1][weight] = max(dp[i + 1][weight], dp[i][j] + beauty);
}
int main() {
  int n, m, w;
  cin >> n >> m >> w;
  girls.resize(n);
  for (int i = 0; i < int(n); ++i) {
    cin >> girls[i].Weight;
  }
  for (int i = 0; i < int(n); ++i) {
    cin >> girls[i].Beauty;
  }
  for (int i = 0; i < int(m); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    girls[a].Friends.push_back(b);
    girls[b].Friends.push_back(a);
  }
  int number = 0;
  for (int i = 0; i < int(n); ++i) {
    if (girls[i].Was) continue;
    groups.push_back(GroupOfGirls());
    DFS(i, number);
    number++;
  }
  fill_n(&dp[0][0], MAXN * MAXN, INF);
  dp[0][0] = 0;
  for (int i = 0; i < int(number); ++i) {
    for (int j = 0; j < int(w + 1); ++j) {
      if (dp[i][j] == INF) continue;
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      upgrade_dp(i, j, j + groups[i].TotalWeight, groups[i].TotalBeauty, w);
      for (int k = 0; k < int(groups[i].Girls.size()); ++k) {
        upgrade_dp(i, j, j + girls[groups[i].Girls[k]].Weight,
                   girls[groups[i].Girls[k]].Beauty, w);
      }
    }
  }
  int res = 0;
  for (int i = 0; i < int(w + 1); ++i) {
    res = max(res, dp[number][i]);
  }
  cout << res << endl;
  return 0;
}
