#include <bits/stdc++.h>
using namespace std;
long long n, m, ww, i, w[20005], b[20005], a, bb, val, ma[20005], ca[20005],
    sum[20005][3], dp[2005][2005], parent[20005];
vector<pair<long long, long long> > v;
long long rec(long long x, long long y) {
  if (y > ww) return -10000000000000ll;
  if (x == v.size()) return 0;
  long long ans = 0;
  if (dp[x][y] != -1) return dp[x][y];
  if (ca[v[x].first] == x && y + sum[v[x].first][0] <= ww) {
    ans = sum[v[x].first][1] + rec(ma[v[x].first], y + sum[v[x].first][0]);
  }
  if (ca[v[x].first] == x) {
    ans = max(ans, rec(ma[v[x].first], y));
  }
  if (y + w[v[x].second] <= ww) {
    ans = max(ans, b[v[x].second] + rec(ma[v[x].first], y + w[v[x].second]));
  }
  ans = max(ans, rec(x + 1, y));
  return (dp[x][y] = ans);
}
long long find(long long x) {
  if (parent[x] == x) return x;
  return parent[x] = find(parent[x]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> ww;
  for (i = 1; i <= n; i++) {
    cin >> w[i];
    parent[i] = i;
  }
  for (i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (i = 0; i < m; i++) {
    cin >> a >> bb;
    a = find(a);
    bb = find(bb);
    if (a != bb) {
      parent[a] = parent[bb];
    }
  }
  for (i = 1; i <= n; i++) {
    a = find(i);
    v.push_back(make_pair(a, i));
  }
  sort(v.begin(), v.end());
  val = v[0].first;
  ca[val] = 0;
  i = 0;
  sum[v[i].first][0] += w[v[i].second];
  sum[v[i].first][1] += b[v[i].second];
  for (i = 1; i < v.size(); i++) {
    sum[v[i].first][0] += w[v[i].second];
    sum[v[i].first][1] += b[v[i].second];
    if (v[i].first == val)
      continue;
    else {
      ma[val] = i;
      val = v[i].first;
      ca[val] = i;
    }
  }
  ma[val] = v.size();
  memset(dp, -1, sizeof(dp));
  cout << rec(0, 0);
  return 0;
}
