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.

Examples

Input

5
1 2
2 3
2 4
4 5
WBBWW


Output

5


Input

6
3 1
4 5
2 6
6 1
3 4
WWBWBB


Output

7


Input

1
B


Output

0


Input

20
2 19
5 13
6 4
15 6
12 19
13 19
3 11
8 3
3 20
16 13
7 14
3 17
7 8
10 20
11 9
8 18
8 2
10 1
6 13
WBWBWBBWWWBBWWBBBBBW


Output

21
#include <bits/stdc++.h>

using namespace std;

vector<int> edge[100050];
int n;
char fuck[100050];
bool intree[100050];

void build(int pos,int lst)
{
	if(fuck[pos] == 'W') intree[pos] = 1;
	for(auto v : edge[pos])
		if(v != lst)
		{
			build(v,pos);
			intree[pos] |= intree[v];
		}
}

int deg[100050];
int val[100050];
int zj;
int dp1[100050];

void zhijing(int pos,int lst)
{
	dp1[pos] = val[pos];
	for(auto v : edge[pos])
	{
		if(v != lst && intree[v])
		{
			zhijing(v,pos);
			zj = max(zj,dp1[pos] + dp1[v]);
			dp1[pos] = max(dp1[pos],dp1[v] + val[pos]);
		}
	}
}

int main()
{
	scanf("%d",&n);
	for(int i = 1;i < n; ++ i)
	{
		int u,v; scanf("%d%d",&u,&v);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	scanf("%s",fuck + 1);
	bool flg = 0;
	for(int i = 1;i <= n; ++ i)
	{
		if(fuck[i] == 'W')
		{
			build(i,0);
			flg = 1;
			break;
		}
	}
	if(!flg)
	{
		printf("0\n");
		return 0;
	}
	int cnt = 0;
	for(int i = 1;i <= n; ++ i)
		if(intree[i])
			for(auto v : edge[i])
				if(intree[v])
				{
					deg[v] ++;
					cnt ++;
				}
	for(int i = 1;i <= n; ++ i)
		if(intree[i])
		{
			if(deg[i] % 2 == 1 && fuck[i] == 'B') cnt ++,val[i] = 2;
			else if(deg[i] % 2 == 0 && fuck[i] == 'W') cnt ++,val[i] = 2;
			else val[i] = 0;
		}
	for(int i = 1;i <= n; ++ i)
		if(intree[i])
		{
			zhijing(i,0);
			printf("%d\n",cnt - zj);
			return 0;
		}
}