#include <bits/stdc++.h>
using namespace std;
int n;
int gw[1001];
int gb[1001];
int maxW;
vector<int> groups[1001];
void dfs(int v, vector<bool>& used, const vector<vector<int>>& edges, int g) {
  groups[g].push_back(v);
  used[v] = true;
  for (int e : edges[v]) {
    if (!used[e]) dfs(e, used, edges, g);
  }
}
int main() {
  cin.sync_with_stdio(0);
  int m;
  cin >> n >> m >> maxW;
  for (int i = 0; i < n; i++) {
    cin >> gw[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> gb[i];
  }
  vector<vector<int>> edges(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a;
    cin >> b;
    a--;
    b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  vector<bool> used(n, false);
  int group = 0;
  for (int i = 0; i < n; i++) {
    if (used[i]) continue;
    dfs(i, used, edges, group);
    group++;
  }
  vector<int> dyn(maxW + 1, 0);
  int bestAns = 0;
  for (int g = 0; g < group; g++) {
    for (int w = maxW; w >= 0; w--) {
      if (w > 0 && dyn[w] == 0) continue;
      int totalW = 0;
      int totalB = 0;
      for (int j : groups[g]) {
        totalW += gw[j];
        totalB += gb[j];
        if (w + gw[j] > maxW) continue;
        dyn[w + gw[j]] = max(dyn[w + gw[j]], dyn[w] + gb[j]);
        bestAns = max(bestAns, dyn[w + gw[j]]);
      }
      if (totalW + w <= maxW) {
        dyn[totalW + w] = max(dyn[totalW + w], dyn[w] + totalB);
        bestAns = max(bestAns, dyn[totalW + w]);
      }
    }
  }
  cout << bestAns << endl;
  return 0;
}
