#UnknownID45. 1IXMMMlKXUF#(!(
1IXMMMlKXUF#(!(
Statement
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding paths between each pair of houses. The length of a path between Rabbit's and Owl's houses is meters, between Rabbit's and Eeyore's house is meters, between Owl's and Eeyore's house is meters.
For enjoying his life and singing merry songs Winnie-the-Pooh should have a meal times a day. Now he is in the Rabbit's house and has a meal for the first time. Each time when in the friend's house where Winnie is now the supply of honey is about to end, Winnie leaves that house. If Winnie has not had a meal the required amount of times, he comes out from the house and goes to someone else of his two friends. For this he chooses one of two adjacent paths, arrives to the house on the other end and visits his friend. You may assume that when Winnie is eating in one of his friend's house, the supply of honey in other friend's houses recover (most probably, they go to the supply store).
Winnie-the-Pooh does not like physical activity. He wants to have a meal times, traveling minimum possible distance. Help him to find this distance.
Format
Input
First line contains an integer ( ) — number of visits.
Second line contains an integer ( ) — distance between Rabbit's and Owl's houses.
Third line contains an integer ( ) — distance between Rabbit's and Eeyore's houses.
Fourth line contains an integer ( ) — distance between Owl's and Eeyore's houses.
Output
Output one number — minimum distance in meters Winnie must go through to have a meal times.
Sample
3
2
3
1
3
1
2
3
5
0
相关
在下列比赛中: