The chemists have just conceived a large category of molecules, named NeoMole. The exceptionally outstanding properties of these molecules make them potential medicine for the current influenzal pneumonia. Theoretically speaking, a NeoMole molecule consists of only one chemical element, neonium. The neonium atoms are connected by regular chemical bonds in a NeoMole molecule. Unlike carbon, the number of atoms connected to a neonium atom by chemical bonds is, surprisingly, unlimited. Also, the molecule structure is acyclic. The scientists want to synthesize some NeoMoles, using small NeoMole molecules as substrates . To synthesize big molecules, one can choose two molecules, which can be either substrates or previously synthesized molecules, and specify an atom for each molecule. After some mysterious chemical reactions, a new chemical bond will form between the specified atoms. Because the NeoMoles are really precious, scientists want to minimize their total cost on substrates. Can you write a program to help them find the optimal synthesis plan?Do not miss the opportunity to earn big money!
The chemists have just conceived a large category of molecules, named NeoMole. The exceptionally outstanding properties of these molecules make them potential medicine for the current influenzal pneumonia. Theoretically speaking, a NeoMole molecule consists of only one chemical element, neonium. The neonium atoms are connected by regular chemical bonds in a NeoMole molecule. Unlike carbon, the number of atoms connected to a neonium atom by chemical bonds is, surprisingly, unlimited. Also, the molecule structure is acyclic. The scientists want to synthesize some NeoMoles, using small NeoMole molecules as substrates (i.e., raw materials). To synthesize big molecules, one can choose two molecules, which can be either substrates or previously synthesized molecules, and specify an atom for each molecule. After some mysterious chemical reactions, a new chemical bond will form between the specified atoms. Because the NeoMoles are really precious, scientists want to minimize their total cost on substrates. Can you write a program to help them find the optimal synthesis plan? Do not miss the opportunity to earn big money!