#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long dx[4] = {-1, 1, 0, 0};
const long long dy[4] = {0, 0, -1, 1};
const long long MAX = 1e3 + 30;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long n, m, ans, k, x, tot;
string second;
long long allw[MAX], allb[MAX], weight[MAX], beauty[MAX], vis[MAX];
long long dp[MAX][MAX];
vector<vector<long long> > g, friends;
vector<long long> cur;
int ind;
void dfs(int u) {
  if (vis[u]) return;
  cur.push_back(u);
  vis[u] = true;
  for (auto v : g[u]) dfs(v);
}
long long go(int i, int w) {
  if (i == ind) return 0;
  long long &ret = dp[i][w];
  if (~ret) return ret;
  long long a = 0, b = 0, c = 0;
  if (allw[i] + w <= tot) a = allb[i] + go(i + 1, w + allw[i]);
  b = go(i + 1, w);
  for (auto v : friends[i])
    if (weight[v] + w <= tot) c = max(c, beauty[v] + go(i + 1, weight[v] + w));
  return ret = max({a, b, c});
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> tot;
  g.clear();
  friends.clear();
  g.resize(n + 1);
  friends.resize(n + 1);
  for (int i = 0; i < n; i++) cin >> weight[i], vis[i] = false;
  for (int i = 0; i < n; i++) cin >> beauty[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  ind = 0;
  for (int i = 0; i < n; i++)
    if (!vis[i]) {
      cur.clear();
      dfs(i);
      allw[ind] = allb[ind] = 0;
      for (int j = 0; j < cur.size(); j++)
        friends[ind].push_back(cur[j]), allw[ind] += weight[cur[j]],
            allb[ind] += beauty[cur[j]];
      ind++;
    }
  for (int i = 0; i < MAX; i++)
    for (int j = 0; j < MAX; j++) dp[i][j] = -1;
  cout << go(0, 0);
  return 0;
}
