#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > groups;
int visited[1010];
vector<int> adj[1010];
int wt[1010], bt[1010];
void visit(int node, int tim) {
  if (visited[node]) return;
  visited[node] = tim;
  for (int i = 0; i < adj[node].size(); i++) {
    int u = adj[node][i];
    if (!visited[u]) visit(u, tim);
  }
}
long long dp[1010][1010];
long long ans = -1;
int N, W;
long long solve(int pos, int w) {
  if (pos == N) return 0;
  long long &ret = dp[pos][w];
  if (ret != -1) return ret;
  ret = 0;
  long long sumw = 0, sumb = 0;
  for (int i = 0; i < groups[pos].size(); i++) {
    int who = groups[pos][i];
    if ((wt[who] + w) <= W) {
      ret = max(ret, solve(pos + 1, wt[who] + w) + bt[who]);
    }
    sumb += bt[who];
    sumw += wt[who];
  }
  if ((sumw + w) <= W) {
    ret = max(ret, solve(pos + 1, sumw + w) + sumb);
  }
  ret = max(ret, solve(pos + 1, w));
  return ret;
}
int main() {
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) cin >> wt[i];
  for (int i = 1; i <= n; i++) cin >> bt[i];
  for (int i = 0; i < 1010; i++) visited[i] = 0;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int tim = 1;
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      visit(i, tim);
      tim++;
    }
  }
  for (int i = 1; i < tim; i++) {
    vector<int> temp;
    for (int j = 1; j <= n; j++) {
      if (visited[j] == i) {
        temp.push_back(j);
      }
    }
    groups.push_back(temp);
  }
  N = groups.size();
  W = w;
  for (int i = 0; i < 1010; i++)
    for (int j = 0; j < 1010; j++) dp[i][j] = -1;
  cout << solve(0, 0) << endl;
  return 0;
}
