#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > colt[2020];
vector<int> v[2020];
int b[2020], w[2020], cost, n, m;
int col[2020], color, bt[2020], wt[2020];
long long dp[2020], fp[2020];
template <class T>
void chkmax(T &a, T b) {
  if (a < b) a = b;
}
void dfs(int x) {
  col[x] = true;
  bt[color] += b[x];
  wt[color] += w[x];
  colt[color].push_back(make_pair(w[x], b[x]));
  for (auto y : v[x])
    if (!col[y]) {
      dfs(y);
    }
}
int x, y;
int main() {
  scanf("%d %d %d", &n, &m, &cost);
  for (int i = 1; i <= n; i++) scanf("%d", w + i);
  for (int i = 1; i <= n; i++) scanf("%d", b + i);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (!col[i]) {
      ++color;
      dfs(i);
      colt[color].push_back(make_pair(wt[color], bt[color]));
    }
  for (int ct = 1; ct <= color; ct++) {
    for (int i = 0; i <= cost; i++) {
      for (auto tmp : colt[ct]) {
        if (i + tmp.first <= cost) {
          chkmax(dp[i + tmp.first], fp[i] + tmp.second);
        }
      }
    }
    for (int i = 0; i <= cost; i++) {
      fp[i] = dp[i];
    }
  }
  cout << dp[cost] << endl;
}
