#include <bits/stdc++.h>
using namespace std;
long long wts[1003];
long long bty[1003];
vector<int> adj[1003];
bool vis[1003];
bool vis2[1003];
long long ty[3003];
long long val[3003];
long long K[3003][1003];
int lim[2003];
long long wt, bt;
int cntr;
long long knapSack(int W, int n) {
  for (int i = 0; i <= n; i++) {
    for (int w = 0; w <= W; w++) {
      if (i == 0 || w == 0)
        K[i][w] = 0;
      else if (ty[i] <= w) {
        K[i][w] = max(val[i] + K[lim[i]][w - ty[i]], K[lim[i]][w]);
      } else
        K[i][w] = K[i - 1][w];
    }
    if (i > 0) {
      for (int w = 0; w <= W; w++) {
        K[i][w] = max(K[i][w], K[i - 1][w]);
      }
    }
  }
  return K[n][W];
}
int sz;
int init;
void dfs(int s) {
  wt += wts[s];
  bt += bty[s];
  vis[s] = true;
  sz++;
  for (int i = 0; i < adj[s].size(); i++) {
    int u = adj[s][i];
    if (!vis[u]) {
      dfs(u);
    }
  }
}
void dfs2(int s) {
  ++cntr;
  ty[cntr] = wts[s];
  val[cntr] = bty[s];
  lim[cntr] = init;
  vis2[s] = true;
  for (int i = 0; i < adj[s].size(); i++) {
    int u = adj[s][i];
    if (!vis2[u]) {
      dfs2(u);
    }
  }
}
int main() {
  int n, m, w;
  scanf("%d %d %d", &n, &m, &w);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &wts[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &bty[i]);
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      init = cntr;
      ++cntr;
      sz = 0;
      dfs(i);
      ty[cntr] = wt;
      val[cntr] = bt;
      lim[cntr] = init;
      wt = 0;
      bt = 0;
      if (sz > 1) {
        dfs2(i);
      }
    }
  }
  printf("%lld", knapSack(w, cntr));
  return 0;
}
