#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int infi = 1e9 + 7;
const long long infl = 1e18;
const double eps = 1e-7;
vector<vector<int>> g;
vector<vector<int>> tmp;
int snm[100500];
int W[1010];
int B[1010];
int find(int v) {
  if (v == snm[v]) return v;
  return snm[v] = find(snm[v]);
}
void merge(int a, int b) {
  a = find(a), b = find(b);
  if (a == b) return;
  snm[a] = b;
}
int dp[1010];
int ndp[1010];
void upd(int w, int b) { ndp[w] = max(ndp[w], b); }
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 0; i < n; ++i) snm[i] = i;
  for (int i = 0; i < n; ++i) cin >> W[i];
  for (int i = 0; i < n; ++i) cin >> B[i];
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    merge(a, b);
  }
  tmp.resize(n);
  for (int i = 0; i < n; ++i) {
    tmp[find(i)].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    if (tmp[i].empty()) continue;
    int sum_w = 0, sum_b = 0;
    memcpy(ndp, dp, sizeof(dp));
    for (int j = 0; j < (int)tmp[i].size(); ++j) {
      int to = tmp[i][j];
      sum_w += W[to];
      sum_b += B[to];
      for (int k = 0; k + W[to] <= w; ++k) upd(k + W[to], B[to] + dp[k]);
    }
    for (int k = 0; k + sum_w <= w; ++k) upd(k + sum_w, sum_b + dp[k]);
    memcpy(dp, ndp, sizeof(dp));
  }
  int ans = 0;
  for (int i = 0; i <= w; ++i) ans = max(ans, dp[i]);
  cout << ans;
  return 0;
}
