extern "C"
{
	int scanf(const char *, ...);
	int printf(const char *, ...);
}
inline void cmax(int &x, int y)
{
	if (y > x)
		x = y;
}
inline void cmax(int &x, int &y, int z)
{
	if (z > x)
		y = x, x = z;
	else if (z > y)
		y = z;
}
inline bool all_of(char *l, char *r, auto condition)
{
	while (l != r)
	{
		if (!condition(*l))
			return false;
		l++;
	}
	return true;
}
inline int max(int x, int y)
{
	return x > y ? x : y;
}
inline int abs(int x)
{
	return x < 0 ? -x : x;
}
typedef int ixn[200001];
typedef int ixe[399999];
int N, E;
ixn head, f0, f1, g, q, fa;
ixe next, to;
char s[200002];
long long O;
void BFS()
{
	int H = 0, T = 1, u;
	q[1] = 1;
	while (H < T)
		for (int e = head[u = q[++H]]; e; e = next[e])
			if (to[e] != fa[u])
				fa[q[++T] = to[e]] = u;
	for (int i = N; i; i--)
	{
		int u = q[i];
		for (int e = head[u]; e; e = next[e])
			if (to[e] != fa[u])
				cmax(f0[u], f1[u], f0[to[e]] + 1);
	}
	for (int i = 1; i <= N; i++)
	{
		int u = q[i], first = f0[u], second = f1[u];
		if (i > 1)
			cmax(first, second, g[u] + 1);
		for (int e = head[u]; e; e = next[e])
			if (to[e] != fa[u])
				g[to[e]] = f0[to[e]] + 1 == first ? second : first;
	}
}
inline int D1(int x, int y)
{
	return x == y ? 0 : abs(x - y) - 1;
}
int main()
{
	scanf("%d", &N);
	for (int i = 1, u, v; i < N; i++)
	{
		scanf("%d%d", &u, &v);
		next[++E] = head[u], to[E] = v, head[u] = E;
		next[++E] = head[v], to[E] = u, head[v] = E;
	}
	scanf("%s", s + 1);
	if (!all_of(s + 1, s + N + 1, [] (char x) { return x == '1'; }))
	{
		printf("I can't\n");
		return 0;
	}
	BFS();
	O = f0[1] + 1;
	for (int i = 2; i <= N; i++)
		O += max(f0[i], g[i] + 1) - D1(f0[i], g[i]);
	printf("%lld\n", O);
	return 0;
}
