#include <bits/stdc++.h>
using namespace std;
int a[1010];
int b[1010];
int c[1010];
vector<int> v[1010];
vector<int> g[1010];
int d[1010][1010];
void dfs(int x, int y) {
  g[y].push_back(x);
  c[x] = 1;
  for (int i = 0; i < v[x].size(); i++) {
    if (c[v[x][i]] == 0) dfs(v[x][i], y);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  int j = 1;
  for (int i = 1; i <= n; i++) {
    if (c[i] == 0) {
      dfs(i, j);
      j++;
    }
  }
  for (int i = 1; i < j; i++) {
    for (int k = 0; k < g[i].size(); k++) {
      for (int h = 0; h <= w; h++) {
        if (h + a[g[i][k]] <= w)
          d[i][h + a[g[i][k]]] =
              max(d[i][h + a[g[i][k]]], d[i - 1][h] + b[g[i][k]]);
      }
    }
    int s = 0, p = 0;
    for (int k = 0; k < g[i].size(); k++) {
      p += b[g[i][k]];
      s += a[g[i][k]];
    }
    for (int h = 0; h <= w; h++) {
      if (h + s <= w) d[i][h + s] = max(d[i][h + s], d[i - 1][h] + p);
    }
    for (int h = 0; h <= w; h++) d[i][h] = max(d[i][h], d[i - 1][h]);
  }
  cout << d[j - 1][w];
}
