#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
string sing(char x) {
  string s(1, x);
  return s;
}
bool cmpDec(long long int a, long long int b) {
  if (a >= b) return true;
  return false;
}
void print1D(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
void print2D(long long int **dp, long long int n, long long int m) {
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) cout << dp[i][j] << " ";
    cout << "\n";
  }
}
void init1D(long long int a[], long long int n, long long int k) {
  for (long long int z = 0; z < n; z++) a[z] = k;
}
void init2D(long long int **a, long long int n, long long int m,
            long long int k) {
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < m; j++) a[i][j] = k;
}
long long int fastmod(long long int base, long long int exp, long long int m) {
  long long int res = 1;
  while (exp) {
    if (exp & 1ll) res = (res * base) % m;
    base = (base * base) % m;
    exp /= 2;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int logBase(long long int m, long long int b) {
  long long int count = 0;
  while (m > 1) {
    ++count;
    m = m / b;
  }
  return count;
}
long long int spf[1000000 + 1];
void sieve() {
  spf[1] = 1;
  for (long long int i = 2; i < 1000000 + 1; i++) spf[i] = i;
  for (long long int i = 4; i < 1000000 + 1; i += 2) spf[i] = 2;
  for (long long int i = 3; i * i < 1000000 + 1; i++) {
    if (spf[i] == i) {
      for (long long int j = i * i; j < 1000000 + 1; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<long long int> getFactorization(long long int x) {
  vector<long long int> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    x = x / spf[x];
  }
  return ret;
}
long long int sumofFactors(long long int n) {
  long long int res = 1;
  for (long long int i = 2; i <= sqrt(n); i++) {
    long long int curr_sum = 1;
    long long int curr_term = 1;
    while (n % i == 0) {
      n = n / i;
      curr_term *= i;
      curr_sum += curr_term;
    }
    res *= curr_sum;
  }
  if (n >= 2) res *= (1 + n);
  return res;
}
void SUM(long long int *a, long long int n) {
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) sum += a[i];
  cout << sum << "\n";
}
void addEdge(vector<long long int> adj[], long long int u, long long int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
void printGraph(vector<long long int> adj[], long long int V) {
  for (long long int v = 1; v < V; ++v) {
    cout << "\n Adjacency list of vertex " << v << "\n head (" << v << ")";
    for (long long int x = 0; x < adj[v].size(); x++)
      cout << " -> " << adj[v][x];
    printf("\n");
  }
}
bool cycle(vector<long long int> adj[], long long int vis[], long long int n,
           long long int parent) {
  vis[n] = 1;
  if (adj[n].empty()) return false;
  bool value = false;
  for (long long int i = 0; i < adj[n].size(); i++) {
    if (adj[n][i] != parent) {
      if (vis[adj[n][i]] == 1)
        return true;
      else
        value |= cycle(adj, vis, adj[n][i], n);
    }
  }
  return value;
}
typedef struct num {
  long long int index;
  long long int value;
} num;
long long int countFactors(long long int n) {
  long long int count = 0;
  long long int ans = 1;
  for (long long int i = 2; i < sqrt(n) + 1; i++) {
    count = 0;
    while (n % i == 0) {
      n /= i;
      ++count;
    }
    ans *= count;
  }
  if (n > 1) ans *= 2;
  return ans;
}
long long int kthFactor(long long int n, long long int k) {
  vector<long long int> v;
  for (long long int i = 2; i < (long long int)sqrt(n) + 1; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i < n / i) v.push_back(n / i);
    }
  }
  v.push_back(1);
  v.push_back(n);
  sort(v.begin(), v.end());
  if (v.size() < k) return -1;
  return v[k - 1];
}
long long int binSmaller(long long int a[], long long int n, long long int k) {
  long long int l, r;
  l = 0;
  r = n - 1;
  long long int mid = (l + r) / 2;
  if (a[r] <= k) return r;
  if (a[l] > k) return -1;
  while (l < r) {
    if (a[mid] > k && a[mid - 1] <= k) return mid - 1;
    if (k >= a[mid] && a[mid + 1] > k) return mid;
    if (k < a[mid])
      r = mid - 1;
    else
      l = mid + 1;
    mid = (l + r) / 2;
  }
  return -1;
}
long long int binarySearchCount(long long int arr[], long long int n,
                                long long int key) {
  long long int left = 0;
  long long int right = n - 1;
  long long int count = 0;
  long long int mid = 0;
  while (left <= right) {
    mid = (right + left) / 2;
    if (arr[mid] <= key) {
      count = mid + 1;
      left = mid + 1;
    } else
      right = mid - 1;
  }
  return count;
}
long long int binomialCoeff(long long int n, long long int k) {
  long long int res = 1;
  if (k > n - k) k = n - k;
  for (long long int i = 0; i < k; ++i) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
long long int modInverse(long long int a,
                         long long int m = (long long int)(1000000000 + 7)) {
  long long int m0 = m, y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
const int N = 10e5 + 1;
long long int factorialNumInverse[N + 1];
long long int naturalNumInverse[N + 1];
long long int fact[N + 1];
void InverseofNumber(long long int p) {
  naturalNumInverse[0] = naturalNumInverse[1] = 1;
  for (long long int i = 2; i <= N; i++)
    naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(long long int p) {
  factorialNumInverse[0] = factorialNumInverse[1] = 1;
  for (long long int i = 2; i <= N; i++)
    factorialNumInverse[i] =
        (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(long long int p) {
  fact[0] = 1;
  for (long long int i = 1; i <= N; i++) {
    fact[i] = (fact[i - 1] * i) % p;
  }
}
long long int nCr(long long int N, long long int R,
                  long long int p = (long long int)(1000000000 + 7)) {
  if (R == 0) return 1;
  long long int ans =
      ((fact[N] * factorialNumInverse[R]) % p * factorialNumInverse[N - R]) % p;
  return ans;
}
long long int numberOfPaths(long long int m, long long int n) {
  long long int path = 1;
  for (long long int i = n; i < (m + n - 1); i++) {
    path *= i;
    path /= (i - n + 1);
  }
  return path;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int a[6];
  for (long long int i = 0; i < 6; i++) cin >> a[i];
  long long int ans = 0;
  long long int p = a[2] * 2 + 1;
  long long int f = min(a[1], a[3]);
  a[1] -= f;
  a[3] -= f;
  ans += (f * (p + p + (f - 1) * 2)) / 2;
  p = p + f - 1 + f - 1 + 1;
  ans += p * (max(a[1], a[3]));
  p -= 1;
  f = min(a[0], a[4]);
  ans += (f * (p + p + (1 - f) * 2)) / 2;
  cout << ans << "\n";
}

### Prompt

Please create a solution in Cpp to the following problem:

Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <image>. Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.

He painted a few lines, parallel to the sides of the hexagon. The lines split the hexagon into regular triangles with sides of 1 centimeter. Now Gerald wonders how many triangles he has got. But there were so many of them that Gerald lost the track of his counting. Help the boy count the triangles.

Input

The first and the single line of the input contains 6 space-separated integers a1, a2, a3, a4, a5 and a6 (1 ≤ ai ≤ 1000) — the lengths of the sides of the hexagons in centimeters in the clockwise order. It is guaranteed that the hexagon with the indicated properties and the exactly such sides exists.

Output

Print a single integer — the number of triangles with the sides of one 1 centimeter, into which the hexagon is split.

Examples

Input

1 1 1 1 1 1


Output

6


Input

1 2 1 2 1 2


Output

13

Note

This is what Gerald's hexagon looks like in the first sample:

<image>

And that's what it looks like in the second sample:

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
string sing(char x) {
  string s(1, x);
  return s;
}
bool cmpDec(long long int a, long long int b) {
  if (a >= b) return true;
  return false;
}
void print1D(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
void print2D(long long int **dp, long long int n, long long int m) {
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) cout << dp[i][j] << " ";
    cout << "\n";
  }
}
void init1D(long long int a[], long long int n, long long int k) {
  for (long long int z = 0; z < n; z++) a[z] = k;
}
void init2D(long long int **a, long long int n, long long int m,
            long long int k) {
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < m; j++) a[i][j] = k;
}
long long int fastmod(long long int base, long long int exp, long long int m) {
  long long int res = 1;
  while (exp) {
    if (exp & 1ll) res = (res * base) % m;
    base = (base * base) % m;
    exp /= 2;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int logBase(long long int m, long long int b) {
  long long int count = 0;
  while (m > 1) {
    ++count;
    m = m / b;
  }
  return count;
}
long long int spf[1000000 + 1];
void sieve() {
  spf[1] = 1;
  for (long long int i = 2; i < 1000000 + 1; i++) spf[i] = i;
  for (long long int i = 4; i < 1000000 + 1; i += 2) spf[i] = 2;
  for (long long int i = 3; i * i < 1000000 + 1; i++) {
    if (spf[i] == i) {
      for (long long int j = i * i; j < 1000000 + 1; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<long long int> getFactorization(long long int x) {
  vector<long long int> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    x = x / spf[x];
  }
  return ret;
}
long long int sumofFactors(long long int n) {
  long long int res = 1;
  for (long long int i = 2; i <= sqrt(n); i++) {
    long long int curr_sum = 1;
    long long int curr_term = 1;
    while (n % i == 0) {
      n = n / i;
      curr_term *= i;
      curr_sum += curr_term;
    }
    res *= curr_sum;
  }
  if (n >= 2) res *= (1 + n);
  return res;
}
void SUM(long long int *a, long long int n) {
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) sum += a[i];
  cout << sum << "\n";
}
void addEdge(vector<long long int> adj[], long long int u, long long int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
void printGraph(vector<long long int> adj[], long long int V) {
  for (long long int v = 1; v < V; ++v) {
    cout << "\n Adjacency list of vertex " << v << "\n head (" << v << ")";
    for (long long int x = 0; x < adj[v].size(); x++)
      cout << " -> " << adj[v][x];
    printf("\n");
  }
}
bool cycle(vector<long long int> adj[], long long int vis[], long long int n,
           long long int parent) {
  vis[n] = 1;
  if (adj[n].empty()) return false;
  bool value = false;
  for (long long int i = 0; i < adj[n].size(); i++) {
    if (adj[n][i] != parent) {
      if (vis[adj[n][i]] == 1)
        return true;
      else
        value |= cycle(adj, vis, adj[n][i], n);
    }
  }
  return value;
}
typedef struct num {
  long long int index;
  long long int value;
} num;
long long int countFactors(long long int n) {
  long long int count = 0;
  long long int ans = 1;
  for (long long int i = 2; i < sqrt(n) + 1; i++) {
    count = 0;
    while (n % i == 0) {
      n /= i;
      ++count;
    }
    ans *= count;
  }
  if (n > 1) ans *= 2;
  return ans;
}
long long int kthFactor(long long int n, long long int k) {
  vector<long long int> v;
  for (long long int i = 2; i < (long long int)sqrt(n) + 1; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i < n / i) v.push_back(n / i);
    }
  }
  v.push_back(1);
  v.push_back(n);
  sort(v.begin(), v.end());
  if (v.size() < k) return -1;
  return v[k - 1];
}
long long int binSmaller(long long int a[], long long int n, long long int k) {
  long long int l, r;
  l = 0;
  r = n - 1;
  long long int mid = (l + r) / 2;
  if (a[r] <= k) return r;
  if (a[l] > k) return -1;
  while (l < r) {
    if (a[mid] > k && a[mid - 1] <= k) return mid - 1;
    if (k >= a[mid] && a[mid + 1] > k) return mid;
    if (k < a[mid])
      r = mid - 1;
    else
      l = mid + 1;
    mid = (l + r) / 2;
  }
  return -1;
}
long long int binarySearchCount(long long int arr[], long long int n,
                                long long int key) {
  long long int left = 0;
  long long int right = n - 1;
  long long int count = 0;
  long long int mid = 0;
  while (left <= right) {
    mid = (right + left) / 2;
    if (arr[mid] <= key) {
      count = mid + 1;
      left = mid + 1;
    } else
      right = mid - 1;
  }
  return count;
}
long long int binomialCoeff(long long int n, long long int k) {
  long long int res = 1;
  if (k > n - k) k = n - k;
  for (long long int i = 0; i < k; ++i) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
long long int modInverse(long long int a,
                         long long int m = (long long int)(1000000000 + 7)) {
  long long int m0 = m, y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
const int N = 10e5 + 1;
long long int factorialNumInverse[N + 1];
long long int naturalNumInverse[N + 1];
long long int fact[N + 1];
void InverseofNumber(long long int p) {
  naturalNumInverse[0] = naturalNumInverse[1] = 1;
  for (long long int i = 2; i <= N; i++)
    naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(long long int p) {
  factorialNumInverse[0] = factorialNumInverse[1] = 1;
  for (long long int i = 2; i <= N; i++)
    factorialNumInverse[i] =
        (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(long long int p) {
  fact[0] = 1;
  for (long long int i = 1; i <= N; i++) {
    fact[i] = (fact[i - 1] * i) % p;
  }
}
long long int nCr(long long int N, long long int R,
                  long long int p = (long long int)(1000000000 + 7)) {
  if (R == 0) return 1;
  long long int ans =
      ((fact[N] * factorialNumInverse[R]) % p * factorialNumInverse[N - R]) % p;
  return ans;
}
long long int numberOfPaths(long long int m, long long int n) {
  long long int path = 1;
  for (long long int i = n; i < (m + n - 1); i++) {
    path *= i;
    path /= (i - n + 1);
  }
  return path;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int a[6];
  for (long long int i = 0; i < 6; i++) cin >> a[i];
  long long int ans = 0;
  long long int p = a[2] * 2 + 1;
  long long int f = min(a[1], a[3]);
  a[1] -= f;
  a[3] -= f;
  ans += (f * (p + p + (f - 1) * 2)) / 2;
  p = p + f - 1 + f - 1 + 1;
  ans += p * (max(a[1], a[3]));
  p -= 1;
  f = min(a[0], a[4]);
  ans += (f * (p + p + (1 - f) * 2)) / 2;
  cout << ans << "\n";
}

```