#include <bits/stdc++.h>
using namespace std;
vector<set<int> > scc;
vector<bool> visited(1003, false);
bool table[1003][1003];
vector<pair<long, long> > bw;
vector<vector<long int> > knap(1003, vector<long>(1003, -1));
vector<int> weight(1003);
vector<long> beauty(1003);
void dfs_util(int x, int n, set<int>& compo) {
  if (visited[x] == true) return;
  compo.insert(x);
  visited[x] = true;
  for (int z = 0; z < n; z++)
    if (table[x][z] == true && visited[z] == false) {
      dfs_util(z, n, compo);
    }
}
void dfs(int n) {
  int y;
  set<int> compo;
  long tb = 0, tw = 0;
  set<int>::iterator x;
  for (int i = 0; i < n; i++) {
    if (visited[i] == true) continue;
    dfs_util(i, n, compo);
    tb = 0;
    tw = 0;
    for (x = compo.begin(); x != compo.end(); x++) {
      tb += beauty[*x];
      tw += weight[*x];
    }
    bw.push_back(make_pair(tb, tw));
    scc.push_back(compo);
    compo.clear();
  }
}
long mtb(int w, int n) {
  if (knap[w][n] != -1) return knap[w][n];
  if (w <= 0) return knap[w][n] = 0;
  if (n <= 0) return knap[w][n] = 0;
  long max = 0;
  set<int>::iterator it;
  for (it = scc[n - 1].begin(); it != scc[n - 1].end(); it++) {
    if (w - weight[*it] >= 0) {
      long temp = beauty[*it] + mtb(w - weight[*it], n - 1);
      if (temp > max) max = temp;
    }
  }
  if (w - bw[n - 1].second >= 0) {
    long temp = bw[n - 1].first + mtb(w - bw[n - 1].second, n - 1);
    if (temp > max) max = temp;
  }
  long temp = mtb(w, n - 1);
  if (temp > max) max = temp;
  return knap[w][n] = max;
}
int main(void) {
  scc.reserve(1003);
  bw.reserve(1003);
  int n, w;
  long m;
  scanf("%d %ld %d", &n, &m, &w);
  for (int i = 0; i < n; i++) scanf("%d", &weight[i]);
  for (int i = 0; i < n; i++) cin >> beauty[i];
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) table[i][j] = false;
  for (long i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    table[a - 1][b - 1] = true;
    table[b - 1][a - 1] = true;
  }
  dfs(n);
  int size = scc.size();
  cout << mtb(w, size) << endl;
  return 0;
}
