#include <bits/stdc++.h>
using namespace std;
float PHI = 1.6180339;
const float PI_F = 3.14159265358979f;
long long modpow(long long x, long long n, long long m) {
  if (n == 0) return 1 % m;
  long long u = modpow(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
long long add(long long x, long long y, long long m) {
  x += y;
  if (x >= m) return x - m;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + 1000000007;
  return x;
}
long long inv(long long a, long long m = 998244353) {
  return modpow(a, m - 2, m);
}
long long mul(long long a, long long b, long long m) {
  return (long long)a * b % m;
}
long long nCrModp(long long n, long long r, long long p) {
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
bool sortinrev(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.first > b.first);
}
vector<long long> z_function(string &s) {
  long long n = s.size();
  vector<long long> z(n);
  for (long long i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++;
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
const long long maxn = 1e4;
vector<long long> v[maxn + 10];
long long vis[maxn + 10];
vector<long long> ans[maxn + 10];
long long dp[maxn + 10];
void dfs(long long s, long long p) {
  vis[s] = 1;
  ans[p].push_back(s);
  for (long long i = 0; i < v[s].size(); i++) {
    if (vis[v[s][i]] == 0) {
      dfs(v[s][i], p);
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cout << fixed << setprecision(16);
  long long n, m, w;
  cin >> n >> m >> w;
  long long wt[n + 10];
  long long bt[n + 10];
  for (long long i = 1; i <= n; i++) {
    cin >> wt[i];
  }
  for (long long i = 1; i <= n; i++) {
    cin >> bt[i];
  }
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long p = 0;
  for (long long i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      dfs(i, p);
      ++p;
    }
  }
  vector<pair<long long, long long> > minwt;
  vector<pair<long long, long long> > maxbt;
  for (long long i = 0; i < p; i++) {
    for (long long j = w; j >= 1; j--) {
      long long fw = 0, fb = 0;
      for (long long k = 0; k < ans[i].size(); k++) {
        fw += wt[ans[i][k]];
        fb += bt[ans[i][k]];
        if (j >= wt[ans[i][k]]) {
          dp[j] = max(dp[j], dp[j - wt[ans[i][k]]] + bt[ans[i][k]]);
        }
      }
      if (j >= fw) {
        dp[j] = max(dp[j], dp[j - fw] + fb);
      }
    }
  }
  cout << dp[w] << "\n";
  return 0;
}
