#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using lld = long double;
using vll = int64_t;
int n, m, W;
vector<int> comp[1001], adj[1001], b(1001, 0), w(1001, 0);
int dp[1001][1001];
int cnt = 0;
vector<bool> vis(1001, false);
void dfs(int src) {
  comp[cnt].push_back(src);
  vis[src] = true;
  for (int i : adj[src])
    if (!vis[i]) dfs(i);
}
int fun(int i, int ww) {
  if (i >= cnt) return 0;
  int sum = 0;
  int val = 0;
  auto &res = dp[i][ww];
  if (res != -1) return res;
  int ans = fun(i + 1, ww);
  for (int j : comp[i]) {
    if (w[j] <= ww) ans = max(ans, b[j] + fun(i + 1, ww - w[j]));
    sum += w[j];
    val += b[j];
  }
  if (sum <= ww) ans = max(ans, val + fun(i + 1, ww - sum));
  return res = ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> W;
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < W + 1; j++) dp[i][j] = -1;
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; i++)
    if (!vis[i]) dfs(i), cnt++;
  cout << fun(0, W);
  return 0;
}
