#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
int n, m, w;
long long weights[N], b[N], visit[N];
long long memo[N][N];
pair<pair<long long, long long>, int> groupsSum[N];
vector<long long> adj[N], groups[N];
vector<long long> a;
void bfs(int source, int level) {
  if (visit[source]) return;
  queue<int> q;
  q.push(source);
  visit[source] = 1;
  while (!q.empty()) {
    int sz = q.size();
    while (sz--) {
      int fr = q.front();
      q.pop();
      visit[fr] = 1;
      groups[level].push_back(fr);
      for (int i = 0; i < (int)adj[fr].size(); i++) {
        if (!visit[adj[fr][i]]) {
          q.push(adj[fr][i]);
          visit[adj[fr][i]] = 1;
        }
      }
    }
  }
}
long long solve(int i, int sumOfW) {
  if (i == n) return 0;
  long long &ret = memo[i][sumOfW];
  if (ret != -1) return ret;
  ret = 0;
  if (sumOfW + weights[a[i]] <= w) {
    ret = max(ret, solve(i + groupsSum[a[i]].second, sumOfW + weights[a[i]]) +
                       b[a[i]]);
  }
  if (sumOfW + groupsSum[a[i]].first.first <= w) {
    ret = max(ret, solve(i + groupsSum[a[i]].second,
                         sumOfW + groupsSum[a[i]].first.first) +
                       groupsSum[a[i]].first.second);
  }
  ret = max(ret, solve(i + 1, sumOfW));
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  memset(memo, -1, sizeof memo);
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) {
    cin >> weights[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  while (m--) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    bfs(i, i);
  }
  for (int i = 1; i <= n; i++) {
    long long sumOFWeights = 0, sumOfBeauties = 0;
    for (int j = 0; j < (int)groups[i].size(); j++) {
      sumOFWeights += weights[groups[i][j]];
      sumOfBeauties += b[groups[i][j]];
    }
    for (int j = 0; j < (int)groups[i].size(); j++) {
      groupsSum[groups[i][j]].first.first = sumOFWeights;
      groupsSum[groups[i][j]].first.second = sumOfBeauties;
    }
    for (int j = 0; j < (int)groups[i].size(); j++) {
      a.push_back(groups[i][j]);
      groupsSum[groups[i][j]].second = groups[i].size() - j;
    }
  }
  cout << solve(0, 0);
}
