Georgia and Bob are now in a pirate's cave. After exploring, they find that there are a lot of rooms in the cave, and these rooms are connected together by some roads. There are two kinds of rooms: one is full of jewellery and connected by only one road (we call this kind of room jewellery-room), and the other is empty but connected by at least two roads. In this cave, all the rooms are connected as a tree.
Now they are in a jewellery-room, and they want to go to all the jewellery-rooms one by one to fetch all the jewellery and then go back to the room where they stay now. Of course they want to walk for the minimum distance to achieve this goal. After exploring, they have drawn the entire map of the cave, and now the map is at Bob' hand. But Bob doesn't want to give the map to Georgia because Georgia always wants to show how clever she is. Bob just tells Georgia the minimum distance between any two jewellery-rooms and asks Georgia to tell him the order of visiting all the jewellery-rooms to achieve the minimum distance. If the order is not unique, Georgia should tell Bob the total number of possible different orders.
Though Georgia is a very clear girl, she thinks that it is difficult for her to solve this problem all by herself. Can you help her?