Question #1 -- The Land of Oz

Dorothy and friends are travelling through the Land of Oz in order to see The Wizard. Their starting point and end point are fixed, but they have considerable choices as to which territories to travel through en route.

Input

The possible routes are shown in the figure below, and constitute the input to the problem. Each territory is represented by a numbered block. The labels on the arrows connecting the territories represent the degree of risk associated with encountering the Wicked Witch of the West; the higher the risk, the higher the number.

Output