import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); double a=0; int n = in.nextInt(); int[] calories = new int[n]; for(int calories_i=0; calories_i < n; calories_i++){ calories[calories_i] = in.nextInt(); } a=a+(calories[1] * Math.pow(2,0)); a=a+(calories[2] * Math.pow(2,1)); a=a+(calories[0] * Math.pow(2,2)); int b=(int)a; System.out.println(b); } }