There is a tree with N vertices numbered 1 through N.
The i-th edge connects Vertex x_i and y_i.
Each vertex is painted white or black.
The initial color of Vertex i is represented by a letter c_i.
c_i = W represents the vertex is white; c_i = B represents the vertex is black.
A cat will walk along this tree.
More specifically, she performs one of the following in one second repeatedly:
 - Choose a vertex that is adjacent to the vertex where she is currently, and move to that vertex. Then, invert the color of the destination vertex.
 - Invert the color of the vertex where she is currently.
The cat's objective is to paint all the vertices black. She may start and end performing actions at any vertex.
At least how many seconds does it takes for the cat to achieve her objective?

-----Constraints-----
 - 1 ≤ N ≤ 10^5
 - 1 ≤ x_i,y_i ≤ N (1 ≤ i ≤ N-1)
 - The given graph is a tree.
 - c_i = W or c_i = B.

-----Input-----
Input is given from Standard Input in the following format:
N
x_1 y_1
x_2 y_2
:
x_{N-1} y_{N-1}
c_1c_2..c_N

-----Output-----
Print the minimum number of seconds required to achieve the objective.

-----Sample Input-----
5
1 2
2 3
2 4
4 5
WBBWW

-----Sample Output-----
5

The objective can be achieved in five seconds, for example, as follows:
 - Start at Vertex 1. Change the color of Vertex 1 to black.
 - Move to Vertex 2, then change the color of Vertex 2 to white.
 - Change the color of Vertex 2 to black.
 - Move to Vertex 4, then change the color of Vertex 4 to black.
 - Move to Vertex 5, then change the color of Vertex 5 to black.

```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 = "from collections import deque\n\n\ndef first_cut(links, colors):\n    tmp_links = links.copy()\n    for v, neighbors in list(tmp_links.items()):\n        while len(neighbors) == 1 and colors[v]:\n            del links[v]\n            par = neighbors.pop()\n            links[par].remove(v)\n            v = par\n            neighbors = links[par]\n    return links\n\n\ndef diameter(links, flags):\n    def dfs(s):\n        fs = flags[s]\n        d, v = 0, 0\n        q = deque(sorted((fs + flags[v], v, s) for v in links[s]))\n        while q:\n            d, v, a = q.popleft()\n            for u in links[v]:\n                if u == a:\n                    continue\n                fu = flags[u]\n                if fu:\n                    q.append((d + 1, u, v))\n                else:\n                    q.appendleft((d, u, v))\n        return d, v\n\n    s = next(iter(links))\n    _, t = dfs(s)\n    d, _ = dfs(t)\n    return d\n\n\ndef solve(links, colors):\n    if all(colors):\n        return 0\n\n    links = first_cut(links, colors)\n    k = len(links)\n\n    if k == 1:\n        return 1\n\n    flags = {v: colors[v] ^ (len(link) % 2 == 0) for v, link in list(links.items())}\n    euler_tour = 2 * (k - 1) + sum(flags.values())\n    return euler_tour - 2 * diameter(links, flags)\n\n\nn = int(input())\nlinks = {i: set() for i in range(n)}\nfor _ in range(n - 1):\n    x, y = list(map(int, input().split()))\n    x -= 1\n    y -= 1\n    links[x].add(y)\n    links[y].add(x)\ncolors = [c == 'B' for c in input()]\n\nprint((solve(links, colors)))\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14183