#include <bits/stdc++.h>
const int maxn = 2000 + 10;
int b[maxn], w[maxn];
int vis[maxn];
int A[maxn][maxn];
int dp[maxn];
struct node {
  int w, b;
  node() {}
  node(int _w, int _b) {
    w = _w;
    b = _b;
  }
};
using namespace std;
int fa[maxn];
int Find(int x) { return x == fa[x] ? x : fa[x] = Find(fa[x]); }
int id[maxn];
void Union(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (x > y)
    fa[x] = y;
  else
    fa[y] = x;
}
void init(int n) {
  for (int i = 1; i <= n; i++) fa[i] = i, id[i] = i;
}
int main() {
  int n, m, W;
  while (~scanf("%d%d%d", &n, &m, &W)) {
    init(n);
    vector<node> p[maxn];
    for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
    for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= m; i++) {
      int l, r;
      scanf("%d%d", &l, &r);
      Union(l, r);
    }
    int cnt = n + 1;
    for (int i = 1; i <= n; i++) {
      int x = Find(i);
      if (x == i)
        id[x] = cnt++;
      else
        id[i] = id[x];
    }
    for (int i = 1; i <= n; i++) p[id[i]].push_back(node(w[i], b[i]));
    int sumw, sumb;
    for (int i = n + 1; i < cnt; i++) {
      sumw = sumb = 0;
      for (int j = 0; j < p[i].size() && (int)p[i].size() != 1; j++)
        sumw += p[i][j].w, sumb += p[i][j].b;
      p[i].push_back(node(sumw, sumb));
    }
    memset(dp, 0, sizeof(dp));
    for (int i = n + 1; i < cnt; i++) {
      for (int j = W; j >= 0; j--) {
        int len = p[i].size();
        if (p[i][len - 1].w <= j)
          dp[j] = max(dp[j], dp[j - p[i][len - 1].w] + p[i][len - 1].b);
        for (int k = 0; k < len - 1; k++)
          if (j >= p[i][k].w) dp[j] = max(dp[j], dp[j - p[i][k].w] + p[i][k].b);
      }
    }
    cout << dp[W] << endl;
  }
  return 0;
}
