#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long b,
                 long long mod = (long long)(1e9 + 7)) {
  if (!b) return 1;
  a %= mod;
  return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod;
}
const int maxn = 1e3;
int n, m, W, N;
vector<int> adj[maxn];
int vi[maxn], wi[maxn];
bool vis[maxn];
void dfs(int v, int &value, int &weight, vector<int> &ls) {
  value += vi[v];
  weight += wi[v];
  ls.push_back(v);
  vis[v] = true;
  for (int w : adj[v])
    if (!vis[w]) dfs(w, value, weight, ls);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  scanf("%d", &n), scanf("%d", &m), scanf("%d", &W);
  for (int i = 0; i < n; i++) scanf("%d", &wi[i]);
  for (int i = 0; i < n; i++) scanf("%d", &vi[i]);
  for (int _ = 0; _ < m; _++) {
    int x, y;
    scanf("%d", &x), scanf("%d", &y);
    x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  memset(vis, false, sizeof(vis));
  vector<int> values;
  vector<int> weights;
  vector<vector<int> > list;
  vector<int> empty;
  values.push_back(0);
  weights.push_back(0);
  list.push_back(empty);
  for (int i = 0; i < n; i++)
    if (!vis[i]) {
      int value = 0, weight = 0;
      vector<int> ls;
      dfs(i, value, weight, ls);
      list.push_back(ls);
      values.push_back(value), weights.push_back(weight);
    }
  N = values.size();
  int dp[N][W + 1];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < N; i++)
    if (i) {
      for (int w = 0; w < W + 1; w++) {
        dp[i][w] = dp[i - 1][w];
        if (w >= weights[i])
          dp[i][w] = max(dp[i][w], dp[i - 1][w - weights[i]] + values[i]);
        ;
        for (int v : list[i])
          if (w >= wi[v])
            dp[i][w] = max(dp[i][w], dp[i - 1][w - wi[v]] + vi[v]);
        ;
      }
    }
  cout << dp[N - 1][W] << endl;
  return 0;
}
