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 = 'import sys\nfrom collections import deque\n\ninput=sys.stdin.readline\n\nN=int(input())\nedge=[[] for i in range(N)]\nfor i in range(N-1):\n    x,y=list(map(int,input().split()))\n    edge[x-1].append(y-1)\n    edge[y-1].append(x-1)\n\nc=input()[:N]\n\ndeg=[len(edge[i]) for i in range(N)]\nleaf=set([])\nfor i in range(N):\n    if deg[i]==1 and c[i]=="B":\n        leaf.add(i)\n\nban=set([])\nwhile leaf:\n    v=leaf.pop()\n    ban.add(v)\n    deg[v]=0\n    for nv in edge[v]:\n        deg[nv]-=1\n        if deg[nv]==1 and c[nv]=="B":\n            leaf.add(nv)\n\nfor i in range(N):\n    edge[i]=[nv for nv in edge[i] if nv not in ban]\n\nroot=-1\nfor i in range(N):\n    if i not in ban:\n        root=i\n\nparent=[-2]*N\ndeq=deque([(root,-1)])\nnode=[]\nwhile deq:\n    v,pv=deq.popleft()\n    parent[v]=pv\n    node.append(v)\n    for nv in edge[v]:\n        if nv!=pv:\n            deq.append((nv,v))\n\nnode=node[::-1]\n\nfor i in range(N):\n    edge[i]=[nv for nv in edge[i] if nv!=parent[i]]\n\ncheck=True\nfor i in range(N):\n    check&=(deg[i]<=0)\nif check:\n    print((int(c[root]=="W")))\n    return\n\ncond=[0]*N\nfor v in range(N):\n    if (deg[v]%2==1 and c[v]=="B") or (deg[v]%2==0 and c[v]=="W"):\n        cond[v]+=1\n    else:\n        cond[v]-=1\n\nlower=[0]*N\nfor v in node:\n    res=0\n    for nv in edge[v]:\n        res=max(res,lower[nv])\n    res+=1+cond[v]\n    lower[v]=res\n\nupper=[0]*N\nnode=node[::-1]\nfor v in node:\n    n=len(edge[v])\n    if n>1:\n        left=[0]*n\n        right=[0]*n\n        for i in range(n-1):\n            nv=edge[v][i]\n            left[i]=max(left[i-1],lower[nv]+2+cond[v])\n        nv=edge[v][-1]\n        upper[nv]=left[n-2]+cond[nv]\n        right[n-1]=lower[nv]+2+cond[v]\n        for i in range(n-2,0,-1):\n            nv=edge[v][i]\n            upper[nv]=max(left[i-1],right[i+1])+cond[nv]\n            right[i]=max(right[i+1],lower[nv]+2+cond[v])\n        if edge[v][0]!=pv:\n            nv=edge[v][0]\n            upper[nv]=right[1]+cond[nv]\n    if v!=root:\n        for nv in edge[v]:\n            upper[nv]=max(upper[nv],upper[v]+1+cond[nv])\n\nbase=sum(deg[i] for i in range(N))+sum(cond[i]==1 for i in range(N))\n#print(deg)\n#print(base)\n#print(lower)\n#print(upper)\n#print(base)\nprint((base-max(max(upper),max(lower))))\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: