#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using lli = long long int;
using iii = tuple<int, int, int>;
using iiii = tuple<int, int, int, int>;
using ulli = unsigned long long int;
using ui = unsigned int;
using Bit = bitset<30>;
const int maxBit = 30;
const int maxN = 3e5;
const int block = 600;
const int cBlocks = maxN / block;
const int C = 1e3;
const int maxM = 2e5;
const int maxl = 18;
const int inf = 0x3f3f3f3f;
const lli INF = 0x3f3f3f3f3f3f3f3f;
const char sp = ' ';
const char dl = '\n';
const int mod = 998244353;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int test = 1;
  while (test--) {
    int n, m, W;
    cin >> n >> m >> W;
    vector<int> w(n + 1), b(n + 1);
    for (int i = 1; i <= n; i++) cin >> w[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    vector<vector<int>> Adj(n + 1);
    for (int i = 1; i <= m; i++) {
      int u, v;
      cin >> u >> v;
      Adj[u].push_back(v);
      Adj[v].push_back(u);
    }
    vector<bool> visited(n + 1);
    vector<vector<int>> Connected_Component(1);
    function<void(int)> DFS = [&](int u) {
      visited[u] = true;
      Connected_Component.back().push_back(u);
      for (int v : Adj[u])
        if (!visited[v]) DFS(v);
      return;
    };
    for (int i = 1; i <= n; i++)
      if (!visited[i]) {
        Connected_Component.push_back({});
        DFS(i);
      }
    vector<vector<int>> f(Connected_Component.size(), vector<int>(W + 1, -inf));
    f[0][0] = 0;
    for (int i = 1; i < Connected_Component.size(); i++) {
      for (int j = 0; j <= W; j++) {
        int sw = 0, sb = 0;
        f[i][j] = f[i - 1][j];
        for (int k : Connected_Component[i]) {
          sw += w[k];
          sb += b[k];
          if (j >= w[k]) f[i][j] = max(f[i][j], f[i - 1][j - w[k]] + b[k]);
        }
        if (j >= sw) f[i][j] = max(f[i][j], f[i - 1][j - sw] + sb);
      }
    }
    int res = -inf;
    for (int i = 0; i <= W; i++)
      res = max(res, f[((int)Connected_Component.size()) - 1][i]);
    cout << res;
  }
  return 0;
}
