#include <bits/stdc++.h>
using namespace std;
int w[1111], b[1111];
int dp[1111], olddp[1111];
vector<int> g[1111];
bool viz[1111];
vector<int> tempvals;
void dfs(int x) {
  viz[x] = true;
  tempvals.push_back(x);
  int n = g[x].size();
  for (int i = 0; i < n; ++i) {
    int to = g[x][i];
    if (viz[to] == true) continue;
    dfs(to);
  }
}
int main() {
  int N, M, W;
  scanf("%d %d %d", &N, &M, &W);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &w[i]);
  }
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &b[i]);
  }
  for (int i = 0; i < M; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 1; i <= N; ++i) {
    if (viz[i] == true) continue;
    tempvals.clear();
    dfs(i);
    int n = tempvals.size(), sumaw = 0, sumab = 0;
    for (int j = 0; j < n; ++j) {
      int v = tempvals[j];
      sumaw += w[v];
      sumab += b[v];
      for (int k = w[v]; k <= W; ++k) {
        dp[k] = ((dp[k]) > (olddp[k - w[v]] + b[v]) ? (dp[k])
                                                    : (olddp[k - w[v]] + b[v]));
      }
    }
    for (int k = sumaw; k <= W; ++k) {
      dp[k] =
          ((dp[k]) > (olddp[k - sumaw] + sumab) ? (dp[k])
                                                : (olddp[k - sumaw] + sumab));
    }
    for (int k = 0; k <= W; ++k) olddp[k] = dp[k];
  }
  printf("%d", dp[W]);
  return 0;
}
