#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void amax(X& x, const Y& y) {
  if (x < y) x = y;
}
template <class X, class Y>
void amin(X& x, const Y& y) {
  if (x > y) x = y;
}
const int INF = 1e9 + 10;
const long long INFL = 1e18 + 10;
const int MAX = 1010;
int n, m, w, ng;
pair<int, int> a[MAX];
vector<int> es[MAX];
bool group[MAX];
vector<pair<int, int> > c[MAX];
int f[MAX][MAX];
void dfs(int u) {
  group[u] = ng;
  c[ng].push_back(a[u]);
  for (auto v : es[u])
    if (group[v] == 0) dfs(v);
}
void process() {
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) cin >> a[i].first;
  for (int i = 1; i <= n; i++) cin >> a[i].second;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    es[u].push_back(v);
    es[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (group[i] == 0) {
      ng++;
      dfs(i);
    }
  for (int i = 1; i <= ng; i++) {
    for (int j = 1; j <= w; j++) {
      f[i][j] = f[i - 1][j];
      int sumw = 0, sumb = 0;
      for (auto p : c[i]) {
        sumw += p.first;
        sumb += p.second;
        if (j - p.first >= 0) amax(f[i][j], f[i - 1][j - p.first] + p.second);
      }
      if (sumw <= j) amax(f[i][j], f[i - 1][j - sumw] + sumb);
    }
  }
  int res = 0;
  for (int i = 1; i <= w; i++) amax(res, f[ng][i]);
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  process();
}
