#include <bits/stdc++.h>
using namespace std;
struct DisjointSetUnion {
  int n;
  int *par, *sz;
  DisjointSetUnion(int n) : n(n) {
    par = (int *)malloc(sizeof(int) * n);
    sz = (int *)malloc(sizeof(int) * n);
    reset();
  }
  void reset() {
    iota(par, par + n, 0);
    fill(sz, sz + n, 1);
  }
  int findSet(int u) { return par[u] = par[u] == u ? u : findSet(par[u]); }
  void mergeSet(int u, int v) {
    if (findSet(u) != findSet(v)) {
      sz[findSet(v)] += sz[findSet(u)];
      par[findSet(u)] = findSet(v);
    }
  }
};
const int MAXN = 1005;
DisjointSetUnion dsu(MAXN);
vector<int> g[MAXN];
int w_sum[MAXN];
int b_sum[MAXN];
int w[MAXN];
int b[MAXN];
int DP[MAXN][MAXN];
int dp(int u, int w) {
  if (u == 0) {
    return 0;
  }
  if (DP[u][w] != -1) {
    return DP[u][w];
  }
  int o1 = 0;
  if (w >= w_sum[u]) {
    o1 = b_sum[u] + dp(u - 1, w - w_sum[u]);
  }
  int o2 = dp(u - 1, w);
  for (auto x : g[u]) {
    if (w >= ::w[x]) {
      o2 = max(o2, b[x] + dp(u - 1, w - ::w[x]));
    }
  }
  return DP[u][w] = max(o1, o2);
}
int main() {
  memset(DP, -1, sizeof DP);
  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 u, v;
    scanf("%d %d", &u, &v);
    dsu.mergeSet(u, v);
  }
  for (int i = 1; i <= n; ++i) {
    int par = dsu.findSet(i);
    g[par].push_back(i);
    w_sum[par] += ::w[i];
    b_sum[par] += b[i];
  }
  memset(DP, -1, sizeof DP);
  printf("%d\n", dp(n, w));
}
