#include <bits/stdc++.h>
using namespace std;
int dp[1010], a[2010], b[2010], f[1010];
vector<int> v[1010];
int father(int x) {
  if (x != f[x]) f[x] = father(f[x]);
  return f[x];
}
int main() {
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) f[i] = i;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    f[father(x)] = father(y);
  }
  for (int i = 0; i < n; i++) v[father(i)].push_back(i);
  int tot = n;
  for (int i = 0; i < n; i++)
    if (v[i].size() > 1) {
      for (int j = 0; j < v[i].size(); j++) {
        a[tot] += a[v[i][j]];
        b[tot] += b[v[i][j]];
      }
      v[i].push_back(tot++);
    }
  for (int i = 0; i < n; i++) {
    for (int j = w; j > 0; j--) {
      for (int k = 0; k < v[i].size(); k++)
        if (j >= a[v[i][k]])
          dp[j] = max(dp[j], dp[j - a[v[i][k]]] + b[v[i][k]]);
    }
  }
  printf("%d\n", dp[w]);
  return 0;
}
