#include <bits/stdc++.h>
long long gcd_(long long a, long long b) { return b ? gcd_(b, a % b) : a; }
long long lcm_(long long a, long long b) { return a / gcd_(a, b) * b; }
const long long INT_INF = 0x3f3f3f3f;
const long long INT_M_INF = 0x7f7f7f7f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const long long LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const long long dr[] = {0, 0, -1, 1};
const long long dc[] = {-1, 1, 0, 0};
const long long MOD = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-8;
const long long MAXN = 100000 + 10;
const long long MAXT = 10000 + 10;
using namespace std;
long long n, m, W;
long long w[1005], b[1005], vis[1005];
vector<long long> v[1005];
long long tp1, tp2;
long long p = 0;
vector<pair<long long, long long>> vv[1005];
void dfs(long long x) {
  for (long long i = 0; i < v[x].size(); i++) {
    long long tp = v[x][i];
    if (vis[tp] == 0) {
      vis[tp] = 1;
      vv[p].push_back({w[tp], b[tp]});
      tp1 += w[tp];
      tp2 += b[tp];
      dfs(tp);
    }
  }
}
long long dp[1005];
int32_t main() {
  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 = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (long long i = 1; i <= n; i++) {
    tp1 = 0;
    tp2 = 0;
    if (vis[i] == 0) {
      vis[i] = 1;
      vv[++p].push_back({w[i], b[i]});
      dfs(i);
      tp1 += w[i];
      tp2 += b[i];
      vv[p].push_back({tp1, tp2});
    }
  }
  for (long long i = 1; i <= p; i++) {
    for (long long j = W; j >= 0; j--) {
      for (long long x = 0; x < vv[i].size(); x++) {
        if (j >= vv[i][x].first)
          dp[j] = max(dp[j - vv[i][x].first] + vv[i][x].second, dp[j]);
      }
    }
  }
  cout << dp[W] << endl;
}
