#include <bits/stdc++.h>
using namespace std;
int const N = 1001;
int n, m, W, t, dp[N][N];
pair<int, int> v[N], al[N];
vector<int> g[N], cmp[N];
bool vs[N];
void dfs(int u, int c) {
  vs[u] = true;
  al[c].first += v[u].first;
  al[c].second += v[u].second;
  cmp[c].push_back(u);
  for (auto i : g[u])
    if (!vs[i]) dfs(i, c);
}
int go(int cur, int cap) {
  if (cap > W) return -1e9;
  if (cur == t) return 0;
  int &ret = dp[cur][cap];
  if (~ret) return ret;
  ret =
      max(go(cur + 1, cap), go(cur + 1, cap + al[cur].first) + al[cur].second);
  for (auto i : cmp[cur])
    ret = max(ret, go(cur + 1, cap + v[i].first) + v[i].second);
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &W);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i].first);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i].second);
  for (int i = 0, u, v; i < m; ++i) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    if (!vs[i]) {
      dfs(i, t);
      ++t;
    }
  }
  memset(dp, -1, sizeof dp);
  printf("%d\n", go(0, 0));
}
