#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
const long long mod = 1e9 + 7;
const int alphabet = 26;
const int inf = INT_MAX;
const long long linf = 1e18 + 9;
inline long long cnm(char ch) { return (ch - '0'); }
inline long long cap(char ch) { return (ch - 'a'); }
inline void instr(string& s, long long& n) {
  cin >> s;
  n = s.length();
}
inline void instr(string& s) { cin >> s; }
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long maxw;
bool vis[maxn], visited[maxn][maxn];
vector<long long> g[maxn];
long long n, m, cnt = 0, totw, totb;
long long w[maxn], b[maxn], wcomp[maxn], bcomp[maxn];
long long dp[maxn][maxn];
vector<long long> comp[maxn];
void dfs(long long node) {
  if (vis[node]) return;
  totw += w[node];
  totb += b[node];
  comp[cnt].push_back(node);
  vis[node] = true;
  for (auto it : g[node]) {
    dfs(it);
  }
}
long long f(long long i, long long wt) {
  if (wt > maxw) return INT_MIN;
  if (i == cnt + 1) return 0;
  if (visited[i][wt]) return dp[i][wt];
  visited[i][wt] = 1;
  dp[i][wt] = f(i + 1, wt);
  dp[i][wt] = max(dp[i][wt], bcomp[i] + f(i + 1, wt + wcomp[i]));
  for (auto it : comp[i]) {
    dp[i][wt] = max(dp[i][wt], b[it] + f(i + 1, wt + w[it]));
  }
  return dp[i][wt];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, t = 1;
  cin >> n >> m >> maxw;
  for (i = 1; i <= n; i++) cin >> w[i];
  for (i = 1; i <= n; i++) cin >> b[i];
  for (i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (!vis[i]) {
      cnt++;
      totw = 0;
      totb = 0;
      dfs(i);
      wcomp[cnt] = totw;
      bcomp[cnt] = totb;
    }
  }
  long long ans = f(1, 0);
  cout << ans;
  return 0;
}
