#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.);
template <typename cood = long long int>
struct interval;
template <typename cood = long long int>
struct vect;
template <typename cood = long long int>
struct line;
template <typename cood = long long int>
struct poly;
template <typename cood = long long int>
struct circ;
template <typename cood>
struct interval {
  cood a, b;
  interval<cood>() {}
  interval<cood>(cood s, cood t) : a(s), b(t) {
    if (a > b) swap(a, b);
  }
  interval<cood>(cood x) : a(x), b(x) {}
  inline bool contains(const interval& ot, cood eps = 0) const {
    return a - ot.a <= eps && ot.b - b <= eps;
  }
  inline bool intersects(const interval& ot, cood eps = 0) const {
    return contains(ot.a, eps) || contains(ot.b, eps) ||
           ot.contains(*this, eps);
  }
};
template <typename cood>
struct vect {
  cood x, y;
  vect<cood>() {}
  vect<cood>(cood a, cood b) : x(a), y(b) {}
  vect<cood>(cood a) : x(a), y(a) {}
  inline bool operator<(const vect<cood>& ot) const {
    return (x < ot.x || (x == ot.x && y < ot.y));
  }
  inline void print() const { printf("(%f,%f)", x, y); }
  inline vect<cood> operator-(const vect<cood>& ot) const {
    return vect<cood>(x - ot.x, y - ot.y);
  }
  inline vect<cood> operator+(const vect<cood>& ot) const {
    return vect<cood>(x + ot.x, y + ot.y);
  }
  inline vect<cood> operator*(cood a) const { return vect<cood>(x * a, y * a); }
  inline vect<cood> operator/(cood a) const { return vect<cood>(x / a, y / a); }
  inline vect<cood> flip() const { return vect<cood>(y, x); }
  inline vect<cood> mirror() const { return vect<cood>(-y, x); }
  inline vect<double> rotate(double ang) const {
    return vect<double>(cos(ang) * x - sin(ang) * y,
                        sin(ang) * x + cos(ang) * y);
  }
  inline cood operator*(const vect<cood>& ot) const {
    return y * ot.x - x * ot.y;
  }
  inline cood operator^(const vect<cood>& ot) const {
    return x * ot.x + y * ot.y;
  }
  inline cood sq(const vect<cood>& ot = 0) const {
    return ((*this) - ot) ^ ((*this) - ot);
  }
  inline double norm(const vect<cood>& ot = 0) const { return sqrt(sq(ot)); }
  inline cood area(const vect<cood>& a, const vect<cood>& b) const {
    return (a - (*this)) * (b - (*this));
  }
  int clockwise(const vect<cood>& a, const vect<cood>& b, cood eps = 0) const {
    cood o = area(a, b);
    return (o > -eps) - (o < eps);
  }
};
template <typename cood>
struct line {
  vect<cood> s, t;
  line<cood>() {}
  line<cood>(vect<cood> a, vect<cood> b) : s(a), t(b) {
    if (t < s) swap(s, t);
  }
  line<cood>(vect<cood> a) : s(a), t(a) {}
  inline line<cood> flip() const { return line<cood>(s.flip(), t.flip()); }
  inline vect<cood> dir() const { return t - s; }
  inline cood sq_dist(const vect<cood>& ot) const {
    return min(s.sq(ot), t.sq(ot));
  }
  bool intersects(const line<cood>& ot, cood eps = 0) const {
    int a = s.clockwise(t, ot.s, eps);
    int b = s.clockwise(t, ot.t, eps);
    if (a == 0 && b == 0) {
      if (!interval<cood>(s.x, t.x).intersects(interval<cood>(ot.s.x, ot.t.x),
                                               eps))
        return 0;
      if (!interval<cood>(s.y, t.y).intersects(interval<cood>(ot.s.y, ot.t.y),
                                               eps))
        return 0;
      return 1;
    }
    if (a == b) return 0;
    if (ot.s.clockwise(ot.t, s, eps) == ot.s.clockwise(ot.t, t, eps)) return 0;
    return 1;
  }
};
template <typename cood>
struct poly {
  vector<vect<cood> > v;
  poly<cood>() {}
  poly<cood>(const vector<vect<cood> >& inp) : v(inp) {}
  cood area() {
    cood res = 0;
    for (int i = 1; i + 1 < v.size(); i++) res += v[0].area(v[i], v[i + 1]);
    return res;
  }
  void graham(cood eps = 0) {
    int mini = 0;
    for (int i = 0; i < v.size(); i++) {
      if (v[i] < v[mini]) mini = i;
    }
    swap(v[0], v[mini]);
    vect<cood> anc = v[0];
    sort(v.begin() + 1, v.end(),
         [anc, eps](vect<cood> i, vect<cood> j) -> bool {
           int o = anc.clockwise(i, j, eps);
           if (!o) return i < j;
           return (o == 1);
         });
    v.push_back(v[0]);
    int m = 0;
    for (int i = 0; i < v.size(); i++) {
      while (m >= 2 + (i == v.size() - 1) &&
             v[m - 2].clockwise(v[m - 1], v[i], eps) < 1)
        m--;
      swap(v[m], v[i]);
      m++;
    }
    m--;
    while (v.size() > m) v.pop_back();
  }
  int position(const vect<cood>& ot, cood eps = 0) const {
    int n = v.size();
    if (n == 1) return -1 + (ot.norm(v[0]) <= eps);
    int lo = 0;
    int hi = n - 1;
    while (lo < hi) {
      int mid = lo + (hi - lo + 1) / 2;
      if (v[0].clockwise(v[mid], ot, eps) >= 0)
        lo = mid;
      else
        hi = mid - 1;
    }
    if (lo == 0 || lo == n - 1)
      return -1 + line<cood>(v[lo], v[(lo + 1) % n])
                      .intersects(line<cood>(ot, ot), eps);
    return v[lo].clockwise(v[(lo + 1) % n], ot, eps);
  }
  bool intersects(const poly<cood>& ot, cood eps = 0) const {
    for (int i = 0; i < v.size(); i++)
      if (ot.position(v[i]) >= 0) return 1;
    for (int i = 0; i < ot.v.size(); i++)
      if (position(ot.v[i]) >= 0) return 1;
    for (int i = 0; i < v.size(); i++)
      for (int j = 0; j < ot.v.size(); j++)
        if (line<cood>(v[i], v[(i + 1) % v.size()])
                .intersects(line<cood>(ot.v[j], ot.v[(j + 1) % ot.v.size()]),
                            eps))
          return 1;
    return 0;
  }
};
template <typename cood>
struct circ {
  vect<cood> c;
  cood r;
  circ<cood>() {}
  circ<cood>(vect<cood> a, cood b) : c(a), r(b) {}
  inline circ<cood> expand(cood s) { return circ<cood>(c, r + s); }
  inline circ<cood> flip() { return circ<cood>(c.flip(), r); }
  inline int position(const vect<cood>& a, cood eps = 0) const {
    cood d = c.norm(a) - r;
    return (d < -eps) - (d > eps);
  }
};
const int N = 6;
poly<double> pl;
vect<double> v;
vect<double> dr;
int in[N];
int main() {
  dr = vect<double>(1., 0.);
  for (int i = 0; i < N; i++) scanf("%d", &in[i]);
  for (int i = 0; i < N; i++) {
    pl.v.push_back(v);
    v = v + dr * double(in[i]);
    dr = dr.rotate(2. * pi / 6.);
  }
  double ar = abs(pl.area());
  printf("%d\n", int(2. * ar / sqrt(3.) + 0.1));
}

