#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
template <class T>
bool set_min(T &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool set_max(T &a, const T &b) {
  return a < b ? a = b, true : false;
}
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &a : v) is >> a;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (const T &t : v) os << "\t" << t;
  return os << endl;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
  return os << "<" << v.first << ", " << v.second << ">";
}
const int INF = 1 << 30;
const ll INFL = 1LL << 60;
struct UnionFind {
  int n;
  vector<int> p;
  UnionFind(int nn) : n(nn) {
    p.resize(n);
    for (int i = 0; i < (int)(n); i++) p[i] = i;
  }
  int root(int x) {
    if (p[x] == x)
      return x;
    else
      return p[x] = root(p[x]);
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) p[y] = x;
  }
  bool query(int x, int y) { return root(x) == root(y); }
  vector<vector<int>> groups() {
    vector<vector<int>> ret;
    set<int> used;
    for (int i = 0; i < (int)(n); i++) {
      if (not used.count(root(i))) {
        used.insert(root(i));
        vector<int> a;
        for (int j = 0; j < (int)(n); j++) {
          if (query(i, j)) a.push_back(j);
        }
        ret.push_back(a);
      }
    }
    return ret;
  }
};
class Solver {
 public:
  bool solve() {
    int N, M, MaxW;
    cin >> N >> M >> MaxW;
    vector<int> W(N), B(N);
    cin >> W >> B;
    vector<int> x(M), y(M);
    for (int i = 0; i < (int)(M); i++) cin >> x[i] >> y[i];
    UnionFind uf(N);
    for (int i = 0; i < (int)(M); i++) uf.unite(x[i] - 1, y[i] - 1);
    auto group = uf.groups();
    vector<vector<ll>> DP(group.size() + 1, vector<ll>(MaxW + 1, -INF));
    fill(begin(DP[0]), end(DP[0]), 0);
    for (int i = 0; i < (int)(group.size()); i++) {
      ll sum_w = 0, sum_b = 0;
      for (int nxt : group[i]) {
        for (int w = 0; w < (int)(MaxW + 1); w++) {
          set_max(DP[i + 1][w], DP[i][w]);
          if (w + W[nxt] <= MaxW)
            set_max(DP[i + 1][w + W[nxt]], DP[i][w] + B[nxt]);
        }
        sum_w += W[nxt];
        sum_b += B[nxt];
      }
      for (int w = 0; w < (int)(MaxW + 1); w++) {
        if (w + sum_w <= MaxW) set_max(DP[i + 1][w + sum_w], DP[i][w] + sum_b);
      }
    }
    cout << *max_element(DP[group.size()].begin(), DP[group.size()].end())
         << endl;
    return 0;
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  Solver s;
  s.solve();
  return 0;
}
