#include <bits/stdc++.h>
using namespace std;
int o[1000000];
int w[1000000];
int b[1000000];
int w2[1000000];
int b2[1000000];
int f(int w) {
  if (o[w] == w) return w;
  return o[w] = f(o[w]);
}
bool uni(int x, int y) {
  x = f(x), y = f(y);
  if (x == y) return false;
  o[x] = y;
  return true;
}
vector<long long> gr[1000000];
int d[1000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, m, W;
  cin >> n >> m >> W;
  for (int i = 0; i < n; i++) o[i] = i;
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    uni(a, b);
  }
  for (int i = 0; i < n; i++) f(i);
  for (int i = 0; i < n; i++) {
    w2[o[i]] += w[i];
    b2[o[i]] += b[i];
    gr[o[i]].push_back(i);
  }
  for (int i = 0; i < n; i++)
    if (o[i] == i) {
      for (int j = W; j >= 0; j--) {
        int naj = d[j];
        if (j - w2[i] >= 0) naj = max(naj, d[j - w2[i]] + b2[i]);
        for (auto k : gr[i])
          if (j - w[k] >= 0) naj = max(naj, d[j - w[k]] + b[k]);
        d[j] = naj;
      }
    }
  for (int i = 0; i <= W; i++) d[0] = max(d[0], d[i]);
  cout << d[0] << endl;
  return 0;
}
