#include <bits/stdc++.h>
using namespace std;
int vis[1100], wei[1100], n, m, w, val[1100];
long long dp[2][1100], temp[1100];
struct ooxx {
  int w;
  long long val;
} t[1100];
vector<ooxx> sta[1100];
vector<int> v[1100];
int tot = 0;
inline ooxx dfs(int x) {
  ooxx em, ret;
  ret.w = wei[x], ret.val = val[x];
  sta[tot].push_back(ret);
  em.w = em.val = 0;
  vis[x] = 1;
  for (int i = v[x].size() - 1; i >= 0; --i) {
    int to = v[x][i];
    if (vis[to]) continue;
    em = dfs(to);
    ret.w += em.w, ret.val += em.val;
  }
  return ret;
}
inline void add(int x, int y) { v[x].push_back(y); }
int main() {
  int x, y;
  scanf("%d%d%d", &n, &m, &w);
  for (int i = 1; i <= n; ++i) scanf("%d", &wei[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &val[i]);
  for (int i = 1; i <= m; ++i) scanf("%d%d", &x, &y), add(x, y), add(y, x);
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      tot++;
      sta[tot].push_back(dfs(i));
    }
  }
  int now = 1;
  memset(dp, -60, sizeof(dp));
  dp[1][0] = 0;
  for (int i = 1; i <= tot; ++i) {
    now ^= 1;
    for (int k = 0; k <= w; ++k) dp[now][k] = dp[now ^ 1][k];
    for (int j = sta[i].size() - 1; j >= 0; --j) {
      ooxx to = sta[i][j];
      for (int k = 0; k <= w; ++k) {
        if (k + to.w > w) break;
        temp[k + to.w] = dp[now ^ 1][k] + to.val;
      }
      for (int k = 0; k <= w; ++k) dp[now][k] = max(dp[now][k], temp[k]);
    }
  }
  long long ans = 0;
  for (int i = 0; i <= w; ++i) ans = max(ans, dp[now][i]);
  printf("%I64d", ans);
  return 0;
}
