#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long b, long long p, long long md) {
  if (p == 0) return 1;
  if (p % 2 == 1) {
    return ((b % md) * bigmod(b, p - 1, md)) % md;
  } else {
    long long y = bigmod(b, p / 2, md);
    return (y * y) % md;
  }
}
long long ww[1005];
long long beu[1005];
long long group[1005];
long long group_weight[1005];
long long group_beauty[1005];
long long n;
vector<int> v[1005], p;
bool vis[1005];
stack<int> stk;
int g = 0;
void dfs(int s) {
  vis[s] = true;
  stk.push(s);
  for (int now : v[s]) {
    if (vis[now] == true) continue;
    dfs(now);
  }
}
bool cmp(int a, int b) { return group[a] < group[b]; }
long long dp[1000][1010];
long long solve(long long pos, long long wt) {
  if (pos >= n) return 0;
  if (dp[pos][wt] != -1) return dp[pos][wt];
  long long curr_group = group[p[pos]];
  long long laagbe = group_weight[curr_group];
  long long lav_hobe = group_beauty[curr_group];
  long long res = 0;
  int nxt_group_pos = n;
  for (int i = pos + 1; i < n; i++) {
    if (group[p[i]] != curr_group) {
      nxt_group_pos = i;
      break;
    }
  }
  if (laagbe <= wt) {
    res = max(res, lav_hobe + solve(nxt_group_pos, wt - laagbe));
  }
  long long individual = p[pos];
  long long in_need = ww[individual];
  long long in_gain = beu[individual];
  if (in_need <= wt) {
    res = max(res, in_gain + solve(nxt_group_pos, wt - in_need));
  }
  res = max(res, solve(pos + 1, wt));
  dp[pos][wt] = res;
  return res;
}
int main() {
  long long m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) {
    cin >> ww[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> beu[i];
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == false) {
      ++g;
      dfs(i);
      while (stk.size()) {
        int now = stk.top();
        stk.pop();
        group[now] = g;
        group_beauty[g] += beu[now];
        group_weight[g] += ww[now];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    p.push_back(i);
  }
  sort(p.begin(), p.end(), cmp);
  memset(dp, -1, sizeof(dp));
  long long ans = solve(0, w);
  cout << ans << endl;
  return 0;
}
