#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    int n,k=0,i;
    scanf("%d",&n);
    int *calories = malloc(sizeof(int) * n);
    for(int calories_i = 0; calories_i < n; calories_i++){
       scanf("%d",&calories[calories_i]);
    }
    for(i=0;i<n;i++)
        {
         k=k+(2^i)*calories[i];
    }
    printf("%d",k);
    // your code goes here
    return 0;
}