#include <bits/stdc++.h>
using namespace std;
int n, m, W;
int fa[1005];
int w[1005], b[1005];
long long dp[1005][1005];
vector<int> root[1005];
int af[1005];
int ZZ = 0;
bool flag[1005];
inline int find(int x) {
  if (x == fa[x]) return x;
  return fa[x] = find(fa[x]);
}
int main() {
  memset(dp, 0, sizeof(dp));
  scanf("%d%d%d", &n, &m, &W);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    fa[i] = i;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= m; i++) {
    int A, B;
    scanf("%d%d", &A, &B);
    int pa = find(A);
    int pb = find(B);
    fa[pa] = pb;
  }
  for (int i = 1; i <= n; i++) {
    int pa = find(i);
    if (flag[pa] == 0) {
      flag[pa] = 1;
      ZZ++;
      af[ZZ] = pa;
    }
    root[pa].push_back(i);
  }
  for (int i = 1; i <= ZZ; i++) {
    int pa = af[i];
    int lb = root[pa].size();
    int SA = 0;
    long long SB = 0;
    for (int j = 0; j < lb; j++) {
      int x = root[pa][j];
      SA += w[x];
      SB += b[x];
      for (int k = 0; k <= W; k++) {
        if (k - w[x] >= 0)
          dp[i][k] =
              max(max(dp[i - 1][k - w[x]] + b[x], dp[i - 1][k]), dp[i][k]);
        else
          dp[i][k] = max(dp[i][k], dp[i - 1][k]);
      }
    }
    for (int k = 0; k <= W; k++) {
      if (k - SA >= 0)
        dp[i][k] = max(max(dp[i - 1][k - SA] + SB, dp[i - 1][k]), dp[i][k]);
      else
        dp[i][k] = max(dp[i][k], dp[i - 1][k]);
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= W; j++) ans = max(ans, dp[i][j]);
  printf("%I64d\n", ans);
  return 0;
}
