#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
const long long mx = 1005;
long long n, m, W, inf = 1e18;
vector<set<long long> > g(mx);
long long w[mx], b[mx], visit[mx];
void dfs(long long node, vector<long long>& tmp) {
  visit[node] = 1;
  tmp.push_back(node);
  for (long long x : g[node]) {
    if (!visit[x]) {
      dfs(x, tmp);
    }
  }
  return;
}
int32_t main() {
  long long T = 1;
  for (long long te = 1; te <= T; te++) {
    cin >> n >> m >> W;
    for (long long i = 1; i <= n; i++) {
      cin >> w[i];
    }
    for (long long i = 1; i <= n; i++) {
      cin >> b[i];
    }
    for (long long i = 0; i < m; i++) {
      long long from, to;
      cin >> from >> to;
      g[from].insert(to);
      g[to].insert(from);
    }
    vector<long long> ans(W + 1, -inf);
    ans[0] = 0;
    for (long long i = 1; i <= n; i++) {
      if (!visit[i]) {
        vector<long long> tmp;
        dfs(i, tmp);
        long long beauty = 0, weight = 0;
        for (long long val : tmp) {
          beauty += b[val], weight += w[val];
        }
        for (long long j = W; j >= 0; j--) {
          for (long long val : tmp) {
            if (j + w[val] <= W && ans[j + w[val]] < ans[j] + b[val]) {
              ans[j + w[val]] = ans[j] + b[val];
            }
          }
          if (j + weight <= W && ans[j + weight] < ans[j] + beauty) {
            ans[j + weight] = ans[j] + beauty;
          }
        }
      }
    }
    long long an = 0;
    for (long long i = 1; i <= W; i++) an = max(an, ans[i]);
    cout << an;
    cout << '\n';
  }
  return 0;
}
