#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:216000000")
using namespace std;
const long long MAX = numeric_limits<long long>::max();
const long long MIN = numeric_limits<long long>::min();
const long long MOD = 1000000007;
ostream& operator<<(ostream& out, vector<int>& v) {
  for (int i = 0; i < v.size(); ++i) out << v[i] << " ";
  out << endl;
  return out;
}
vector<bool> used;
vector<vector<int>> g;
vector<int> q;
vector<int> component;
void dfs1(int v) {
  used[v] = true;
  for (int i = 0; i < g[v].size(); ++i)
    if (!used[g[v][i]]) dfs1(g[v][i]);
  q.push_back(v);
}
void dfs2(int v) {
  used[v] = true;
  component.push_back(v);
  for (int i = 0; i < g[v].size(); ++i)
    if (!used[g[v][i]]) dfs2(g[v][i]);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, W;
  cin >> n >> m >> W;
  vector<int> w(n);
  vector<int> b(n);
  for (int i = 0; i < n; ++i) {
    cin >> w[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  vector<vector<int>> components;
  g = vector<vector<int>>(n, vector<int>());
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  used = vector<bool>(n, false);
  for (int i = 0; i < n; ++i)
    if (!used[i]) dfs1(i);
  used = vector<bool>(n, false);
  for (int i = 0; i < n; ++i) {
    int v = q[n - 1 - i];
    if (!used[v]) {
      dfs2(v);
      components.push_back(component);
      component = vector<int>();
    }
  }
  vector<vector<long long>> d(components.size() + 1,
                              vector<long long>(W + 1, 0));
  for (int i = 1; i <= components.size(); ++i) {
    for (int j = 0; j <= W; ++j) {
      long long cur = d[i - 1][j];
      long long sumw = 0, sumb = 0;
      for (int com = 0; com < components[i - 1].size(); ++com) {
        long long curw = w[components[i - 1][com]];
        long long curb = b[components[i - 1][com]];
        if (j >= curw) cur = max(cur, d[i - 1][j - curw] + curb);
        sumw += curw;
        sumb += curb;
      }
      if (j >= sumw) cur = max(cur, d[i - 1][j - sumw] + sumb);
      d[i][j] = cur;
    }
  }
  cout << d.back().back();
}
