Just to remind, girls in Arpa's land are really nice.

Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight w_{i} and some beauty b_{i}. Also each Hos may have some friends. Hoses are divided in some friendship groups. Two Hoses x and y are in the same friendship group if and only if there is a sequence of Hoses a_1, a_2, ..., a_{k} such that a_{i} and a_{i} + 1 are friends for each 1 ≤ i < k, and a_1 = x and a_{k} = y.

 [Image] 

Arpa allowed to use the amphitheater of palace to Mehrdad for this party. Arpa's amphitheater can hold at most w weight on it. 

Mehrdad is so greedy that he wants to invite some Hoses such that sum of their weights is not greater than w and sum of their beauties is as large as possible. Along with that, from each friendship group he can either invite all Hoses, or no more than one. Otherwise, some Hoses will be hurt. Find for Mehrdad the maximum possible total beauty of Hoses he can invite so that no one gets hurt and the total weight doesn't exceed w.


-----Input-----

The first line contains integers n, m and w (1  ≤  n  ≤  1000, $0 \leq m \leq \operatorname{min}(\frac{n \cdot(n - 1)}{2}, 10^{5})$, 1 ≤ w ≤ 1000) — the number of Hoses, the number of pair of friends and the maximum total weight of those who are invited.

The second line contains n integers w_1, w_2, ..., w_{n} (1 ≤ w_{i} ≤ 1000) — the weights of the Hoses.

The third line contains n integers b_1, b_2, ..., b_{n} (1 ≤ b_{i} ≤ 10^6) — the beauties of the Hoses.

The next m lines contain pairs of friends, the i-th of them contains two integers x_{i} and y_{i} (1 ≤ x_{i}, y_{i} ≤ n, x_{i} ≠ y_{i}), meaning that Hoses x_{i} and y_{i} are friends. Note that friendship is bidirectional. All pairs (x_{i}, y_{i}) are distinct.


-----Output-----

Print the maximum possible total beauty of Hoses Mehrdad can invite so that no one gets hurt and the total weight doesn't exceed w.


-----Examples-----
Input
3 1 5
3 2 5
2 4 2
1 2

Output
6

Input
4 2 11
2 4 6 6
6 4 2 1
1 2
2 3

Output
7



-----Note-----

In the first sample there are two friendship groups: Hoses {1, 2} and Hos {3}. The best way is to choose all of Hoses in the first group, sum of their weights is equal to 5 and sum of their beauty is 6.

In the second sample there are two friendship groups: Hoses {1, 2, 3} and Hos {4}. Mehrdad can't invite all the Hoses from the first group because their total weight is 12 > 11, thus the best way is to choose the first Hos from the first group and the only one from the second group. The total weight will be 8, and the total beauty will be 7.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def inp():\n    return [int(x) for x in input().split()]\n\n\ndef dfs(u, adj, visited, s, W, B):\n    visited[u] = True\n    total_w = W[u]\n    total_b = B[u]\n    s.append(u)\n    for v in adj[u]:\n        if not visited[v]:\n            w, b = dfs(v, adj, visited, s, W, B)\n            total_w += w\n            total_b += b\n    return total_w, total_b\n\n\ndef main():\n    n, m, w = inp()\n    W = inp()\n    B = inp()\n    adj = [[] for _ in range(n)]\n    for _ in range(m):\n        x, y = inp()\n        x -= 1\n        y -= 1\n        adj[x].append(y)\n        adj[y].append(x)\n    visited = [False] * n\n    f = [0] * (w + 1)\n    for i in range(n):\n        if visited[i]:\n            continue\n        s = []\n        total_w, total_b = dfs(i, adj, visited, s, W, B)\n        for j in range(w, -1, -1):\n            jw = j + total_w\n            if jw <= w:\n                f[jw] = max(f[jw], f[j] + total_b)\n            for v in s:\n                jw = j + W[v]\n                if jw <= w:\n                    f[jw] = max(f[jw], f[j] + B[v])\n    print(f[w])\n\n\ndef __starting_point():\n    main()\n\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15055