#include <bits/stdc++.h>
using namespace std;
void setIO(const string &name = "") {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  if (name.length()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
template <typename T>
void read(vector<T> &a) {
  for (auto &x : a) cin >> x;
}
template <typename T>
void read(vector<T> &a, long long n) {
  a.resize(n);
  for (auto &x : a) cin >> x;
}
template <class T, class U>
ostream &operator<<(ostream &out, const pair<T, U> &v) {
  out << "(";
  out << v.first << "," << v.second;
  return out << ")";
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  for (auto(i) = 0; (i) < ((long long)(v).size()); (i)++) {
    if (i) out << ", ";
    out << v[i];
  }
  return out << "]";
}
template <typename T>
void print(vector<T> &a) {
  for (const auto &x : a) cout << x << ' ';
  cout << '\n';
}
void MOD(long long &x, long long m = 1000000007) {
  x %= m;
  if (x < 0) x += m;
}
template <typename T>
void dbg(const char *name, T &&arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename T, typename... U>
void dbg(const char *names, T &&arg1, U &&...args) {
  const char *comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  dbg(comma + 1, args...);
}
template <class T>
void read(T &x) {
  cin >> x;
}
template <class T, class... U>
void read(T &t, U &...u) {
  read(t);
  read(u...);
}
template <class T>
void tell(T &x) {
  cout << x;
}
template <class T, class... U>
void tell(T &t, U &...u) {
  tell(t);
  if (sizeof...(u)) tell(" ");
  tell(u...);
}
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long n, m, w;
vector<long long> a, b;
vector<long long> adj[1002];
vector<pair<long long, long long> > cc;
bool vis[1002];
long long cur_w, cur_b, cur_cc = 0;
long long dp[1002][1002];
vector<long long> nodes[1002];
void dfs(long long x) {
  if (vis[x]) return;
  vis[x] = true;
  cur_w += a[x];
  cur_b += b[x];
  nodes[cur_cc].emplace_back(x);
  for (auto &(c) : (adj[x])) {
    dfs(c);
  }
}
int32_t main() {
  setIO();
  if (true) {
    read(n, m, w);
    read(a, n);
    read(b, n);
    long long x, y;
    for (auto(_) = 0; (_) < (m); (_)++) {
      read(x, y);
      --x, --y;
      adj[x].emplace_back(y);
      adj[y].emplace_back(x);
    }
  }
  for (auto(i) = 0; (i) < (n); (i)++) {
    if (!vis[i]) {
      cur_w = 0, cur_b = 0;
      dfs(i);
      cur_cc++;
      cc.emplace_back(cur_w, cur_b);
    }
  }
  for (auto(i) = 0; (i) < (1002); (i)++) {
    dp[(long long)(cc).size()][i] = 0;
  }
  for (long long idx = (long long)(cc).size() - 1; idx >= 0; idx--) {
    for (long long weight = w; weight >= 0; weight--) {
      long long &res = dp[idx][weight];
      res = 0;
      if (cc[idx].first + weight <= w) {
        res = max(res, dp[idx + 1][weight + cc[idx].first] + cc[idx].second);
      }
      res = max(res, dp[idx + 1][weight]);
      for (auto &(c) : (nodes[idx])) {
        if (weight + a[c] <= w) {
          res = max(res, dp[idx + 1][weight + a[c]] + b[c]);
        }
      }
    }
  }
  long long ans = 0;
  for (auto(i) = 0; (i) < (w + 1); (i)++) {
    ans = max(ans, dp[0][i]);
  }
  cout << ans << '\n';
  return 0;
}
