#include <bits/stdc++.h>
class TaskB {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n, m, w;
    in >> n >> m >> w;
    std::vector<int> weights(n);
    for (int i = 0; i < n; i++) in >> weights[i];
    std::vector<int> bonuses(n);
    for (int i = 0; i < n; i++) in >> bonuses[i];
    std::vector<int> dsu(n);
    for (int i = 0; i < n; i++) dsu[i] = i;
    for (int i = 0; i < m; i++) {
      int u, v;
      in >> u >> v;
      --u, --v;
      int a = dsu[u], b = dsu[v];
      if (a > b) std::swap(a, b);
      if (a != b)
        for (int j = 0; j < n; j++)
          if (dsu[j] == b) dsu[j] = a;
    }
    std::vector<int> d(w + 1, 0);
    std::vector<int> girls;
    for (int g = 0; g < n; g++) {
      int sum_weight = 0, sum_bonus = 0;
      girls.clear();
      for (int i = 0; i < n; i++) {
        if (dsu[i] == g) {
          sum_weight += weights[i];
          sum_bonus += bonuses[i];
          girls.push_back(i);
        }
      }
      for (int cw = w; cw >= 0; cw--) {
        if (cw + sum_weight <= w) {
          d[cw + sum_weight] = std::max(d[cw + sum_weight], d[cw] + sum_bonus);
        }
        for (int i : girls) {
          if (cw + weights[i] <= w) {
            d[cw + weights[i]] =
                std::max(d[cw + weights[i]], d[cw] + bonuses[i]);
          }
        }
      }
    }
    int ans = *std::max_element(d.begin(), d.end());
    out << ans << "\n";
  }
};
int main() {
  std::ios_base::sync_with_stdio(false);
  TaskB solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  in.tie(0);
  out << std::fixed;
  out.precision(20);
  solver.solve(in, out);
  return 0;
}
