Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/54a57cdcf7e3755ea687c12508bd83854e033ec3.png" style="max-width: 100.0%;max-height: 100.0%;"/>. 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.
The first and the single line of the input contains 6 space-separated integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, *a*<sub class="lower-index">3</sub>, *a*<sub class="lower-index">4</sub>, *a*<sub class="lower-index">5</sub> and *a*<sub class="lower-index">6</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 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.
class CodeforcesTask559ASolution:
    def __init__(self):
        self.result = ''
        self.a = []

    def read_input(self):
        self.a = [int(x) for x in input().split(" ")]

    def process_task(self):
        dir_left_left = True
        dir_right_right = True
        last_width = self.a[2]
        height = self.a[0] + self.a[1]
        pos = 0
        triangles = 0
        going_left = self.a[1]
        going_right = self.a[3]
        while pos < height:
            width = last_width
            if dir_left_left and dir_right_right:
                width += 1
            elif not dir_left_left and not dir_right_right:
                width -= 1
            if dir_left_left:
                going_left -= 1
                if not going_left:
                    dir_left_left = False
            if dir_right_right:
                going_right -= 1
                if not going_right:
                    dir_right_right = False
            triangles += last_width + width
            last_width = width
            pos += 1
        self.result = str(triangles)

    def get_result(self):
        return self.result


if __name__ == "__main__":
    Solution = CodeforcesTask559ASolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())
