#include <bits/stdc++.h>
using namespace std;
int n, m, k, p[1009];
int w[1009], b[1009];
int dp[1009][1009];
bool done[1009];
vector<int> arr, v[1009];
vector<pair<int, int> > num[1009];
int get(int node) {
  if (p[node] == node) return node;
  int x = get(p[node]);
  p[node] = x;
  return x;
}
void merge(int a, int b) {
  int A = get(a);
  int B = get(b);
  p[A] = B;
}
int bt(int id, int curr) {
  if (curr > k) return -1000000009;
  if (id == arr.size()) return 0;
  int &ret = dp[id][curr];
  if (ret != -1) return ret;
  ret = bt(id + 1, curr);
  int SUM1 = 0, SUM2 = 0;
  for (int i = 0; i < num[arr[id]].size(); i++) {
    int x = num[arr[id]][i].first;
    int y = num[arr[id]][i].second;
    ret = max(ret, bt(id + 1, curr + x) + y);
    SUM1 += x;
    SUM2 += y;
  }
  if (curr + SUM1 <= k) ret = max(ret, bt(id + 1, curr + SUM1) + SUM2);
  return ret;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) p[i] = i;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    merge(a, b);
  }
  for (int i = 0; i < n; i++) {
    int x = get(i);
    num[x].push_back({w[i], b[i]});
    if (!done[x]) arr.push_back(x);
    done[x] = 1;
  }
  memset(dp, -1, sizeof(dp));
  cout << bt(0, 0) << endl;
}
