#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
const int MAXN = 1e5 + 5;
const int MAXM = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const ll LLINF = 2e18;
const ld EPS = 1e-9;
int m, n, k, ans, cnt, x, y, l, r;
string s;
int w[MAXN], b[MAXN], mx, used[MAXN];
vvi gr(MAXN);
vi comps[MAXN];
int sum;
int dp[1005][1005];
void dfs(int v) {
  used[v] = 1;
  comps[cnt].push_back(v);
  for (int to : gr[v]) {
    if (!used[to]) {
      dfs(to);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> mx;
  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 < m; i++) {
    cin >> x >> y;
    x--;
    y--;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      dfs(i);
      cnt++;
    }
  }
  for (int i = 0; i < cnt; i++) {
    for (int j = 1; j <= mx; j++) {
      int sum_w = 0, sum_b = 0;
      dp[i + 1][j] = dp[i][j];
      for (int k : comps[i]) {
        sum_w += w[k];
        sum_b += b[k];
        if (j >= w[k] && dp[i][j - w[k]] + b[k] > dp[i + 1][j]) {
          dp[i + 1][j] = dp[i][j - w[k]] + b[k];
        }
      }
      if (j >= sum_w && dp[i][j - sum_w] + sum_b > dp[i + 1][j]) {
        dp[i + 1][j] = dp[i][j - sum_w] + sum_b;
      }
    }
  }
  cout << dp[cnt][mx] << '\n';
  return 0;
}
