#include <bits/stdc++.h>
using namespace std;
const int MX = 123;
const int MOD = int(360);
const int oo = (1e9) + 10000;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, x;
  while (cin >> n >> m >> x) {
    vector<int> w(n), b(n);
    vector<vector<int> > graph(n);
    for (auto& e : w) {
      cin >> e;
    }
    for (auto& e : b) {
      cin >> e;
    }
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      u--;
      v--;
      graph[u].push_back(v);
      graph[v].push_back(u);
    }
    int id = 0;
    vector<bool> used(n);
    vector<vector<int> > dp(n + 1, vector<int>(x + 1));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
      if (!used[i]) {
        queue<int> q;
        q.push(i);
        used[i] = true;
        int sumw = 0, sumb = 0;
        while (!q.empty()) {
          int u = q.front();
          q.pop();
          sumw += w[u];
          sumb += b[u];
          for (int ww = 0; ww + w[u] <= x; ww++) {
            dp[id + 1][ww + w[u]] =
                max(dp[id + 1][ww + w[u]], dp[id][ww] + b[u]);
          }
          for (auto& v : graph[u]) {
            if (!used[v]) {
              used[v] = true;
              q.push(v);
            }
          }
        }
        for (int ww = 0; ww <= x; ww++) {
          dp[id + 1][ww] = max(dp[id + 1][ww], dp[id][ww]);
          if (ww + sumw <= x) {
            dp[id + 1][ww + sumw] =
                max(dp[id + 1][ww + sumw], dp[id][ww] + sumb);
          }
        }
        id++;
      }
    }
    int ans = 0;
    for (int i = 0; i <= x; i++) {
      ans = max(ans, dp[id][i]);
    }
    cout << ans << "\n";
  }
  return 0;
}
