#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e18;
const long long int N = 1e7;
map<long long int, vector<long long int>> edges;
map<long long int, bool> vis;
vector<long long int> c;
void dfs(long long int node) {
  vis[node] = true;
  c.push_back(node);
  for (auto child : edges[node]) {
    if (!vis[child]) {
      dfs(child);
    }
  }
}
signed main(void) {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int n, m, k;
    cin >> n >> m >> k;
    vector<long long int> w(n + 1);
    vector<long long int> b(n + 1);
    for (long long int i = 1; i <= n; i++) cin >> w[i];
    for (long long int i = 1; i <= n; i++) cin >> b[i];
    for (long long int i = 0; i < m; i++) {
      long long int u, v;
      cin >> u >> v;
      edges[u].push_back(v);
      edges[v].push_back(u);
    }
    vector<vector<long long int>> comp;
    for (long long int i = 1; i <= n; i++) {
      if (!vis[i]) {
        c.clear();
        dfs(i);
        comp.push_back(c);
      }
    }
    vector<long long int> prev(k + 1);
    long long int ans = 0;
    for (long long int i = 0; i < comp.size(); i++) {
      vector<long long int> curr = prev;
      long long int x = 0, y = 0;
      for (long long int j = 0; j < comp[i].size(); j++) {
        long long int index = comp[i][j];
        x += w[index];
        y += b[index];
        for (long long int l = 0; l <= k; l++) {
          if (l + w[index] <= k)
            curr[l + w[index]] = max(
                {prev[l + w[index]], curr[l + w[index]], prev[l] + b[index]});
          else
            break;
        }
      }
      for (long long int l = 0; l <= k; l++) {
        if (l + x <= k)
          curr[l + x] = max({prev[l + x], curr[l + x], prev[l] + y});
        else
          break;
      }
      swap(curr, prev);
    }
    for (long long int i = 0; i <= k; i++) ans = max(ans, prev[i]);
    cout << ans << endl;
  }
}
