#include <bits/stdc++.h>
using namespace std;
int p[1005];
int w[1005];
int b[1005];
int f(int x) { return x == p[x] ? x : p[x] = f(p[x]); }
void init() {
  for (int i = 0; i < 1005; i++) {
    p[i] = i;
  }
}
long long bag[1005];
vector<int> friends[1005];
long long sumw[1005];
long long sumb[1005];
int main() {
  ios::sync_with_stdio(false);
  int n, m, maxw;
  cin >> n >> m >> maxw;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  init();
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    int pa = f(a), pb = f(b);
    if (pa != pb) p[pa] = pb;
  }
  for (int i = 1; i <= n; i++) {
    int t = f(i);
    friends[t].push_back(i);
    sumw[t] += w[i];
    sumb[t] += b[i];
  }
  for (int i = 1; i <= n; i++) {
    if (friends[i].empty()) continue;
    for (int j = 1; j <= maxw; j++) {
      if (bag[j] || j == maxw) {
        for (int k = 0; k < friends[i].size(); k++) {
          if (j - w[friends[i][k]] >= 0) {
            bag[j - w[friends[i][k]]] =
                max(bag[j - w[friends[i][k]]], bag[j] + b[friends[i][k]]);
          }
        }
        if (j - sumw[i] >= 0) {
          bag[j - sumw[i]] = max(bag[j - sumw[i]], bag[j] + sumb[i]);
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i <= maxw; i++) {
    if (bag[i]) {
      ans = max(ans, bag[i]);
    }
  }
  cout << ans << '\n';
  return 0;
}
