#include <bits/stdc++.h>
using namespace std;
const long long MILLER_RABIN = 3215031751;
const long double PI = acos(-1);
struct config_io {
  config_io() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
  }
} cnf_io;
inline void tobin(long long x) { cout << bitset<63>(x) << endl; }
template <class T>
inline void trace(T collection) {
  for (auto elem : collection) {
    cout << elem << " ";
  }
  cout << endl;
}
const int ML = 1e3 + 10;
vector<vector<int>> g(ML);
vector<int> comp(ML, -1);
vector<int> cc[ML];
void dfs(int v, int c) {
  comp[v] = c;
  cc[c].push_back(v);
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int to = g[v][i];
    if (comp[to] == -1) {
      dfs(to, c);
    }
  }
}
void make_test() {
  srand(time(NULL));
  int n = 1000, m = 100000, w = 999;
  cout << n << " " << m << " " << w << endl;
  for (int i = 0; i < (int)n; ++i) cout << rand() % (w + 1) << " ";
  cout << endl;
  for (int i = 0; i < (int)n; ++i) cout << rand() % (w + 1) << " ";
  cout << endl;
  for (int i = 0; i < (int)m; ++i) {
    cout << 1 + (rand() % (n)) << " " << 1 + (rand() % (n)) << endl;
  }
}
void solve(int test) {
  int n, m, W;
  cin >> n >> m >> W;
  vector<int> w(n), b(n);
  for (int i = 0; i < (int)n; ++i) cin >> w[i];
  for (int i = 0; i < (int)n; ++i) cin >> b[i];
  for (int i = 0; i < (int)m; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int cnt = 0;
  for (int i = 0; i < (int)n; ++i) {
    if (comp[i] == -1) {
      dfs(i, cnt);
      ++cnt;
    }
  }
  vector<long long> compw(cnt, 0), compb(cnt, 0);
  for (int i = 0; i < (int)cnt; ++i) {
    for (int j = 0; j < (int)cc[i].size(); ++j) {
      compw[i] += w[cc[i][j]];
      compb[i] += b[cc[i][j]];
    }
  }
  vector<vector<long long>> dp(cnt, vector<long long>(ML, 0));
  for (int i = 0; i < (int)cc[0].size(); ++i)
    dp[0][w[cc[0][i]]] = max(dp[0][w[cc[0][i]]], (long long)b[cc[0][i]]);
  if (compw[0] < ML) dp[0][compw[0]] = max(dp[0][compw[0]], compb[0]);
  for (int i = 1; i < (int)cnt; ++i) {
    for (int ww = 0; ww < (int)ML; ++ww) dp[i][ww] = dp[i - 1][ww];
    for (int j = 0; j < (int)cc[i].size(); ++j) {
      int cur = cc[i][j];
      for (int ww = 0; ww < (int)ML; ++ww) {
        if (ww - w[cur] < 0) continue;
        dp[i][ww] = max(dp[i][ww], dp[i - 1][ww - w[cur]] + b[cur]);
      }
    }
    for (int ww = 0; ww < (int)ML; ++ww) {
      if (ww - compw[i] < 0) continue;
      dp[i][ww] = max(dp[i][ww], dp[i - 1][ww - compw[i]] + compb[i]);
    }
  }
  long long ans = 0;
  for (int ww = 0; ww < (int)W + 1; ++ww) ans = max(ans, dp[cnt - 1][ww]);
  cout << ans << endl;
}
int main() {
  int tests = 1;
  for (int test = 1; test <= tests; ++test) {
    solve(test);
  }
  return 0;
}
