#include <bits/stdc++.h>
using namespace std;
long long N, M, W;
pair<long long, long long> arr[1004];
vector<long long> groups[1004];
long long dp[1004][1004];
bool vis[1004];
vector<long long> connect[1004];
long long groupnum = 0;
void dfs(long long node) {
  long long i, j;
  if (vis[node] == 1) return;
  groups[groupnum].push_back(node);
  vis[node] = 1;
  for (i = 0; i < connect[node].size(); i++) dfs(connect[node][i]);
}
long long fun(long long groupid, long long current_weight) {
  long long i, j;
  if (groupid == groupnum) return 0;
  if (dp[groupid][current_weight] != -1) return dp[groupid][current_weight];
  long long temp = fun(groupid + 1, current_weight);
  long long beautytot = 0;
  long long weighttot = 0;
  for (i = 0; i < groups[groupid].size(); i++) {
    long long node = groups[groupid][i];
    beautytot += arr[node].second;
    weighttot += arr[node].first;
    if (current_weight + arr[node].first <= W)
      temp = max(temp, arr[node].second +
                           fun(groupid + 1, current_weight + arr[node].first));
  }
  if (weighttot + current_weight <= W)
    temp = max(temp, beautytot + fun(groupid + 1, current_weight + weighttot));
  return dp[groupid][current_weight] = temp;
}
int main() {
  long long i, j;
  memset(dp, -1, sizeof dp);
  memset(vis, 0, sizeof vis);
  scanf("%lld%lld%lld", &N, &M, &W);
  for (i = 1; i <= N; ++i) {
    long long X;
    scanf("%lld", &X);
    arr[i].first = X;
  }
  for (i = 1; i <= N; ++i) {
    long long X;
    scanf("%lld", &X);
    arr[i].second = X;
  }
  while (M--) {
    long long A, B;
    scanf("%lld%lld", &A, &B);
    connect[A].push_back(B);
    connect[B].push_back(A);
  }
  for (i = 1; i <= N; i++) {
    if (!vis[i]) dfs(i);
    groupnum++;
  }
  printf("%lld\n", fun(0, 0));
  return 0;
}
