#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000 * 10 + 100;
int w[maxN], b[maxN];
bool used[maxN];
vector<pair<int, int> > all;
vector<int> g[maxN];
int dp[maxN];
void dfs(int v) {
  all.push_back(make_pair(w[v], b[v]));
  used[v] = false;
  for (int i = 0; i < g[v].size(); ++i) {
    int next = g[v][i];
    if (used[next] == false) continue;
    dfs(next);
  }
}
int main() {
  int n, m, W;
  scanf("%d %d %d", &n, &m, &W);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  for (int i = 1; i <= n; ++i) used[i] = true;
  for (int i = 0; i < m; ++i) {
    int v1, v2;
    scanf("%d %d", &v1, &v2);
    g[v1].push_back(v2);
    g[v2].push_back(v1);
  }
  for (int i = 1; i <= n; ++i) {
    if (!used[i]) continue;
    all.clear();
    dfs(i);
    int sumAll = 0, weightAll = 0;
    for (int j = 0; j < all.size(); ++j)
      sumAll += all[j].second, weightAll += all[j].first;
    for (int _W = W - 1; _W >= 0; --_W) {
      if (_W + weightAll <= W)
        dp[_W + weightAll] = max(dp[_W + weightAll], dp[_W] + sumAll);
      for (int elem = 0; elem < all.size(); ++elem) {
        if (_W + all[elem].first <= W)
          dp[_W + all[elem].first] =
              max(dp[_W + all[elem].first], dp[_W] + all[elem].second);
      }
    }
  }
  int answer = 0;
  for (int i = 1; i <= W; ++i) answer = max(answer, dp[i]);
  cout << answer << endl;
  return 0;
}
