#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
const double INF = 1e100;
const double EPS = 1e-9;
int EQ(double x) {
  if (fabs(x) < EPS)
    return 0;
  else if (x > 0)
    return 1;
  else
    return -1;
}
struct PT {
  double x, y;
  PT() {}
  PT(double x, double y) : x(x), y(y) {}
  PT(const PT &p) : x(p.x), y(p.y) {}
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(double c) const { return PT(x * c, y * c); }
  PT operator/(double c) const { return PT(x / c, y / c); }
  bool operator<(const PT &p) const {
    if (x == p.x) return y < p.y;
    return x < p.x;
  }
};
double dot(PT p, PT q) { return p.x * q.x + p.y * q.y; }
double dist2D_sqr(PT p, PT q) { return dot(p - q, p - q); }
double dist2D(PT p, PT q) { return sqrt(dot(p - q, p - q)); }
double cross(PT p, PT q) { return p.x * q.y - p.y * q.x; }
PT RotateCCW90(PT p) { return PT(-p.y, p.x); }
PT RotateCW90(PT p) { return PT(p.y, -p.x); }
PT RotateCCW(PT p, double theta) {
  return PT(p.x * cos(theta) - p.y * sin(theta),
            p.x * sin(theta) + p.y * cos(theta));
}
PT RotateCW(PT p, double theta) {
  return PT(p.x * cos(theta) + p.y * sin(theta),
            -p.x * sin(theta) + p.y * cos(theta));
}
PT PointAlongLine(PT a, PT b, double d) {
  return a + (((b - a) / sqrt(dot(b - a, b - a))) * d);
}
PT ProjectPointToLine(PT a, PT b, PT c) {
  return a + (b - a) * dot(c - a, b - a) / dot(b - a, b - a);
}
PT ProjectPointToSegment(PT a, PT b, PT c) {
  double r = dot(b - a, b - a);
  if (fabs(r) < EPS) return a;
  r = dot(c - a, b - a) / r;
  if (r < 0) return a;
  if (r > 1) return b;
  return a + (b - a) * r;
}
double DistanceFromPointToSegment(PT a, PT b, PT c) {
  return dist2D(c, ProjectPointToSegment(a, b, c));
}
double DistToLine(PT p, PT A, PT B) {
  double scale = dot(p - A, B - A) / dot(B - A, B - A);
  PT c;
  c.x = A.x + scale * (B.x - A.x);
  c.y = A.y + scale * (B.y - A.y);
  return dist2D(p, c);
}
double DistToLineSegment(PT p, PT A, PT B) {
  PT c;
  if (dot(B - A, p - A) < EPS) return dist2D(p, A);
  if (dot(A - B, p - B) < EPS) return dist2D(p, B);
  return DistToLine(p, A, B);
}
bool PointOnSegment(PT p, PT a, PT b) {
  if (fabs(cross(p - b, a - b)) < EPS) {
    if (p.x < min(a.x, b.x) || p.x > max(a.x, b.x)) return false;
    if (p.y < min(a.y, b.y) || p.y > max(a.y, b.y)) return false;
    return true;
  }
  return false;
}
bool LinesParallel(PT a, PT b, PT c, PT d) {
  return fabs(cross(b - a, c - d)) < EPS;
}
bool LinesCollinear(PT a, PT b, PT c, PT d) {
  return LinesParallel(a, b, c, d) && fabs(cross(a - b, a - c)) < EPS &&
         fabs(cross(c - d, c - a)) < EPS;
}
bool SegmentsIntersect(PT a, PT b, PT c, PT d) {
  if (LinesCollinear(a, b, c, d)) {
    if (dist2D_sqr(a, c) < EPS || dist2D_sqr(a, d) < EPS ||
        dist2D_sqr(b, c) < EPS || dist2D_sqr(b, d) < EPS)
      return true;
    if (dot(c - a, c - b) > 0 && dot(d - a, d - b) > 0 && dot(c - b, d - b) > 0)
      return false;
    return true;
  }
  if (cross(d - a, b - a) * cross(c - a, b - a) > 0) return false;
  if (cross(a - c, d - c) * cross(b - c, d - c) > 0) return false;
  return true;
}
PT ComputeLineIntersection(PT a, PT b, PT c, PT d) {
  double a1 = a.y - b.y;
  double b1 = b.x - a.x;
  double c1 = cross(a, b);
  double a2 = c.y - d.y;
  double b2 = d.x - c.x;
  double c2 = cross(c, d);
  double D = a1 * b2 - a2 * b1;
  return PT((b1 * c2 - b2 * c1) / D, (c1 * a2 - c2 * a1) / D);
}
PT ComputeCircleCenter(PT a, PT b, PT c) {
  b = (a + b) / 2;
  c = (a + c) / 2;
  return ComputeLineIntersection(b, b + RotateCW90(a - b), c,
                                 c + RotateCW90(a - c));
}
bool PointOnBoundaryOfPolygon(const vector<PT> p, PT q) {
  int s = p.size();
  for (int i = 0, j = s - 1; i < s; j = i++) {
    if (PointOnSegment(q, p[j], p[i])) return true;
  }
  return false;
}
bool PointInPolygon(const vector<PT> p, PT q) {
  bool c = 0;
  int s = p.size();
  for (int i = 0, j = s - 1; i < s; j = i++) {
    if (((p[i].y > q.y) != (p[j].y > q.y)) &&
        (q.x < p[i].x + (p[j].x - p[i].x) * (q.y - p[i].y) / (p[j].y - p[i].y)))
      c = !c;
  }
  return c;
}
vector<PT> CircleLineIntersection(PT a, PT b, PT c, double r) {
  vector<PT> ret;
  b = b - a;
  a = a - c;
  double A = dot(b, b);
  double B = dot(a, b);
  double C = dot(a, a) - r * r;
  double D = B * B - A * C;
  if (D < -EPS) return ret;
  ret.push_back(c + a + b * (-B + sqrt(D + EPS)) / A);
  if (D > EPS) ret.push_back(c + a + b * (-B - sqrt(D)) / A);
  return ret;
}
vector<PT> CircleCircleIntersection(PT c1, PT c2, double r1, double r2) {
  vector<PT> ret;
  double d = dist2D(c1, c2);
  if (d > r1 + r2 || d + min(r1, r2) < max(r1, r2)) return ret;
  double x = (d * d - r2 * r2 + r1 * r1) / (2.0 * d);
  double y = sqrt(r1 * r1 - x * x);
  PT v = (c2 - c1) / d;
  ret.push_back(c1 + v * x + RotateCCW90(v) * y);
  if (y > 0) ret.push_back(c1 + v * x - RotateCCW90(v) * y);
  return ret;
}
double ComputeSignedArea(const vector<PT> p) {
  double area = 0.0;
  for (int i = 0; i < p.size(); i++) {
    int j = (i + 1) % p.size();
    area += p[i].x * p[j].y - p[j].x * p[i].y;
  }
  return area / 2.0;
}
double ComputeArea(const vector<PT> p) { return fabs(ComputeSignedArea(p)); }
PT ComputeCentroid(const vector<PT> p) {
  PT c = PT(0.0, 0.0);
  double scale = 6.0 * ComputeSignedArea(p);
  for (int i = 0; i < p.size(); i++) {
    int j = (i + 1) % p.size();
    c = c + (p[i] + p[j]) * (p[i].x * p[j].y - p[j].x * p[i].y);
  }
  return c / scale;
}
bool IsSimple(const vector<PT> p) {
  for (int i = 0; i < p.size(); i++) {
    for (int k = i + 1; k < p.size(); k++) {
      int j = (i + 1) % p.size();
      int l = (k + 1) % p.size();
      if (i == l || j == k) continue;
      if (SegmentsIntersect(p[i], p[j], p[k], p[l])) return false;
    }
  }
  return true;
}
pair<PT, PT> GetParallelLine(PT a, PT b, double d) {
  return make_pair(PointAlongLine(a, RotateCCW90(b - a) + a, d),
                   PointAlongLine(b, RotateCW90(a - b) + b, d));
}
pair<PT, PT> GetPerpendicularLine(PT a, PT b, PT c) {
  return make_pair(RotateCCW90(a - c) + c, RotateCCW90(b - c) + c);
}
vector<PT> HalfPlaneIntersection(vector<PT> poly, pair<PT, PT> ln) {
  vector<PT> ret;
  int s = poly.size();
  for (int i = 0; i < s; i++) {
    double c1 = cross(ln.second - ln.first, poly[i] - ln.first);
    double c2 = cross(ln.second - ln.first, poly[(i + 1) % s] - ln.first);
    if (EQ(c1) >= 0) ret.push_back(poly[i]);
    if (EQ(c1 * c2) < 0) {
      if (!LinesParallel(poly[i], poly[(i + 1) % s], ln.first, ln.second)) {
        ret.push_back(ComputeLineIntersection(poly[i], poly[(i + 1) % s],
                                              ln.first, ln.second));
      }
    }
  }
  return ret;
}
double DistancePointPlane(double x, double y, double z, double a, double b,
                          double c, double d) {
  return fabs(a * x + b * y + c * z - d) / sqrt(a * a + b * b + c * c);
}
int orientation(PT p, PT q, PT r) {
  double val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
  if (val == 0.0)
    return 0;
  else if (val > 0.0)
    return 1;
  else
    return -1;
}
vector<PT> convex_hull(vector<PT> vec) {
  sort(vec.begin(), vec.end());
  PT p1, p2;
  stack<PT> low;
  stack<PT> up;
  for (int i = 0; i < (int)vec.size(); i++) {
    while ((int)low.size() >= 2) {
      p2 = low.top();
      low.pop();
      p1 = low.top();
      if (orientation(p1, p2, vec[i]) < 0) {
        low.push(p2);
        break;
      }
    }
    low.push(vec[i]);
  }
  for (int i = (int)vec.size() - 1; i >= 0; i--) {
    while ((int)up.size() >= 2) {
      p2 = up.top();
      up.pop();
      p1 = up.top();
      if (orientation(p1, p2, vec[i]) < 0) {
        up.push(p2);
        break;
      }
    }
    up.push(vec[i]);
  }
  low.pop();
  up.pop();
  vector<PT> ret;
  while (!up.empty()) {
    ret.push_back(up.top());
    up.pop();
  }
  while (!low.empty()) {
    ret.push_back(low.top());
    low.pop();
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
int main() {
  int a[8];
  while (scanf("%d %d %d %d", &a[1], &a[2], &a[3], &a[4]) == 4) {
    scanf("%d %d", &a[5], &a[6]);
    int x = a[2] + a[3] + a[4];
    int ans = ((x) * (x));
    ans = ans - ((a[2]) * (a[2])) - ((a[4]) * (a[4])) - ((a[6]) * (a[6]));
    printf("%d\n", ans);
  }
  return 0;
}

### Prompt

Please formulate a CPP solution 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;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
const double INF = 1e100;
const double EPS = 1e-9;
int EQ(double x) {
  if (fabs(x) < EPS)
    return 0;
  else if (x > 0)
    return 1;
  else
    return -1;
}
struct PT {
  double x, y;
  PT() {}
  PT(double x, double y) : x(x), y(y) {}
  PT(const PT &p) : x(p.x), y(p.y) {}
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(double c) const { return PT(x * c, y * c); }
  PT operator/(double c) const { return PT(x / c, y / c); }
  bool operator<(const PT &p) const {
    if (x == p.x) return y < p.y;
    return x < p.x;
  }
};
double dot(PT p, PT q) { return p.x * q.x + p.y * q.y; }
double dist2D_sqr(PT p, PT q) { return dot(p - q, p - q); }
double dist2D(PT p, PT q) { return sqrt(dot(p - q, p - q)); }
double cross(PT p, PT q) { return p.x * q.y - p.y * q.x; }
PT RotateCCW90(PT p) { return PT(-p.y, p.x); }
PT RotateCW90(PT p) { return PT(p.y, -p.x); }
PT RotateCCW(PT p, double theta) {
  return PT(p.x * cos(theta) - p.y * sin(theta),
            p.x * sin(theta) + p.y * cos(theta));
}
PT RotateCW(PT p, double theta) {
  return PT(p.x * cos(theta) + p.y * sin(theta),
            -p.x * sin(theta) + p.y * cos(theta));
}
PT PointAlongLine(PT a, PT b, double d) {
  return a + (((b - a) / sqrt(dot(b - a, b - a))) * d);
}
PT ProjectPointToLine(PT a, PT b, PT c) {
  return a + (b - a) * dot(c - a, b - a) / dot(b - a, b - a);
}
PT ProjectPointToSegment(PT a, PT b, PT c) {
  double r = dot(b - a, b - a);
  if (fabs(r) < EPS) return a;
  r = dot(c - a, b - a) / r;
  if (r < 0) return a;
  if (r > 1) return b;
  return a + (b - a) * r;
}
double DistanceFromPointToSegment(PT a, PT b, PT c) {
  return dist2D(c, ProjectPointToSegment(a, b, c));
}
double DistToLine(PT p, PT A, PT B) {
  double scale = dot(p - A, B - A) / dot(B - A, B - A);
  PT c;
  c.x = A.x + scale * (B.x - A.x);
  c.y = A.y + scale * (B.y - A.y);
  return dist2D(p, c);
}
double DistToLineSegment(PT p, PT A, PT B) {
  PT c;
  if (dot(B - A, p - A) < EPS) return dist2D(p, A);
  if (dot(A - B, p - B) < EPS) return dist2D(p, B);
  return DistToLine(p, A, B);
}
bool PointOnSegment(PT p, PT a, PT b) {
  if (fabs(cross(p - b, a - b)) < EPS) {
    if (p.x < min(a.x, b.x) || p.x > max(a.x, b.x)) return false;
    if (p.y < min(a.y, b.y) || p.y > max(a.y, b.y)) return false;
    return true;
  }
  return false;
}
bool LinesParallel(PT a, PT b, PT c, PT d) {
  return fabs(cross(b - a, c - d)) < EPS;
}
bool LinesCollinear(PT a, PT b, PT c, PT d) {
  return LinesParallel(a, b, c, d) && fabs(cross(a - b, a - c)) < EPS &&
         fabs(cross(c - d, c - a)) < EPS;
}
bool SegmentsIntersect(PT a, PT b, PT c, PT d) {
  if (LinesCollinear(a, b, c, d)) {
    if (dist2D_sqr(a, c) < EPS || dist2D_sqr(a, d) < EPS ||
        dist2D_sqr(b, c) < EPS || dist2D_sqr(b, d) < EPS)
      return true;
    if (dot(c - a, c - b) > 0 && dot(d - a, d - b) > 0 && dot(c - b, d - b) > 0)
      return false;
    return true;
  }
  if (cross(d - a, b - a) * cross(c - a, b - a) > 0) return false;
  if (cross(a - c, d - c) * cross(b - c, d - c) > 0) return false;
  return true;
}
PT ComputeLineIntersection(PT a, PT b, PT c, PT d) {
  double a1 = a.y - b.y;
  double b1 = b.x - a.x;
  double c1 = cross(a, b);
  double a2 = c.y - d.y;
  double b2 = d.x - c.x;
  double c2 = cross(c, d);
  double D = a1 * b2 - a2 * b1;
  return PT((b1 * c2 - b2 * c1) / D, (c1 * a2 - c2 * a1) / D);
}
PT ComputeCircleCenter(PT a, PT b, PT c) {
  b = (a + b) / 2;
  c = (a + c) / 2;
  return ComputeLineIntersection(b, b + RotateCW90(a - b), c,
                                 c + RotateCW90(a - c));
}
bool PointOnBoundaryOfPolygon(const vector<PT> p, PT q) {
  int s = p.size();
  for (int i = 0, j = s - 1; i < s; j = i++) {
    if (PointOnSegment(q, p[j], p[i])) return true;
  }
  return false;
}
bool PointInPolygon(const vector<PT> p, PT q) {
  bool c = 0;
  int s = p.size();
  for (int i = 0, j = s - 1; i < s; j = i++) {
    if (((p[i].y > q.y) != (p[j].y > q.y)) &&
        (q.x < p[i].x + (p[j].x - p[i].x) * (q.y - p[i].y) / (p[j].y - p[i].y)))
      c = !c;
  }
  return c;
}
vector<PT> CircleLineIntersection(PT a, PT b, PT c, double r) {
  vector<PT> ret;
  b = b - a;
  a = a - c;
  double A = dot(b, b);
  double B = dot(a, b);
  double C = dot(a, a) - r * r;
  double D = B * B - A * C;
  if (D < -EPS) return ret;
  ret.push_back(c + a + b * (-B + sqrt(D + EPS)) / A);
  if (D > EPS) ret.push_back(c + a + b * (-B - sqrt(D)) / A);
  return ret;
}
vector<PT> CircleCircleIntersection(PT c1, PT c2, double r1, double r2) {
  vector<PT> ret;
  double d = dist2D(c1, c2);
  if (d > r1 + r2 || d + min(r1, r2) < max(r1, r2)) return ret;
  double x = (d * d - r2 * r2 + r1 * r1) / (2.0 * d);
  double y = sqrt(r1 * r1 - x * x);
  PT v = (c2 - c1) / d;
  ret.push_back(c1 + v * x + RotateCCW90(v) * y);
  if (y > 0) ret.push_back(c1 + v * x - RotateCCW90(v) * y);
  return ret;
}
double ComputeSignedArea(const vector<PT> p) {
  double area = 0.0;
  for (int i = 0; i < p.size(); i++) {
    int j = (i + 1) % p.size();
    area += p[i].x * p[j].y - p[j].x * p[i].y;
  }
  return area / 2.0;
}
double ComputeArea(const vector<PT> p) { return fabs(ComputeSignedArea(p)); }
PT ComputeCentroid(const vector<PT> p) {
  PT c = PT(0.0, 0.0);
  double scale = 6.0 * ComputeSignedArea(p);
  for (int i = 0; i < p.size(); i++) {
    int j = (i + 1) % p.size();
    c = c + (p[i] + p[j]) * (p[i].x * p[j].y - p[j].x * p[i].y);
  }
  return c / scale;
}
bool IsSimple(const vector<PT> p) {
  for (int i = 0; i < p.size(); i++) {
    for (int k = i + 1; k < p.size(); k++) {
      int j = (i + 1) % p.size();
      int l = (k + 1) % p.size();
      if (i == l || j == k) continue;
      if (SegmentsIntersect(p[i], p[j], p[k], p[l])) return false;
    }
  }
  return true;
}
pair<PT, PT> GetParallelLine(PT a, PT b, double d) {
  return make_pair(PointAlongLine(a, RotateCCW90(b - a) + a, d),
                   PointAlongLine(b, RotateCW90(a - b) + b, d));
}
pair<PT, PT> GetPerpendicularLine(PT a, PT b, PT c) {
  return make_pair(RotateCCW90(a - c) + c, RotateCCW90(b - c) + c);
}
vector<PT> HalfPlaneIntersection(vector<PT> poly, pair<PT, PT> ln) {
  vector<PT> ret;
  int s = poly.size();
  for (int i = 0; i < s; i++) {
    double c1 = cross(ln.second - ln.first, poly[i] - ln.first);
    double c2 = cross(ln.second - ln.first, poly[(i + 1) % s] - ln.first);
    if (EQ(c1) >= 0) ret.push_back(poly[i]);
    if (EQ(c1 * c2) < 0) {
      if (!LinesParallel(poly[i], poly[(i + 1) % s], ln.first, ln.second)) {
        ret.push_back(ComputeLineIntersection(poly[i], poly[(i + 1) % s],
                                              ln.first, ln.second));
      }
    }
  }
  return ret;
}
double DistancePointPlane(double x, double y, double z, double a, double b,
                          double c, double d) {
  return fabs(a * x + b * y + c * z - d) / sqrt(a * a + b * b + c * c);
}
int orientation(PT p, PT q, PT r) {
  double val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
  if (val == 0.0)
    return 0;
  else if (val > 0.0)
    return 1;
  else
    return -1;
}
vector<PT> convex_hull(vector<PT> vec) {
  sort(vec.begin(), vec.end());
  PT p1, p2;
  stack<PT> low;
  stack<PT> up;
  for (int i = 0; i < (int)vec.size(); i++) {
    while ((int)low.size() >= 2) {
      p2 = low.top();
      low.pop();
      p1 = low.top();
      if (orientation(p1, p2, vec[i]) < 0) {
        low.push(p2);
        break;
      }
    }
    low.push(vec[i]);
  }
  for (int i = (int)vec.size() - 1; i >= 0; i--) {
    while ((int)up.size() >= 2) {
      p2 = up.top();
      up.pop();
      p1 = up.top();
      if (orientation(p1, p2, vec[i]) < 0) {
        up.push(p2);
        break;
      }
    }
    up.push(vec[i]);
  }
  low.pop();
  up.pop();
  vector<PT> ret;
  while (!up.empty()) {
    ret.push_back(up.top());
    up.pop();
  }
  while (!low.empty()) {
    ret.push_back(low.top());
    low.pop();
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
int main() {
  int a[8];
  while (scanf("%d %d %d %d", &a[1], &a[2], &a[3], &a[4]) == 4) {
    scanf("%d %d", &a[5], &a[6]);
    int x = a[2] + a[3] + a[4];
    int ans = ((x) * (x));
    ans = ans - ((a[2]) * (a[2])) - ((a[4]) * (a[4])) - ((a[6]) * (a[6]));
    printf("%d\n", ans);
  }
  return 0;
}

```