#include <bits/stdc++.h>
using namespace std;
long long A[1005], B[1005];
long long dp[1005][1005];
vector<long long> G[1005], g[1005];
vector<pair<long long, pair<long long, long long> > > V;
long long weight, beauty;
int vis[1005];
void dfs(int u, int root) {
  g[root].push_back(u);
  vis[u] = 1;
  weight += A[u];
  beauty += B[u];
  for (int i = 0; i < G[u].size(); i++) {
    if (vis[G[u][i]] == 0) dfs(G[u][i], root);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m, w, u, v, ans = 0;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) cin >> B[i];
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    weight = 0;
    beauty = 0;
    if (!vis[i]) {
      dfs(i, i);
      V.push_back(make_pair(weight, make_pair(beauty, i)));
    }
  }
  for (int i = 1; i <= V.size(); i++) {
    for (int j = 1; j <= w; j++) {
      dp[i][j] = dp[i - 1][j];
      if (V[i - 1].first <= j)
        dp[i][j] = max(dp[i][j],
                       V[i - 1].second.first + dp[i - 1][j - V[i - 1].first]);
      int s = V[i - 1].second.second;
      for (int k = 0; k < g[s].size(); k++) {
        int p = g[s][k];
        if (A[p] <= j) {
          dp[i][j] = max(dp[i][j], B[p] + dp[i - 1][j - A[p]]);
        }
      }
    }
  }
  cout << dp[V.size()][w] << endl;
  return 0;
}
