Tree
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Toilet-Ares and Unidentified-person are playing a game on a tree with n vertices. A tree is a connected undirected graph with no cycles. The vertices are numbered from 1 to n. Initially, Toilet-Ares is at vertex number , and Unidentified-person is at vertex number .

They move in turns, and Toilet-Ares moves first. Upon every move, the player must select one neighbor of his/her own vertex and goes there. After going to the new vertex, the player then removes the old vertex and all edges connected to it. The player must move whenever possible, and the game ends when both players cannot move. Each player's score equals the number of moves he/she made.

Both Toilet-Ares and Unidentified-person are trying to maximize his/her own score minus the other player's score. Assuming they are extremely smart and always select the best move possible, what is Toilet-Ares's score minus Unidentified-person's score when the game ends?

输入描述:

The first line contains three integers  .

Each line of the next  lines contains two integers  , denoting an edge between  and .

输出描述:

One line contains one integer, denoting the answer.
示例1

输入

复制
5 1 4
1 2
1 3
3 4
4 5

输出

复制
0