#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
int w[1005];
int b[1005];
int vis[1005];
int n, m, tot;
std::vector<int> edge[1005];
std::vector<int> var[1005];
int part = 0;
void dfs(int u) {
  vis[u] = part;
  var[part].push_back(u);
  for (int i = 0; i < edge[u].size(); i++) {
    int v = edge[u][i];
    if (vis[v]) continue;
    dfs(v);
  }
}
int main() {
  cin >> n >> m >> tot;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      ++part;
      dfs(i);
    }
  }
  int dp[1005];
  memset(dp, 0, sizeof dp);
  int tmp[1005];
  memset(tmp, 0, sizeof tmp);
  for (int i = 1; i <= part; i++) {
    int tw = 0;
    int tb = 0;
    for (int j = 0; j < var[i].size(); j++) {
      int p = var[i][j];
      for (int k = tot; k >= w[p]; k--) {
        tmp[k] = max(tmp[k], dp[k - w[p]] + b[p]);
      }
      tw += w[p];
      tb += b[p];
    }
    for (int k = tot; k >= tw; k--) {
      tmp[k] = max(tmp[k], dp[k - tw] + tb);
    }
    for (int j = 0; j <= tot; j++) dp[j] = max(dp[j], tmp[j]);
  }
  int nmax = 0;
  for (int i = 0; i <= tot; i++) {
    nmax = max(nmax, dp[i]);
  }
  cout << nmax << endl;
  return 0;
}
