How to make a cake you'll never eat.

Ingredients. 

  * 2 carrots
  * 0 calories
  * 100 g chocolate spread
  * 1 pack of flour
  * 1 egg



Method. 

  1. Put calories into the mixing bowl.
  2. Take carrots from refrigerator.
  3. Chop carrots.
  4. Take chocolate spread from refrigerator.
  5. Put chocolate spread into the mixing bowl.
  6. Combine pack of flour into the mixing bowl.
  7. Fold chocolate spread into the mixing bowl.
  8. Add chocolate spread into the mixing bowl.
  9. Put pack of flour into the mixing bowl.
  10. Add egg into the mixing bowl.
  11. Fold pack of flour into the mixing bowl.
  12. Chop carrots until choped.
  13. Pour contents of the mixing bowl into the baking dish.



Serves 1.

Input

The only line of input contains a sequence of integers a0, a1, ... (1 ≤ a0 ≤ 100, 0 ≤ ai ≤ 1000 for i ≥ 1).

Output

Output a single integer.

Examples

Input

4 1 2 3 4


Output

30
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C{

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = scan.nextInt(), mixingBowl = 0;
		for(int i = 1; i <= n; i++)	mixingBowl += scan.nextInt()*i;
		out.print(mixingBowl);
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}