#include <bits/stdc++.h>
using namespace std;
int uf[100000];
long long vx[100000];
long long dx[100000];
int root(int i) { return (uf[i] < 0 ? i : uf[i] = root(uf[i])); }
void merge(int i, int j) {
  if ((i = root(i)) == (j = root(j))) return;
  if (i > j) swap(i, j);
  vx[j] += vx[i];
  dx[j] += dx[i];
  uf[i] = j;
  return;
}
int n;
int A[1000];
int B[1000];
int C[1000];
long long dp[1000][1001];
bool Cf(int i, int j) {
  if (root(i) == root(j)) return i < j;
  return root(i) < root(j);
}
long long f(int i, int w) {
  if (w < 0) return -1e9;
  if (i >= n) return 0;
  if (dp[i][w] > -1) return dp[i][w];
  return dp[i][w] =
             max(f(i + 1, w),
                 max(f(upper_bound(C, C + n, root(C[i]), Cf) - C, w - A[C[i]]) +
                         B[C[i]],
                     f(upper_bound(C, C + n, root(C[i]), Cf) - C,
                       w - vx[root(C[i])]) +
                         dx[root(C[i])]));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int m, w;
  cin >> n >> m >> w;
  memset(uf, -1, sizeof uf);
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; ++i) {
    cin >> vx[i];
    A[i] = vx[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> dx[i];
    B[i] = dx[i];
    C[i] = i;
  }
  int u, v;
  while (m--) {
    cin >> u >> v;
    merge(u - 1, v - 1);
  }
  sort(C, C + n, Cf);
  cout << f(0, w);
  return 0;
}
