#include <bits/stdc++.h>
using namespace std;
int n, m, W;
int w[1005];
int b[1005];
vector<int> g[1005];
vector<int> adj[1005];
int k = 0;
int vis[1005];
void dfs(int s) {
  if (vis[s]) return;
  g[k].push_back(s);
  vis[s] = 1;
  for (auto y : adj[s]) {
    if (!vis[y]) dfs(y);
  }
}
int dp[1005][1005];
int solve(int ind, int weight) {
  if (ind <= 0 || weight <= 0) return 0;
  if (dp[ind][weight] != -1) return dp[ind][weight];
  int ans = 0;
  int ww = 0;
  int bb = 0;
  for (auto x : g[ind]) {
    ww += w[x];
    bb += b[x];
    ans = max(ans, solve(ind - 1, weight));
    if (weight >= w[x]) ans = max(ans, solve(ind - 1, weight - w[x]) + b[x]);
  }
  if (weight >= ww) ans = max(ans, solve(ind - 1, weight - ww) + bb);
  return dp[ind][weight] = ans;
}
int main() {
  scanf("%d %d %d", &n, &m, &W);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  while (m--) {
    int x, y;
    scanf("%d %d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      ++k;
      dfs(i);
    }
  }
  memset(dp, -1, sizeof(dp));
  printf("%d\n", solve(k, W));
  return 0;
}
