#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
struct FindMerge {
  int p[N], b[N], w[N];
  int n;
  FindMerge(int _n) {
    n = _n;
    for (int i = 1; i <= n; ++i) p[i] = i;
  }
  inline int find(int v) {
    if (v == p[v]) return v;
    return p[v] = find(p[v]);
  }
  void merge(int u, int v) {
    u = find(u);
    v = find(v);
    if (u == v) return;
    p[v] = u;
    b[u] += b[v];
    w[u] += w[v];
  }
};
int b[N], w[N];
int dp[N], tmp[N];
int main() {
  int n, m, max_w;
  scanf("%d%d%d", &n, &m, &max_w);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  FindMerge f(n);
  for (int i = 1; i <= n; ++i) {
    f.b[i] = b[i];
    f.w[i] = w[i];
  }
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    f.merge(x, y);
  }
  for (int i = 1; i <= n; ++i)
    if (f.find(i) == i) {
      vector<int> b1, w1;
      for (int j = 1; j <= n; ++j)
        if (f.find(j) == i) {
          b1.push_back(b[j]);
          w1.push_back(w[j]);
        }
      b1.push_back(f.b[i]);
      w1.push_back(f.w[i]);
      for (int j = 0; j < b1.size(); ++j) {
        for (int t = w1[j]; t <= max_w; ++t)
          tmp[t] = max(tmp[t], dp[t - w1[j]] + b1[j]);
      }
      for (int t = 0; t <= max_w; ++t) dp[t] = max(dp[t], tmp[t]);
    }
  printf("%d\n", dp[max_w]);
}
