#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
const long double two = 2;
const long double INF = 2e18 + 100;
const int MOD = 998244353;
const int MOD1 = 1e9 + 7;
const int N = 1010;
const int nul = 0;
const int SIZE = 1e6 * 3;
vector<vector<int> > gr;
vector<int> used, ww, b;
vector<vector<int> > comp;
void dfs(int v, int ind) {
  comp[ind].push_back(v);
  used[v] = 1;
  for (int u : gr[v]) {
    if (used[u] == 0) dfs(u, ind);
  }
}
int dp[N][N];
signed main() {
  int n, m, we;
  cin >> n >> m >> we;
  gr.resize(n);
  used.resize(n);
  ww = b = used;
  for (int &i : ww) cin >> i;
  for (int &i : b) cin >> i;
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    v--;
    u--;
    gr[v].push_back(u);
    gr[u].push_back(v);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (used[i] == 0) {
      comp.push_back({});
      dfs(i, cnt);
      cnt++;
    }
  }
  vector<int> sumW(cnt), sumB(cnt);
  for (int i = 0; i < cnt; i++) {
    for (int j : comp[i]) {
      sumW[i] += ww[j];
      sumB[i] += b[j];
    }
  }
  int ans = 0;
  for (int i = 1; i <= cnt; i++) {
    for (int w = 1; w <= we; w++) {
      dp[i][w] = max(dp[i][w], dp[i - 1][w]);
      if (sumW[i - 1] <= w) {
        dp[i][w] = max(dp[i][w], dp[i - 1][w - sumW[i - 1]] + sumB[i - 1]);
      }
      for (int j : comp[i - 1]) {
        if (ww[j] <= w) {
          dp[i][w] = max(dp[i][w], dp[i - 1][w - ww[j]] + b[j]);
        }
      }
      ans = max(ans, dp[i][w]);
    }
  }
  cout << ans << endl;
}
