#include <bits/stdc++.h>
using namespace std;
long long dp[2][1001];
vector<long long> friend_[1001];
bool vis[1001] = {false};
vector<long long> adj[1001];
long long weight[1001];
long long beauty[1001];
void dfs(long long x, int cnt) {
  vis[x] = true;
  friend_[cnt].push_back(x);
  int i;
  for (i = 0; i < adj[x].size(); i++) {
    if (!vis[adj[x][i]]) dfs(adj[x][i], cnt);
  }
}
int main() {
  long long n, m, w, i;
  cin >> n >> m >> w;
  for (i = 1; i <= n; i++) cin >> weight[i];
  for (i = 1; i <= n; i++) cin >> beauty[i];
  while (m--) {
    long long l, k;
    cin >> l >> k;
    adj[l].push_back(k);
    adj[k].push_back(l);
  }
  int cnt = 0;
  for (i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i, cnt);
      cnt++;
    }
  }
  int curr = 0;
  for (i = 0; i <= w; i++) dp[1][i] = 0;
  long long tw = 0, tb = 0, j;
  while (cnt--) {
    for (i = 0; i <= w; i++) {
      dp[curr][i] = 0;
      tw = 0, tb = 0;
      for (j = 0; j < friend_[cnt].size(); j++) {
        long long u = friend_[cnt][j];
        tb += beauty[u];
        tw += weight[u];
        if (weight[u] <= i) {
          dp[curr][i] =
              max(dp[curr][i], dp[(!curr)][i - weight[u]] + beauty[u]);
        }
      }
      dp[curr][i] = max(dp[curr][i], dp[(!curr)][i]);
      if (tw <= i) dp[curr][i] = max(dp[curr][i], dp[(!curr)][i - tw] + tb);
    }
    curr = !curr;
  }
  cout << dp[(!curr)][w];
  return 0;
}
