#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
vector<int> g[N];
int dp[N][N];
int n, m, bound;
int b[N], w[N];
int weight[N], beauty[N];
int in[N], k;
bool mark[N];
int aux[N], sol;
void dfs(int v) {
  mark[v] = true;
  in[v] = k;
  beauty[k] += b[v];
  weight[k] += w[v];
  for (int xt : g[v]) {
    if (!mark[xt]) dfs(xt);
  }
}
bool cmp(int p, int q) {
  if (in[p] == in[q]) {
    if (b[p] == b[q]) return w[p] < w[q];
    return b[p] > b[q];
  }
  return in[p] < in[q];
}
int main() {
  scanf("%d%d%d", &n, &m, &bound);
  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 a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      k++;
      dfs(i);
    }
  }
  for (int i = 1; i <= n; i++) aux[i] = i;
  sort(aux + 1, aux + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    int group = in[aux[i]];
    for (int j = 0; j <= bound; j++)
      dp[group][j] = max(dp[group][j], dp[group - 1][j]);
    for (int j = 0; j <= bound; j++) {
      if (j - w[aux[i]] >= 0)
        dp[group][j] =
            max(dp[group][j], dp[group - 1][j - w[aux[i]]] + b[aux[i]]);
      if (j - weight[group] >= 0)
        dp[group][j] =
            max(dp[group][j], dp[group - 1][j - weight[group]] + beauty[group]);
      sol = max(sol, dp[group][j]);
    }
  }
  cout << sol;
  return 0;
}
