#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e3 + 12;
const long long INF = 1e18 + 12;
const long long Inf = 1e9 + 12;
const long long mod = 1e9 + 7;
long long n, m, w, num, W[maxN], b[maxN], dp[maxN][maxN];
vector<long long> g[maxN], comp[maxN];
bool mrk[maxN];
void dfs(long long v) {
  mrk[v] = true;
  comp[num].push_back(v);
  for (long long i = 0; i < g[v].size(); i++) {
    long long u = g[v][i];
    if (!mrk[u]) dfs(u);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  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 x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (long long i = 1; i <= n; i++) {
    if (!mrk[i]) num++, dfs(i);
  }
  for (long long i = 1; i <= num; i++) {
    long long wgh = 0, bt = 0;
    for (long long k = 0; k < comp[i].size(); k++) {
      long long I = comp[i][k];
      wgh += W[I];
      bt += b[I];
      for (long long j = 0; j <= w; j++) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j]);
        if (j >= W[I]) dp[i][j] = max(dp[i][j], dp[i - 1][j - W[I]] + b[I]);
      }
    }
    for (long long j = 0; j <= w; j++) {
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      if (j >= wgh) dp[i][j] = max(dp[i][j], dp[i - 1][j - wgh] + bt);
    }
  }
  long long mx = 0;
  for (long long i = 0; i <= w; i++) mx = max(mx, dp[num][i]);
  cout << mx << endl;
}
