#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
const int maxm = 100010;
int n, m, ww;
int w[maxn], b[maxn];
vector<int> group[maxn];
int gpsumw[maxn], gpsumb[maxn];
int ppp = 1;
struct edge {
  int v, nxt;
} E[maxm * 2];
int p[maxn], eid = 0;
void init() {
  memset(p, -1, sizeof p);
  memset(gpsumw, 0, sizeof gpsumw);
  memset(gpsumb, 0, sizeof gpsumb);
  eid = 0;
}
void insert(int u, int v) {
  E[eid].v = v;
  E[eid].nxt = p[u];
  p[u] = eid++;
}
void insert2(int u, int v) {
  insert(u, v);
  insert(v, u);
}
bool vis[maxn];
void dfs(int u, int index) {
  vis[u] = true;
  group[index].push_back(u);
  gpsumw[index] += w[u];
  gpsumb[index] += b[u];
  for (int i = p[u]; ~i; i = E[i].nxt) {
    int v = E[i].v;
    if (!vis[v]) {
      dfs(v, index);
    }
  }
}
int dp[1000 * 1000 + 10];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> ww;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  init();
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    insert2(u, v);
  }
  memset(vis, 0, sizeof vis);
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i, ppp++);
    }
  }
  ppp--;
  memset(dp, 0, sizeof dp);
  for (int i = 1; i <= ppp; i++) {
    for (int j = ww; j >= 0; j--) {
      if (j >= gpsumw[i]) dp[j] = max(dp[j], dp[j - gpsumw[i]] + gpsumb[i]);
      for (int k = 0; k < group[i].size(); k++) {
        int vv = group[i][k];
        if (j >= w[vv]) dp[j] = max(dp[j], dp[j - w[vv]] + b[vv]);
      }
    }
  }
  cout << dp[ww] << endl;
  return 0;
}
