Need help with this problem.....

You and your friends are pilots in the Clone army.You are facing the aerial fleet of the Droid army.Droid planes move while maintaining a long line so that their shields interact making it impossible to shoot down planes in the middle of the line.Thus,your only option is to keep shooting down planes at the edges of the line.

You and your friend have decided to make a game of it.Each Droid plane has an importance level IMP[i].Since the droid planes don’t advertise their importance levels, both of you must follow a mixed strategy and shoot down either the first plane or the last plane with 50% chance each.If there is a single plane,the shooter with the turn will shoot it down for sure.The two of you take turns to shoot down enemy planes.You have the first turn.What is the expected sum of importance levels you will shoot down?

Input format:

input1=N(1<=N<=1000), the number of droid planes

input2=IMP(for 0<i<=N,1<=IMP[i]<=100)an array containing the importance levels of droid planes.

Output format:

A string containing your expected sum of importance levels of shot down planes,rounded to 3 places of decimal.




10 20