#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 5005;
int Link[kMaxN];
int B[kMaxN], W[kMaxN];
vector<int> Buck[kMaxN];
int Find(int x) {
  if (Link[x]) return Link[x] = Find(Link[x]);
  return x;
}
void Union(int a, int b) {
  a = Find(a);
  b = Find(b);
  if (a != b) Link[a] = b;
}
int DP[kMaxN], Ant[kMaxN];
int main() {
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; ++i) cin >> W[i];
  for (int i = 1; i <= n; ++i) cin >> B[i];
  while (m--) {
    int a, b;
    cin >> a >> b;
    Union(a, b);
  }
  for (int i = 1; i <= n; ++i) {
    Buck[Find(i)].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    int sw = 0, sb = 0;
    for (auto x : Buck[i]) {
      sw += W[x];
      sb += B[x];
    }
    for (int j = 1; j <= w; ++j) {
      DP[j] = Ant[j];
      if (j >= sw) DP[j] = max(DP[j], Ant[j - sw] + sb);
      for (auto x : Buck[i]) {
        if (j >= W[x]) DP[j] = max(DP[j], Ant[j - W[x]] + B[x]);
      }
    }
    swap(DP, Ant);
  }
  int ans = 0;
  for (int i = 1; i <= w; ++i) ans = max(ans, Ant[i]);
  cout << ans << endl;
  return 0;
}
