#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000, maxv = 1000001;
int n, m, k;
pair<int, int> a[maxn];
bool used[maxn];
int dp[maxv], dp2[maxv];
vector<int> graph[maxn];
int second;
pair<int, int> operator+(pair<int, int> x, pair<int, int> y) {
  return {x.first + y.first, x.second + y.second};
}
pair<int, int> dfs(int c) {
  used[c] = 1;
  pair<int, int> ret = a[c];
  for (int i = min(k - a[c].first, second); i >= 0; i--) {
    dp[i + a[c].first] = max(dp[i + a[c].first], dp2[i] + a[c].second);
  }
  for (int i : graph[c])
    if (!used[i]) ret = ret + dfs(i);
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i].first;
  for (int i = 0; i < n; i++) cin >> a[i].second;
  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);
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      memcpy(dp2, dp, (second + 1) * sizeof(int));
      pair<int, int> cur = dfs(i);
      for (int j = min(k - cur.first, second); j >= 0; j--) {
        dp[j + cur.first] = max(dp[j + cur.first], dp2[j] + cur.second);
      }
      second += cur.first;
    }
  }
  int ret = 0;
  for (int i = 0; i <= k; i++) ret = max(ret, dp[i]);
  cout << ret << '\n';
  return 0;
}
