For this Question: There is a row of N shops. Each shop sells A[i] candies. Your friend made an array B of (N-1) integers where B[i] = max(A[i], A[i+1]) for i from 1 to (N-1). You are given array B. You want to generate the array A such that the sum of values of the candies in A is maximum. Find the maximum possible sum of candies of array A.The first line of input contains a single integer N. 
The second line of input contains (N-1) integers denoting array B.

<b>Constraints:</b>
2 &le; N &le; 10<sup>5</sup>
1 &le; B[i] &le; 10<sup>9</sup>Print the maximum possible sum of the candies in array A.Sample Input
4
1 3 4

Sample Output
9

<b>Explanation:</b> 
Optimal Array A will be [1, 1, 3, 4], I have written this Solution Code: n=int(input())
arr=list(map(int,input().split()))
summ=arr[-1]
for i in reversed(range(1,len(arr))):
	if arr[i]>arr[i-1]:
		summ+=arr[i-1]
	else:
		summ+=arr[i]
summ+=arr[0]
print(summ), In this Programming Language: Python, Now tell me if this Code is compilable or not?