#include <bits/stdc++.h>
using namespace std;
int tree[1005], dp[1005];
vector<int> group[1005];
int max(int x, int y) { return x > y ? x : y; }
int find(int x) {
  if (tree[x] == x) {
    return x;
  }
  return tree[x] = find(tree[x]);
}
void megre(int x, int y) {
  int x1 = find(x);
  int y1 = find(y);
  if (x1 != y1) {
    tree[x1] = y1;
  }
}
int main() {
  int n, m, wi, sw, sb;
  int w[1005], b[1005], x, y;
  cin >> n >> m >> wi;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= n; i++) {
    tree[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    megre(x, y);
  }
  for (int i = 0; i < 1005; i++) group[i].clear();
  for (int i = 1; i <= n; i++) group[find(i)].push_back(i);
  for (int i = 1; i <= n; i++) {
    if (find(i) != i) continue;
    for (int j = wi; j >= 0; j--) {
      sb = sw = 0;
      for (int k = 0; k < group[i].size(); k++) {
        int num = group[i][k];
        sw += w[num];
        sb += b[num];
        if (j >= w[num]) dp[j] = max(dp[j], dp[j - w[num]] + b[num]);
      }
      if (j >= sw) dp[j] = max(dp[j], dp[j - sw] + sb);
    }
  }
  cout << dp[wi];
  return 0;
}
