#include <bits/stdc++.h>
using namespace std;
struct HOS {
  int w, b, group;
} hos[2123];
vector<HOS> all;
int n;
int pd[2123][2123];
vector<int> groups[2123];
int p[2123];
int solve(int base_i, int i, int w) {
  int curr = base_i + i;
  if (w < 0) return -0x3f3f3f3f;
  if (curr == all.size()) return 0;
  if (w == 0) return 0;
  int &result = pd[curr][w];
  if (result != -1) return result;
  int base_next = base_i + groups[all[curr].group].size();
  assert(base_next != base_i);
  result = all[curr].b + solve(base_next, 0, w - all[curr].w);
  if (i + 1 == groups[all[curr].group].size()) {
    result = max(result, solve(base_next, 0, w));
  } else {
    result = max(result, solve(base_i, i + 1, w));
  }
  return result;
}
int findfy(int u) { return p[u] = (p[u] == u ? u : findfy(p[u])); }
void unify(int u, int v) {
  u = findfy(u);
  v = findfy(v);
  p[u] = v;
}
int main() {
  int m, w;
  cin >> n >> m >> w;
  for (int i = 0; i < 2123; ++i) p[i] = i;
  for (int i = 0; i < n; ++i) cin >> hos[i].w;
  for (int i = 0; i < n; ++i) cin >> hos[i].b;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    unify(x, y);
  }
  for (int i = 0; i < n; ++i) {
    groups[findfy(i)].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    HOS grouped = {0, 0, i};
    for (int p : groups[i]) {
      all.push_back({hos[p].w, hos[p].b, i});
      grouped = {grouped.w + hos[p].w, grouped.b + hos[p].b, i};
    }
    if (groups[i].size()) {
      all.push_back(grouped);
      groups[i].push_back(-1);
    }
  }
  memset(pd, -1, sizeof pd);
  cout << solve(0, 0, w) << endl;
  return 0;
}
