#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
vector<int> g[maxn];
bool mark[maxn];
int dp[maxn][maxn], w[maxn], b[maxn], weight[maxn], beauty[maxn];
int n, m, wt, c;
void dfs(int v, vector<int> &comp) {
  mark[v] = 1;
  weight[c] += w[v];
  beauty[c] += b[v];
  comp.push_back(v);
  for (auto u : g[v])
    if (!mark[u]) dfs(u, comp);
}
int main() {
  cin >> n >> m >> wt;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  int i, ii, j;
  for (i = 1; i <= n; i++) {
    if (mark[i]) continue;
    vector<int> comp;
    c++;
    dfs(i, comp);
    for (ii = 1; ii <= wt; ii++) {
      for (j = 0; j < comp.size(); j++) {
        if (w[comp[j]] <= ii)
          dp[c][ii] = max(dp[c][ii], dp[c - 1][ii - w[comp[j]]] + b[comp[j]]);
        else
          dp[c][ii] = max(dp[c][ii], dp[c - 1][ii]);
      }
      dp[c][ii] = max(dp[c][ii], dp[c - 1][ii]);
      if (weight[c] <= ii)
        dp[c][ii] = max(dp[c][ii], dp[c - 1][ii - weight[c]] + beauty[c]);
    }
  }
  cout << dp[c][wt] << endl;
  return 0;
}