### Prompt

Develop a solution in Cpp to the problem described below:

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;
const double pi = acos(-1.);
template <typename cood = long long int>
struct interval;
template <typename cood = long long int>
struct vect;
template <typename cood = long long int>
struct line;
template <typename cood = long long int>
struct poly;
template <typename cood = long long int>
struct circ;
template <typename cood>
struct interval {
  cood a, b;
  interval<cood>() {}
  interval<cood>(cood s, cood t) : a(s), b(t) {
    if (a > b) swap(a, b);
  }
  interval<cood>(cood x) : a(x), b(x) {}
  inline bool contains(const interval& ot, cood eps = 0) const {
    return a - ot.a <= eps && ot.b - b <= eps;
  }
  inline bool intersects(const interval& ot, cood eps = 0) const {
    return contains(ot.a, eps) || contains(ot.b, eps) ||
           ot.contains(*this, eps);
  }
};
template <typename cood>
struct vect {
  cood x, y;
  vect<cood>() {}
  vect<cood>(cood a, cood b) : x(a), y(b) {}
  vect<cood>(cood a) : x(a), y(a) {}
  inline bool operator<(const vect<cood>& ot) const {
    return (x < ot.x || (x == ot.x && y < ot.y));
  }
  inline void print() const { printf("(%f,%f)", x, y); }
  inline vect<cood> operator-(const vect<cood>& ot) const {
    return vect<cood>(x - ot.x, y - ot.y);
  }
  inline vect<cood> operator+(const vect<cood>& ot) const {
    return vect<cood>(x + ot.x, y + ot.y);
  }
  inline vect<cood> operator*(cood a) const { return vect<cood>(x * a, y * a); }
  inline vect<cood> operator/(cood a) const { return vect<cood>(x / a, y / a); }
  inline vect<cood> flip() const { return vect<cood>(y, x); }
  inline vect<cood> mirror() const { return vect<cood>(-y, x); }
  inline vect<double> rotate(double ang) const {
    return vect<double>(cos(ang) * x - sin(ang) * y,
                        sin(ang) * x + cos(ang) * y);
  }
  inline cood operator*(const vect<cood>& ot) const {
    return y * ot.x - x * ot.y;
  }
  inline cood operator^(const vect<cood>& ot) const {
    return x * ot.x + y * ot.y;
  }
  inline cood sq(const vect<cood>& ot = 0) const {
    return ((*this) - ot) ^ ((*this) - ot);
  }
  inline double norm(const vect<cood>& ot = 0) const { return sqrt(sq(ot)); }
  inline cood area(const vect<cood>& a, const vect<cood>& b) const {
    return (a - (*this)) * (b - (*this));
  }
  int clockwise(const vect<cood>& a, const vect<cood>& b, cood eps = 0) const {
    cood o = area(a, b);
    return (o > -eps) - (o < eps);
  }
};
template <typename cood>
struct line {
  vect<cood> s, t;
  line<cood>() {}
  line<cood>(vect<cood> a, vect<cood> b) : s(a), t(b) {
    if (t < s) swap(s, t);
  }
  line<cood>(vect<cood> a) : s(a), t(a) {}
  inline line<cood> flip() const { return line<cood>(s.flip(), t.flip()); }
  inline vect<cood> dir() const { return t - s; }
  inline cood sq_dist(const vect<cood>& ot) const {
    return min(s.sq(ot), t.sq(ot));
  }
  bool intersects(const line<cood>& ot, cood eps = 0) const {
    int a = s.clockwise(t, ot.s, eps);
    int b = s.clockwise(t, ot.t, eps);
    if (a == 0 && b == 0) {
      if (!interval<cood>(s.x, t.x).intersects(interval<cood>(ot.s.x, ot.t.x),
                                               eps))
        return 0;
      if (!interval<cood>(s.y, t.y).intersects(interval<cood>(ot.s.y, ot.t.y),
                                               eps))
        return 0;
      return 1;
    }
    if (a == b) return 0;
    if (ot.s.clockwise(ot.t, s, eps) == ot.s.clockwise(ot.t, t, eps)) return 0;
    return 1;
  }
};
template <typename cood>
struct poly {
  vector<vect<cood> > v;
  poly<cood>() {}
  poly<cood>(const vector<vect<cood> >& inp) : v(inp) {}
  cood area() {
    cood res = 0;
    for (int i = 1; i + 1 < v.size(); i++) res += v[0].area(v[i], v[i + 1]);
    return res;
  }
  void graham(cood eps = 0) {
    int mini = 0;
    for (int i = 0; i < v.size(); i++) {
      if (v[i] < v[mini]) mini = i;
    }
    swap(v[0], v[mini]);
    vect<cood> anc = v[0];
    sort(v.begin() + 1, v.end(),
         [anc, eps](vect<cood> i, vect<cood> j) -> bool {
           int o = anc.clockwise(i, j, eps);
           if (!o) return i < j;
           return (o == 1);
         });
    v.push_back(v[0]);
    int m = 0;
    for (int i = 0; i < v.size(); i++) {
      while (m >= 2 + (i == v.size() - 1) &&
             v[m - 2].clockwise(v[m - 1], v[i], eps) < 1)
        m--;
      swap(v[m], v[i]);
      m++;
    }
    m--;
    while (v.size() > m) v.pop_back();
  }
  int position(const vect<cood>& ot, cood eps = 0) const {
    int n = v.size();
    if (n == 1) return -1 + (ot.norm(v[0]) <= eps);
    int lo = 0;
    int hi = n - 1;
    while (lo < hi) {
      int mid = lo + (hi - lo + 1) / 2;
      if (v[0].clockwise(v[mid], ot, eps) >= 0)
        lo = mid;
      else
        hi = mid - 1;
    }
    if (lo == 0 || lo == n - 1)
      return -1 + line<cood>(v[lo], v[(lo + 1) % n])
                      .intersects(line<cood>(ot, ot), eps);
    return v[lo].clockwise(v[(lo + 1) % n], ot, eps);
  }
  bool intersects(const poly<cood>& ot, cood eps = 0) const {
    for (int i = 0; i < v.size(); i++)
      if (ot.position(v[i]) >= 0) return 1;
    for (int i = 0; i < ot.v.size(); i++)
      if (position(ot.v[i]) >= 0) return 1;
    for (int i = 0; i < v.size(); i++)
      for (int j = 0; j < ot.v.size(); j++)
        if (line<cood>(v[i], v[(i + 1) % v.size()])
                .intersects(line<cood>(ot.v[j], ot.v[(j + 1) % ot.v.size()]),
                            eps))
          return 1;
    return 0;
  }
};
template <typename cood>
struct circ {
  vect<cood> c;
  cood r;
  circ<cood>() {}
  circ<cood>(vect<cood> a, cood b) : c(a), r(b) {}
  inline circ<cood> expand(cood s) { return circ<cood>(c, r + s); }
  inline circ<cood> flip() { return circ<cood>(c.flip(), r); }
  inline int position(const vect<cood>& a, cood eps = 0) const {
    cood d = c.norm(a) - r;
    return (d < -eps) - (d > eps);
  }
};
const int N = 6;
poly<double> pl;
vect<double> v;
vect<double> dr;
int in[N];
int main() {
  dr = vect<double>(1., 0.);
  for (int i = 0; i < N; i++) scanf("%d", &in[i]);
  for (int i = 0; i < N; i++) {
    pl.v.push_back(v);
    v = v + dr * double(in[i]);
    dr = dr.rotate(2. * pi / 6.);
  }
  double ar = abs(pl.area());
  printf("%d\n", int(2. * ar / sqrt(3.) + 0.1));
}

```