#include <bits/stdc++.h>
using namespace std;
const long long N = 2e3;
long long a[N], b[N], pa[N];
long long d[N][N];
vector<long long> ke[N];
vector<pair<long long, long long> > t;
vector<vector<pair<long long, long long> > > q;
void dfs(long long u) {
  pa[u] = 1;
  long long v;
  t.push_back(pair<long long, long long>(a[u], b[u]));
  a[0] += a[u];
  b[0] += b[u];
  for (__typeof((ke[u]).begin()) it = (ke[u]).begin(); it != (ke[u]).end();
       it++)
    if ((v = *it) && !pa[v]) {
      dfs(v);
    }
}
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  for (long long i = (long long)1; i <= (long long)n; i++) cin >> a[i];
  for (long long i = (long long)1; i <= (long long)n; i++) cin >> b[i];
  for (long long i = (long long)1; i <= (long long)m; i++) {
    long long first, second;
    cin >> first >> second;
    ke[first].push_back(second);
    ke[second].push_back(first);
  }
  for (long long i = (long long)1; i <= (long long)n; i++)
    if (!pa[i]) {
      t.clear();
      a[0] = b[0] = 0;
      dfs(i);
      t.push_back(pair<long long, long long>(a[0], b[0]));
      q.push_back(t);
    }
  m = k;
  for (long long i = (long long)1; i <= (long long)q.size(); i++)
    for (long long j = (long long)0; j <= (long long)m; j++) {
      d[i][j] = d[i - 1][j];
      for (long long k = (long long)0; k <= (long long)q[i - 1].size() - 1; k++)
        if (j - q[i - 1][k].first >= 0) {
          d[i][j] = max(d[i - 1][j - q[i - 1][k].first] + q[i - 1][k].second,
                        d[i][j]);
        }
    }
  cout << d[q.size()][m] << " ";
  ;
}
