#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
#pragma warning(disable : 4996)
#pragma hdrstop
using namespace std;
inline bool isDigit(const char ch) { return (ch >= '0' && ch <= '9'); }
class IO {
 public:
  static const int IO_ERR = -1;
  static const int BUFFER_SIZE = 1 << 18;
  bool eof;
  char curChar;
  IO() : rbCount(0), rbOffset(0), curChar(0), eof(false) {}
  ~IO() { fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout); }
  inline int nextInt();
  IO& operator>>(int& x);
  void newline();
  void printLong(long long x);
  IO& operator<<(long long x);
  IO& operator<<(ostream& (*fn)(ostream&));

 private:
  char readBuffer[BUFFER_SIZE], writeBuffer[BUFFER_SIZE];
  size_t rbCount, rbOffset, wbOffset;
};
extern bool useFastIO;
extern istream* pin;
extern ostream* pout;
extern IO io;
inline int nextInt() {
  if (useFastIO) {
    return io.nextInt();
  }
  int ret;
  *pin >> ret;
  return ret;
}
inline void newline() {
  if (useFastIO) {
    io.newline();
    return;
  }
  *pout << endl;
}
inline void printLong(long long x) {
  if (useFastIO) {
    io.printLong(x);
    return;
  }
  *pout << x;
}
IO io;
int a[8], qx, qy, cw, timer;
long long ans;
void solve(istream& ins, ostream& out) {
  for (int i = 0; i < 6; ++i) {
    io >> a[i];
  }
  cw = (a[0] << 1) ^ 1;
  qx = 5, qy = 1;
  timer = 1;
  ans = 0;
  while (qx > qy) {
    ans += cw;
    if (qx == 5 && timer >= a[5]) {
      --qx;
      ++cw;
    } else if (qx == 4 && timer >= a[5] + a[4]) {
      --qx;
    }
    if (qy == 1 && timer >= a[1]) {
      ++qy;
      ++cw;
    } else if (qy == 2 && timer >= a[1] + a[2]) {
      ++qy;
    }
    if (qy == 1) {
      ++cw;
    } else {
      --cw;
    }
    if (qx == 5) {
      ++cw;
    } else {
      --cw;
    }
    ++timer;
  }
  io << ans << endl;
}
extern class IO io;
bool useFastIO = false;
istream* pin;
ostream* pout;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  useFastIO = true;
  ostream& out = cout;
  out << fixed << setprecision(16);
  pin = &in;
  pout = &out;
  solve(in, out);
  return 0;
}
namespace Random {}
inline int IO::nextInt() {
  while (!eof && !isDigit(curChar) && curChar != '-') {
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        return IO_ERR;
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  bool neg = false;
  if (curChar == '-') {
    neg = true;
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        return IO_ERR;
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  int result = 0;
  while (!eof && isDigit(curChar)) {
    result = (result << 3) + (result << 1) + curChar - '0';
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        return (neg ? -result : result);
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  return (neg ? -result : result);
}
IO& IO::operator>>(int& x) {
  x = ::nextInt();
  return *this;
}
void IO::newline() {
  if (wbOffset == BUFFER_SIZE) {
    fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout);
    wbOffset = 0;
  }
  writeBuffer[wbOffset++] = '\n';
}
void IO::printLong(long long x) {
  if (wbOffset + 22 > BUFFER_SIZE) {
    fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout);
    wbOffset = 0;
  }
  if (x < 0) {
    writeBuffer[wbOffset++] = '-';
    x = -x;
  } else if (!x) {
    writeBuffer[wbOffset++] = '0';
    return;
  }
  int st = wbOffset;
  while (x) {
    writeBuffer[wbOffset++] = x % 10 + '0';
    x /= 10;
  }
  for (int l = st, r = wbOffset - 1; l < r; ++l, --r) {
    char t = writeBuffer[l];
    writeBuffer[l] = writeBuffer[r];
    writeBuffer[r] = t;
  }
}
IO& IO::operator<<(long long x) {
  ::printLong(x);
  return *this;
}
IO& IO::operator<<(ostream& (*fn)(ostream&)) {
  ::newline();
  return *this;
}

### Prompt

Generate 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>
#pragma comment(linker, "/STACK:66777216")
#pragma warning(disable : 4996)
#pragma hdrstop
using namespace std;
inline bool isDigit(const char ch) { return (ch >= '0' && ch <= '9'); }
class IO {
 public:
  static const int IO_ERR = -1;
  static const int BUFFER_SIZE = 1 << 18;
  bool eof;
  char curChar;
  IO() : rbCount(0), rbOffset(0), curChar(0), eof(false) {}
  ~IO() { fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout); }
  inline int nextInt();
  IO& operator>>(int& x);
  void newline();
  void printLong(long long x);
  IO& operator<<(long long x);
  IO& operator<<(ostream& (*fn)(ostream&));

 private:
  char readBuffer[BUFFER_SIZE], writeBuffer[BUFFER_SIZE];
  size_t rbCount, rbOffset, wbOffset;
};
extern bool useFastIO;
extern istream* pin;
extern ostream* pout;
extern IO io;
inline int nextInt() {
  if (useFastIO) {
    return io.nextInt();
  }
  int ret;
  *pin >> ret;
  return ret;
}
inline void newline() {
  if (useFastIO) {
    io.newline();
    return;
  }
  *pout << endl;
}
inline void printLong(long long x) {
  if (useFastIO) {
    io.printLong(x);
    return;
  }
  *pout << x;
}
IO io;
int a[8], qx, qy, cw, timer;
long long ans;
void solve(istream& ins, ostream& out) {
  for (int i = 0; i < 6; ++i) {
    io >> a[i];
  }
  cw = (a[0] << 1) ^ 1;
  qx = 5, qy = 1;
  timer = 1;
  ans = 0;
  while (qx > qy) {
    ans += cw;
    if (qx == 5 && timer >= a[5]) {
      --qx;
      ++cw;
    } else if (qx == 4 && timer >= a[5] + a[4]) {
      --qx;
    }
    if (qy == 1 && timer >= a[1]) {
      ++qy;
      ++cw;
    } else if (qy == 2 && timer >= a[1] + a[2]) {
      ++qy;
    }
    if (qy == 1) {
      ++cw;
    } else {
      --cw;
    }
    if (qx == 5) {
      ++cw;
    } else {
      --cw;
    }
    ++timer;
  }
  io << ans << endl;
}
extern class IO io;
bool useFastIO = false;
istream* pin;
ostream* pout;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  useFastIO = true;
  ostream& out = cout;
  out << fixed << setprecision(16);
  pin = &in;
  pout = &out;
  solve(in, out);
  return 0;
}
namespace Random {}
inline int IO::nextInt() {
  while (!eof && !isDigit(curChar) && curChar != '-') {
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        return IO_ERR;
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  bool neg = false;
  if (curChar == '-') {
    neg = true;
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        return IO_ERR;
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  int result = 0;
  while (!eof && isDigit(curChar)) {
    result = (result << 3) + (result << 1) + curChar - '0';
    if (rbOffset == rbCount) {
      rbCount =
          fread(readBuffer, sizeof(readBuffer[0]), sizeof(readBuffer), stdin);
      if (rbCount <= 0) {
        eof = true;
        return (neg ? -result : result);
      }
      rbOffset = 0;
    }
    curChar = readBuffer[rbOffset++];
  }
  return (neg ? -result : result);
}
IO& IO::operator>>(int& x) {
  x = ::nextInt();
  return *this;
}
void IO::newline() {
  if (wbOffset == BUFFER_SIZE) {
    fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout);
    wbOffset = 0;
  }
  writeBuffer[wbOffset++] = '\n';
}
void IO::printLong(long long x) {
  if (wbOffset + 22 > BUFFER_SIZE) {
    fwrite(writeBuffer, sizeof(writeBuffer[0]), wbOffset, stdout);
    wbOffset = 0;
  }
  if (x < 0) {
    writeBuffer[wbOffset++] = '-';
    x = -x;
  } else if (!x) {
    writeBuffer[wbOffset++] = '0';
    return;
  }
  int st = wbOffset;
  while (x) {
    writeBuffer[wbOffset++] = x % 10 + '0';
    x /= 10;
  }
  for (int l = st, r = wbOffset - 1; l < r; ++l, --r) {
    char t = writeBuffer[l];
    writeBuffer[l] = writeBuffer[r];
    writeBuffer[r] = t;
  }
}
IO& IO::operator<<(long long x) {
  ::printLong(x);
  return *this;
}
IO& IO::operator<<(ostream& (*fn)(ostream&)) {
  ::newline();
  return *this;
}

```