#include <bits/stdc++.h>
using namespace std;
const long long N = 1000 + 3;
long long n, m, wt;
long long dp[N][N];
long long w[N];
long long b[N];
long long tw[N];
long long tb[N];
vector<long long> adj[N];
long long connected;
long long root[N], sz[N];
void init() {
  for (long long i = 0; i < n; i++) {
    root[i] = i;
    sz[i] = 1;
  }
  connected = n;
  return;
}
long long rt(long long k) {
  while (k != root[k]) {
    root[k] = root[root[k]];
    k = root[k];
  }
  return k;
}
void merge(long long u, long long v) {
  long long rt1 = rt(u);
  long long rt2 = rt(v);
  if (rt1 == rt2) return;
  connected--;
  if (sz[rt1] > sz[rt2]) swap(rt1, rt2);
  sz[rt2] += sz[rt1];
  sz[rt1] = 0;
  root[rt1] = root[rt2];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  memset(tw, 0, sizeof(tw));
  memset(tb, 0, sizeof(tb));
  cin >> n >> m >> wt;
  init();
  for (long long i = 0; i < n; i++) cin >> w[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    merge(x, y);
  }
  memset(dp, 0, sizeof(dp));
  for (long long i = 0; i < n; i++) {
    long long rti = rt(i);
    adj[rti].push_back(i);
    tw[rti] += w[i];
    tb[rti] += b[i];
  }
  for (long long i = 0; i < n; i++) {
    if (i != 0) {
      for (long long j = 0; j <= wt; j++) dp[i][j] = dp[i - 1][j];
    }
    if (sz[i] != 0) {
      for (long long j = 0; j <= wt; j++) {
        if (j + tw[i] <= wt) {
          if (i - 1 >= 0)
            dp[i][j + tw[i]] = max(dp[i][j + tw[i]], dp[i - 1][j] + tb[i]);
          else
            dp[i][j + tw[i]] = max(dp[i][j + tw[i]], tb[i]);
        }
      }
      for (long long x : adj[i]) {
        for (long long j = 0; j <= wt; j++) {
          if (j + w[x] <= wt) {
            if (i - 1 >= 0)
              dp[i][j + w[x]] = max(dp[i][j + w[x]], dp[i - 1][j] + b[x]);
            else
              dp[i][j + w[x]] = max(dp[i][j + w[x]], b[x]);
          }
        }
      }
    } else {
      if (i != 0) {
        for (long long j = 0; j <= wt; j++) dp[i][j] = dp[i - 1][j];
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= wt; j++) ans = max(ans, dp[i][j]);
  }
  cout << ans << '\n';
  return 0;
}
