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
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-9;
int bit_count(int first) {
  return first == 0 ? 0 : 1 + bit_count(first & (first - 1));
}
inline int last_bit(int first) { return first & -first; }
inline int sign(double first) {
  return first < -EPS ? -1 : first > EPS ? 1 : 0;
}
inline int sign(int first) { return (first > 0) - (first < 0); }
int nextComb(int first) {
  int smallest = first & -first;
  int ripple = first + smallest;
  int ones = first ^ ripple;
  ones = (ones >> 2) / smallest;
  return ripple | ones;
}
int gcd(int a, int b) {
  while (b) {
    int r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
struct UnionFind {
  vector<int> P, S, R;
  UnionFind(int n)
      : P(vector<int>(n)), S(vector<int>(n, 1)), R(vector<int>(n, 1)) {
    for (int i = (int)0; i < (int)n; ++i) P[i] = i;
  }
  int findP(int first) {
    if (P[first] != first) P[first] = findP(P[first]);
    return P[first];
  }
  inline int operator[](const int first) { return findP(first); }
  int merge(int a, int b) {
    int pa = findP(a), push_back = findP(b);
    if (pa == push_back) return 0;
    if (R[pa] < R[push_back]) {
      P[pa] = push_back;
      S[push_back] += S[pa];
    } else {
      P[push_back] = pa;
      S[pa] += S[push_back];
    }
    if (R[pa] == R[push_back]) ++R[pa];
    return 1;
  }
};
const int BUF_SIZE = 1001 * 1000;
char buf[BUF_SIZE];
inline string getToken() {
  scanf("%s", buf);
  return buf;
}
inline string getLine() {
  fgets(buf, BUF_SIZE, stdin);
  return buf;
}
inline int getInt() {
  int a;
  scanf("%d", &a);
  return a;
}
inline double getDouble() {
  double a;
  scanf("%lf", &a);
  return a;
}
inline int stoi(string first) {
  stringstream ss;
  int ret;
  ss << first;
  ss >> ret;
  return ret;
}
inline vector<string> split(string &s) {
  stringstream ss;
  ss << s;
  string t;
  vector<string> ret;
  while (ss >> t) ret.push_back(t);
  return ret;
}
template <class K, class V>
vector<K> getKeys(map<K, V> m) {
  vector<K> keys;
  for (typeof((m).begin()) it = (m).begin(); it != (m).end(); ++it)
    keys.push_back(it->first);
  return keys;
}
inline double myRand() {
  return ((double)rand() / RAND_MAX) + ((double)rand() / RAND_MAX / RAND_MAX);
}
void myCode() {
  int n = getInt();
  vector<int> a;
  for (int i = (int)0; i < (int)n; ++i) a.push_back(getInt());
  int ret = 0;
  for (int i = (int)0; i < (int)n; ++i) ret += (i + 1) * a[i];
  printf("%d\n", ret);
}
int main() {
  srand(time(NULL));
  myCode();
  return 0;
}
