#include <bits/stdc++.h>
using namespace std;
long long int w[1010];
long long int b[1010];
vector<int> g[1010];
bool vis[1005];
long long int n, tot, e;
long long int dp[1005][1005];
vector<pair<long long int, long long int> > vec[1010];
int hi, kk;
void dfs(int u) {
  vis[u] = 1;
  vec[kk].push_back(make_pair(w[u], b[u]));
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (vis[v] == 0) {
      dfs(v);
    }
  }
  return;
}
long long int func(long long int ind, long long int ww) {
  if (ind >= hi || ww <= 0) return 0;
  long long int &ret = dp[ind][ww];
  if (ret != -1) return ret;
  ret = func(ind + 1, ww);
  int len = vec[ind].size();
  long long int weight = 0;
  long long int beauty = 0;
  for (int i = 0; i < len; i++) {
    long long int p = vec[ind][i].first;
    long long int q = vec[ind][i].second;
    weight += p;
    beauty += q;
    if (ww - p >= 0) {
      ret = max(ret, func(ind + 1, ww - p) + q);
    }
  }
  if (ww - weight >= 0) {
    ret = max(ret, func(ind + 1, ww - weight) + beauty);
  }
  return ret;
}
int main() {
  long long int u, v, aa, bb;
  scanf("%lld %lld %lld", &n, &e, &tot);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &w[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &b[i]);
  }
  for (int i = 0; i < e; i++) {
    scanf("%lld %lld", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  memset(vis, 0, sizeof(vis));
  kk = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      dfs(i);
      kk++;
    }
  }
  memset(dp, -1, sizeof(dp));
  hi = kk;
  long long int ret = func(0, tot);
  cout << ret << endl;
  return 0;
}
