#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
class UnionFind {
 private:
  std::vector<int> disj;
  std::vector<int> rank;

 public:
  UnionFind(int n) : disj(n), rank(n) {
    for (int i = 0; i < n; ++i) {
      disj[i] = i;
      rank[i] = 0;
    }
  }
  int root(int x) {
    if (disj[x] == x) {
      return x;
    }
    return disj[x] = root(disj[x]);
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) {
      return;
    }
    if (rank[x] < rank[y]) {
      disj[x] = y;
    } else {
      disj[y] = x;
      if (rank[x] == rank[y]) {
        ++rank[x];
      }
    }
  }
  bool is_same_set(int x, int y) { return root(x) == root(y); }
};
int main(void) {
  int n, m, w;
  cin >> n >> m >> w;
  vector<int> a(n);
  for (int i = (int)(0); i < (int)(n); i++) {
    cin >> a[i];
  }
  vector<int> b(n);
  for (int i = (int)(0); i < (int)(n); i++) {
    cin >> b[i];
  }
  UnionFind uf(n);
  for (int i = (int)(0); i < (int)(m); i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    uf.unite(x, y);
  }
  vector<vector<int> > conn(n);
  for (int i = (int)(0); i < (int)(n); i++) {
    conn[uf.root(i)].push_back(i);
  }
  const int W = 1010;
  vector<int> dp(W);
  int w_sofar = 0;
  for (int i = (int)(0); i < (int)(n); i++) {
    if (conn[i].size() == 0) {
      continue;
    }
    vector<int> dp2(dp.begin(), dp.end());
    int tot_w = 0;
    int tot_b = 0;
    for (int j = (int)(0); j < (int)(conn[i].size()); j++) {
      int v = conn[i][j];
      tot_w += a[v];
      tot_b += b[v];
      for (int k = (int)(0); k < (int)(W); k++) {
        if (k >= a[v]) {
          dp2[k] = max(dp2[k], dp[k - a[v]] + b[v]);
        }
      }
    }
    for (int k = (int)(0); k < (int)(W); k++) {
      if (k >= tot_w) {
        dp2[k] = max(dp2[k], dp[k - tot_w] + tot_b);
      }
    }
    dp = dp2;
    w_sofar += tot_w;
    if (0) {
      cerr << "dp[" << i + 1 << "]:";
      for (int j = (int)(0); j < (int)(w_sofar); j++) {
        cerr << " " << dp[j];
      }
      cerr << endl;
    }
  }
  int ma = 0;
  for (int i = (int)(0); i < (int)(w + 1); i++) {
    ma = max(ma, dp[i]);
  }
  cout << ma << endl;
}
