#include <bits/stdc++.h>
using namespace std;
pair<long long, pair<long long, long long> > hos[2005];
long long pset[2005];
pair<long long, pair<long long, long long> > freq[1005];
long long dp[1005][1005];
vector<vector<pair<long long, long long> > > choi(1005);
long long maxw, maxi;
long long findSet(long long a) {
  if (a == pset[a])
    return a;
  else
    return pset[a] = findSet(pset[a]);
}
bool cmp(pair<long long, pair<long long, long long> > a,
         pair<long long, pair<long long, long long> > b) {
  if (pset[a.first] < pset[b.first])
    return 1;
  else if (pset[a.first] > pset[b.first])
    return 0;
  else
    return (a.second.first < b.second.first);
}
int main() {
  long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
  scanf("%lld %lld %lld", &a, &b, &c);
  for (d = 1; d <= a; d++) scanf("%lld", &hos[d].second.first);
  for (d = 1; d <= a; d++) scanf("%lld", &hos[d].second.second);
  for (d = 1; d <= a; d++) pset[d] = d, hos[d].first = d;
  for (d = 1; d <= b; d++) {
    scanf("%lld %lld", &e, &f);
    pset[findSet(e)] = findSet(f);
  }
  memset(freq, 0, sizeof freq);
  for (d = 1; d <= a; d++) {
    g = pset[d] = findSet(d);
    freq[g].first++;
    freq[g].second.first += hos[d].second.first;
    freq[g].second.second += hos[d].second.second;
    choi[g].push_back({hos[d].second.first, hos[d].second.second});
  }
  for (d = 1, h = a + 1; d <= a; d++) {
    if (freq[d].first <= 1LL) continue;
    hos[h] = {findSet(d), {freq[d].second.first, freq[d].second.second}};
    pset[h] = findSet(d);
    h++;
    choi[pset[d]].push_back({freq[d].second.first, freq[d].second.second});
  }
  memset(dp, 0, sizeof dp);
  for (d = 1; d <= a; d++) {
    for (i = 0; i <= c; i++) {
      dp[d][i] = dp[d - 1][i];
      for (j = 0; j < choi[d].size(); j++) {
        if (choi[d][j].first > i) continue;
        dp[d][i] =
            max(dp[d][i], dp[d - 1][i - choi[d][j].first] + choi[d][j].second);
      }
    }
  }
  printf("%lld\n", dp[a][c]);
  return 0;
}
