#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
vector<vector<int> > array2_int(int N, int M, int def = 0) {
  return vector<vector<int> >(N, vector<int>(M, def));
}
vector<vector<vector<int> > > array3_int(int N, int M, int K, int def = 0) {
  return vector<vector<vector<int> > >(
      N, vector<vector<int> >(M, vector<int>(K, def)));
}
vector<vector<long long> > array2_ll(int N, int M, long long def = 0) {
  return vector<vector<long long> >(N, vector<long long>(M, def));
}
vector<vector<vector<long long> > > array3_ll(int N, int M, int K,
                                              long long def = 0) {
  return vector<vector<vector<long long> > >(
      N, vector<vector<long long> >(M, vector<long long>(K, def)));
}
template <class T>
void printImpl(const vector<T>& coll) {
  copy(coll.begin(), coll.end(), ostream_iterator<T>(cout, " "));
  cout << endl;
}
template <class T, int N>
void printImpl(T (&coll)[N]) {
  copy(coll, coll + N, ostream_iterator<T>(cout, " "));
  cout << endl;
}
template <class Key, class Value>
void printImpl(const map<Key, Value>& data) {
  typename map<Key, Value>::const_iterator it;
  for (it = data.begin(); it != data.end(); ++it) {
    cout << it->first << ":" << it->second << endl;
  }
}
template <class T>
void printImpl(const T& data) {
  cout << data << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M, W;
  cin >> N >> M >> W;
  vector<int> w(N);
  for (int i = 0; i < (N); ++i) cin >> w[i];
  vector<int> b(N);
  for (int i = 0; i < (N); ++i) cin >> b[i];
  vector<int> groups(N);
  for (int i = 0; i < (N); ++i) groups[i] = i;
  for (int i = 0; i < (M); ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    if (groups[x] != groups[y]) {
      int groupY = groups[y];
      for (int i = 0; i < (N); ++i) {
        if (groups[i] == groupY) groups[i] = groups[x];
      }
    }
  }
  set<int> ungr(groups.begin(), groups.end());
  int G = ungr.size();
  vector<vector<int> > gr(G);
  int gg = 0;
  for (auto it : ungr) {
    for (int i = 0; i < (N); ++i) {
      if (groups[i] == it) {
        gr[gg].push_back(i);
      }
    }
    gg++;
  }
  vector<vector<int> > dp = array2_int(G + 1, W + 1);
  for (int us = 1; us <= G; ++us) {
    dp[us] = dp[us - 1];
    int totalGroupWeight = 0;
    int totalGroupBeauty = 0;
    for (int ix : gr[us - 1]) {
      totalGroupWeight += w[ix];
      totalGroupBeauty += b[ix];
    }
    for (int ww = totalGroupWeight; ww <= W; ++ww) {
      dp[us][ww] =
          max(dp[us][ww], dp[us - 1][ww - totalGroupWeight] + totalGroupBeauty);
    }
    for (int oneIx : gr[us - 1]) {
      for (int ww = w[oneIx]; ww <= W; ++ww) {
        dp[us][ww] = max(dp[us][ww], dp[us - 1][ww - w[oneIx]] + b[oneIx]);
      }
    }
  }
  int res = 0;
  for (int w = 0; w <= W; ++w) {
    res = max(res, dp[G][w]);
  }
  cout << res << endl;
  return 0;
}
