#include <bits/stdc++.h>
long long poww(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  assert(y >= 0);
  for (; y; y >>= 1) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
  }
  return res;
}
using namespace std;
struct guy {
  int nxti, wt, bi, pi, grpwt, grpb;
} g[1005];
int n, sz[1005], p[1005], dp[1005][1005], a[1005], b[1005];
int recur(int i, int W) {
  int ret = 0;
  if (i > n) return 0;
  if (i == n)
    if (g[i].wt <= W)
      return g[i].bi;
    else
      return 0;
  if (dp[i][W] != -1) return dp[i][W];
  ret = recur(i + 1, W);
  if (W >= g[i].wt) ret = max(recur(g[i].nxti, W - g[i].wt) + g[i].bi, ret);
  if (W >= g[i].grpwt)
    ret = max(ret, recur(g[i].nxti, W - g[i].grpwt) + g[i].grpb);
  return dp[i][W] = ret;
}
int find_p(int x) {
  if (p[x] != x) return p[x] = find_p(p[x]);
  return x;
}
void Union(int x, int y) {
  if (sz[x] > sz[y]) swap(x, y);
  sz[find_p(y)] += sz[find_p(x)];
  p[find_p(x)] = p[find_p(y)];
  return;
}
bool cmp(const guy &a, const guy &b) { return a.pi < b.pi; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int W, m, i, j, k;
  cin >> n >> m >> W;
  for (i = 1; i <= n; ++i) cin >> g[i].wt;
  for (i = 1; i <= n; ++i) cin >> g[i].bi;
  for (i = 0; i < 1005; ++i) p[i] = i, sz[i] = 1;
  int px, py;
  while (m--) {
    cin >> i >> j;
    px = find_p(i);
    py = find_p(j);
    if (px != py) Union(px, py);
  }
  for (i = 1; i < 1005; ++i) g[i].pi = find_p(i);
  sort(g + 1, g + n + 1, cmp);
  memset(dp, -1, sizeof dp);
  j = n + 1;
  for (i = n - 1; i > 0; --i) {
    if (g[i].pi != g[i + 1].pi) j = i + 1;
    g[i].nxti = j;
  }
  for (i = 1; i <= n; ++i) a[g[i].pi] += g[i].wt, b[g[i].pi] += g[i].bi;
  for (i = 1; i <= n; ++i) g[i].grpwt = a[g[i].pi], g[i].grpb = b[g[i].pi];
  cout << recur(1, W);
  return 0;
}
