Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . 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 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.

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

NoteThis is what Gerald's hexagon looks like in the first sample:And that's what it looks like in the second sample:

using System;
using System.Linq;

namespace CSharp
{
    public class _559A
    {
        public static void Main()
        {
            int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();
            Console.WriteLine((a[0] + 2 * a[1] + a[2]) * (a[2] + a[3]) - (a[0] * a[0] + a[2] * a[2] + a[3] * a[3] + a[5] * a[5]) / 2);
        }
    }
}

using System;
using System.Globalization;
using System.IO;
using System.Text;
using static System.Math;
using static System.Console;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    public void Solve()
    {
      var a = input.ReadIntArray(6);
      var p = a[0] + a[1] + a[2];
      Write(p * p - a[0] * a[0] - a[2] * a[2] - a[4] * a[4]);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public string ReadToEnd()
    {
      return reader.ReadToEnd();
    }

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
      var result = (char)c - '0';
      c = reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
        result = result * 10 + (char)c - '0';
        c = reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() =>
      (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() =>
      (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() =>
      (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
	public static void Main()
	{
		var a=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

		Console.WriteLine((a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-a[0]*a[0]-a[2]*a[2]-a[4]*a[4]);
	}
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var l = getList();
			var ans = (l[0] + l[1] + l[2]) * (l[0] + l[1] + l[2]) - l[0] * l[0] - l[2] * l[2] - l[4] * l[4];
			Console.WriteLine(ans);
			/*			input.Close();
			output.Close();*/
		}
	}
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    public static class MainClass
    {

        static int ReadIntLine()
        {
            return int.Parse(Console.ReadLine());
        }

        static void ReadInt(ref int a)
        {
            a = ReadIntArrayLine()[0];
        }

        static void ReadInts(ref int a, ref int b)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1];
        }

        static void ReadInts(ref int a, ref int b, ref int c)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2];
        }

        static void ReadInts(ref int a, ref int b, ref int c, ref int d)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2]; d = x[3];
        }

        static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];
        }

        static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];
        }

        static int[] ReadIntArrayLine()
        {
            char[] sep = { ' ' };
            return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static void PrintLn(object obj)
        {
            Console.WriteLine(obj.ToString());
        }

        public static string Reverse(string s)
        {
            char[] charArray = s.ToCharArray();
            Array.Reverse(charArray);
            return new string(charArray);
        }

        public static void PrintLnCollection<T>(IEnumerable<T> col)
        {
            PrintLn(string.Join(" ", col));
        }

        public static void PrintLn(params object[] v)
        {
            PrintLnCollection(v);
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static string MySubstring(this string str, int start, int finish)
        {
            if (start > finish) return "";
            return str.Substring(start, finish - start + 1);
        }

        public static bool IsInRange(this int a, int lb, int ub)
        {
            return (a >= lb) && (a <= ub);
        }

        private static void mergeDS(int i, int j, int[] a)
        {
            int t = a[j];
            for (int ii = 0; ii < a.Length; ii++)
            {
                if (a[ii] == t)
                    a[ii] = a[i];
            }
        }

        private static T MyMax<T>(params T[] a)
        {
            return a.Max();
        }

        private static T MyMin<T>(params T[] a)
        {
            return a.Min();
        }

        private static int[] GetPrimesLessThan(int x)
        {
            if (x < 2)
                return new int[0];

            int[] a = new int[x];

            a[0] = 1; a[1] = 1;

            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] == 0)
                    for (int j = 2 * i; j < a.Length; j += i)
                    {
                        a[j] = 1;
                    }
            }

            var abc = new List<int>(x);

            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] == 0)
                    abc.Add(i);
            }

            return abc.ToArray();
        }

        private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)
        {
            if (startIndex == endIndex)
            {
                if (a[startIndex] <= target)
                    return startIndex;
                else
                    return -1;
            }

            if (startIndex + 1 == endIndex)
            {
                if (a[endIndex] <= target)
                    return endIndex;
                else if (a[startIndex] <= target)
                    return startIndex;
                else
                    return -1;
            }

            int mid = (startIndex + endIndex) / 2;
            if (target == a[mid])
                return mid;
            else if (target < a[mid])
                return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);
            else
                return FindNearestLEQElementInTheArray(a, mid, endIndex, target);
        }

        private static int FindNearestLEQElementInTheArray(int[] a, int target)
        {
            return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);
        }

        private static int gcd(int a, int b)
        {
            int r = a % b;
            while (r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }
            return b;
        }

        //----------------------------------------------------------------------------

        static string GetSha1(string filePath)
        {
            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            using (BufferedStream bs = new BufferedStream(fs))
            {
                using (SHA1Managed sha1 = new SHA1Managed())
                {
                    byte[] hash = sha1.ComputeHash(bs);
                    StringBuilder formatted = new StringBuilder(2 * hash.Length);
                    foreach (byte b in hash)
                    {
                        formatted.AppendFormat("{0:X2}", b);
                    }

                    return formatted.ToString();
                }
            }
        }

        static bool canFit(int a1, int b1, int a2, int b2)
        {
            int[] r1 = { a1, b1 };
            int[] r2 = { a2, b2 };

            Array.Sort(r1);
            Array.Sort(r2);

            bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);

            return ans;

        }

        static void Main(string[] args)
        {

            int[] a = ReadIntArrayLine();

            int s = a[0] + a[1] + a[2];

            PrintLn(s * s - a[0] * a[0] - a[2] * a[2] - a[4] * a[4]);

        }

    }
}

using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;

namespace Program
{

    public class Solver
    {
        public void Solve()
        {
            var A = new long[5000];
            A[1] = 1;
            for (int i = 2; i < 5000; i++)
                A[i] += A[i - 1] + 2;
            for (int i = 2; i < 5000; i++)
                A[i] += A[i - 1];
            var a = sc.Integer(6);
            var top = a[0];
            var height = a[0] + a[1] + a[2];
            var right = a[2];
            var left = a[4];
            IO.Printer.Out.WriteLine(A[height] - A[top] - A[right] - A[left]);

        }
        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}
#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer : StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion

using System;
using System.IO;
using System.Text;

namespace Geralds_Hexagon
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            double a1 = Next();
            double a2 = Next();
            double a3 = Next();
            double a4 = Next();
            double a5 = Next();
            double a6 = Next();
            double sin60 = Math.Sin(Math.PI*60/180);
            double sin120 = Math.Sin(Math.PI*120/180);

            double s = (a1 + a4)*sin60*(a2 + a3) + sin120*a2*a3 + sin120*a5*a6;
            double count = s/sin60;

            writer.WriteLine(Math.Round(count));
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace ConsoleApplication1
{
    class Program : ProgramBase
    {
        protected override string GetFilename()
        {
            return "railway";
        }

        static void Main(string[] args)
        {
            var p = new Program();
            checked
            {
                var x = p.Get();
                p.Out(x);
            }
        }

        object Get()
        {
            var a = ReadInts();
            var first = a[0];
            var second = Math.Min(a[1], a[5]);
            var third = Math.Max(a[1], a[5]);
            var fourth = Math.Min(a[2], a[4]);
            var fifth = Math.Max(a[2], a[4]);
            var sixth = a[3];
            var result = 0;
            var currentWidth = first;
            for (int i = 0; i < second; i++)
            {
                result += 2 * currentWidth + 1;
                currentWidth++;
            }

            for (int i = second; i < third; i++)
            {
                result += 2 * currentWidth;
            }

            for (int i = third; i < third + fourth; i++)
            {
                result += 2 * currentWidth - 1;
                currentWidth--;
            }
            return result;
        }
    }
    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;

        protected abstract string GetFilename();

        protected string Read()
        {
            return Console.ReadLine();
            if (f == null)
                f = new StreamReader((GetProd() ? "" : "c:\\dev\\") + GetFilename() + ".in");
            return f.ReadLine();
        }

        protected int ReadInt()
        {
            return Convert.ToInt32(Read());
        }
        protected int[] ReadInts()
        {
            return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
        }

        protected long ReadLong()
        {
            return Convert.ToInt64(Read());
        }

        protected long[] ReadLongs()
        {
            return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();
        }

        public void Out(object r)
        {
            Console.WriteLine(r);
            //if (GetProd())
            //    File.WriteAllText(GetFilename() + ".out", r.ToString());
            //else
            //    Console.WriteLine(r);
        }

        private bool GetProd()
        {
            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-NB-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func)
        {
            T result = default(T);
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> source, string delimeter)
        {
            return string.Join(delimeter, source.ToArray());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double pi=3.14159265358979323846264338327950288;
            int[] R = new int[6];
            string [] a=Console.ReadLine().Split(' ');
            for (int i = 0; i < 6; i++)
                R[i] = int.Parse(a[i]);

            double s1 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[0] * R[1]);
            double s2 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[2] * R[3]);
            double s3 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[4] * R[5]);
            double s4 = Math.Abs((R[0] + 0.5 * R[1]) * (R[5] + R[4]) * Math.Cos(30.0 / 180.0 * pi)
                - R[1] * Math.Sin(60.0 / 180.0 * pi) *0.5* (-R[5]  + R[4]));
            double s = s1 + s2 + s3 + s4;
            double k = s / Math.Sin(60.0 / 180.0 * pi);
            Console.WriteLine((int)k);

          //Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            Console.Write((a[0] + a[1] + a[2]) * (a[0] + a[1] + a[2]) - a[0] * a[0] - a[2] * a[2] - a[4] * a[4]);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _559A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();

            int a1 = Convert.ToInt32(str[0]);
            int a2 = Convert.ToInt32(str[1]);
            int a3 = Convert.ToInt32(str[2]);
            int a5 = Convert.ToInt32(str[4]);

            int answer = (int)(Math.Pow(a1 + a2 + a3, 2) - Math.Pow(a1, 2) - Math.Pow(a3, 2) - Math.Pow(a5, 2));

            Console.WriteLine(answer);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int Fun(int a, int b)
    {
        return b * (2 * a + b);
    }

    void Solve()
    {
        var a = ReadIntArray();
        int ans;
        if (a[0] == a[2])
            ans = Fun(a[1], a[0]) + Fun(a[4], a[3]);
        else if (a[0] < a[2])
            ans = Fun(a[1], a[0]) + Fun(a[4], a[3]) + (a[0] + a[1]) * 2 * (a[2] - a[0]);
        else
            ans = Fun(a[1], a[2]) + Fun(a[4], a[5]) + (a[2] + a[1]) * 2 * (a[0] - a[2]);

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
            //            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //            thread.Start();
            //            thread.Join();
            checked
            {
                new Solver().Solve();
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public PairVariable()
    {
        a = b = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;
    }

    public int CompareTo(PairVariable other)
    {
        return other.a.CompareTo(this.a);
    }
}

namespace ConsoleApplication254
{

    class Program
    {
		static double scalar(int x1,int y1,int x2,int y2,int x3,int y3)
		{
			return (x2-x1)*(x3-x2)+(y2-y1)*(y3-y2);
		}
        static bool foo(double d1, double d2, double d3)
        {
            double a1=(d1*d1)+(d3*d3)-(d2*d2);
			double a2=(d2*d2)+(d3*d3)-(d1*d1);
			bool f=a1>0&&a2>0;
			return f;
        }
        static void Main(string[] args)
        {
			string[]ss=Console.ReadLine().Split();
			int[]m=new int[6];
			for(int i=0; i<6; i++)
			{
				m[i]=int.Parse(ss[i]);
			}
			Console.WriteLine((m[0]+m[1]+m[2])*(m[0]+m[1]+m[2])-(m[0]*m[0])-(m[2]*m[2])-m[4]*m[4]);
		}
    }
}

using System;

namespace _559A.Gerald_s_Hexagon
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] tok = line.Split(' ');
            int[] sides = new int[tok.Length];
            int a1, a2, a3, n;
            for (int i = 0; i < tok.Length; i++)
            {
                sides[i] = int.Parse(tok[i]);
            }
            a1 =tessalate( sides[0]);
            a2 = tessalate(sides[2]);
            a3 = tessalate(sides[4]);
            n = tessalate(sides[0] + sides[1] + sides[2]);
            Console.WriteLine("{0}", n-(a1+a2+a3));

        }
        static int tessalate (int n)
        {
            int suma = 0;
            while(n>0)
            {
                suma += n;
                n--;
                suma += n;
            }
            return suma;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int a1, a2, a3, a4, a5, a6;
            string[] strin1 = Console.ReadLine().Split(' ');
            a1 = int.Parse(strin1[0]);
            a2 = int.Parse(strin1[1]);
            a3 = int.Parse(strin1[2]);
            a4 = int.Parse(strin1[3]);
            a5 = int.Parse(strin1[4]);
            a6 = int.Parse(strin1[5]);
            int sum = (a1 + a2 + a3) * (a1 + a2 + a3) - (a1 * a1) - (a3 * a3) - (a5 * a5);
            Console.WriteLine(sum);
            Console.ReadLine();
        }

    }
}

using System;

namespace The_Circumference_of_the_Circle
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split();
            long a1 = long.Parse(line[0]);
            long a2 = long.Parse(line[1]);
            long a3 = long.Parse(line[2]);
            long a4 = long.Parse(line[3]);
            long a5 = long.Parse(line[4]);
            long a6 = long.Parse(line[5]);

            long lines = a1 + a2 + a6;
            long total = 0;
            for (int i = 1; i <= lines; i++)
                total += (long)(2 * i) - 1;

            for (int i = 1; i <= a2; i++)
                total -= (long)(2 * i) - 1;
            for (int i = 1; i <= a4; i++)
                total -= (long)(2 * i) - 1;
            for (int i = 1; i <= a6; i++)
                total -= (long)(2 * i) - 1;

            Console.WriteLine(total);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gerald_s_Hexagon
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = GetInt(), b = GetInt(), c = GetInt(), d = GetInt(), e = GetInt(), f = GetInt();
            Console.Write((a + b + c) * (a + b + c) - a * a - c * c - e * e);
        }

        static int GetInt()
        {
            int n = 0;
            char c = '\0';
            while (!Char.IsDigit(c))
                c = Convert.ToChar(Console.Read());

            while (Char.IsDigit(c))
            {
                n *= 10;
                n += c - '0';
                c = Convert.ToChar(Console.Read());
            }
            return n;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeforcesSolver
{
    class Program
    {
        static void Main()
        {
            double striangle = Math.Sqrt(3)/4;
            var a = ReadArrayInt();

            var alpha = 2*Math.PI/3;

            double m0 = a[1]*Math.Sin(alpha) - a[2]*Math.Sin(alpha*2) + a[3]*Math.Sin(alpha*3) - a[4]*Math.Sin(alpha*4);
            double m1 = a[2]*Math.Sin(alpha) - a[3]*Math.Sin(alpha*2) + a[4]*Math.Sin(alpha*3);
            double m2 = a[3]*Math.Sin(alpha) - a[4]*Math.Sin(alpha*2);
            double m3 = a[4]*Math.Sin(alpha);

            double s = (a[0]*m0 + a[1]*m1 + a[2]*m2 + a[3]*m3)/2;

            int cnt = (int) Math.Round(s/striangle);

            Console.WriteLine(cnt);
        }

        #region Handy

        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        public static int[] ReadArrayInt()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));
        }

        public static string[] ReadArrayString()
        {
            return Console.ReadLine().Split(' ');
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace TopCoder
{
    class Zagotovka
    {

        public static void print(List<int> obj)
        {
            Console.Write("{");
            for (int i = 0; i < obj.Count; i++)
            {
                print(obj[i]);
            }
            Console.Write("}");
        }

        public static void print(ValueType obj)
        {
            Console.Write(obj + " ");
        }

        public static void print(string obj)
        {
            Console.Write(obj + " ");
        }

        public static void print(Type obj)
        {
            Console.Write(obj + " ");
        }

        public static void print(Array obj)
        {
            Console.Write("[");
            for (int i = 0; i < obj.Length; i++)
            {
                print(obj.GetValue(i));
            }
            Console.Write("]");
        }

        public static void print(List<int[]> obj)
        {
            Console.Write("{");
            for (int i = 0; i < obj.Count; i++)
            {
                print(obj[i]);
            }
            Console.Write("}");
        }

        public static void print(List<long> obj)
        {
            Console.Write("{");
            for (int i = 0; i < obj.Count; i++)
            {
                print(obj[i]);
            }
            Console.Write("}");
        }

        public static void print(List<string> obj)
        {
            Console.Write("{");
            for (int i = 0; i < obj.Count; i++)
            {
                print(obj[i]);
            }
            Console.Write("}");
        }

        public static void print(List<List<int>> obj)
        {
            Console.Write("{");
            for (int i = 0; i < obj.Count; i++)
            {
                print(obj[i]);
            }
            Console.Write("}");
        }

        public static void print(object obj)
        {
            Console.Write(obj);
            Console.Write(" ");
        }

        public static void println(List<int> obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(ValueType obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(string obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(Type obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(Array obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(List<int[]> obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(List<long> obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(List<string> obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(List<List<int>> obj)
        {
            print(obj);
            Console.WriteLine();
        }

        public static void println(object obj)
        {
            Console.Write(obj);
            Console.Write(" ");
        }

        public class Scanner
        {
            List<string> array = new List<string>();
            int pos = 0;
            public Scanner()
            {
                while (true)
                {
                    string next = Console.ReadLine();
                    if (next != null && next.Length > 0)
                    {
                        array.AddRange(next.Split(' '));
                    }
                    else
                    {
                        break;
                    }
                }
            }

            public int nextInt()
            {
                if (pos == array.Count)
                {
                    throw new ArgumentException("Arguments are gone");
                }
                int res = Int32.Parse(array[pos]);
                pos++;
                return res;
            }

            public long nextLong()
            {
                if (pos == array.Count)
                {
                    throw new ArgumentException("Arguments are gone");
                }
                long res = Int64.Parse(array[pos]);
                pos++;
                return res;
            }

            public string nextString()
            {
                if (pos == array.Count)
                {
                    throw new ArgumentException("Arguments are gone");
                }
                string res = array[pos];
                pos++;
                return res;
            }

            public char nextChar()
            {
                if (pos == array.Count)
                {
                    throw new ArgumentException("Arguments are gone");
                }
                char res = array[pos][0];
                pos++;
                return res;
            }

            public double nextDouble()
            {
                if (pos == array.Count)
                {
                    throw new ArgumentException("Arguments are gone");
                }
                double res = Double.Parse(array[pos]);
                pos++;
                return res;
            }

            public List<int> nextArray(int n)
            {
                List<int> res = new List<int>();
                for (int i = 0; i < n; i++)
                {
                    res.Add(nextInt());
                }
                return res;
            }

            public List<double> nextArrayDouble(int n)
            {
                List<double> res = new List<double>();
                for (int i = 0; i < n; i++)
                {
                    res.Add(nextDouble());
                }
                return res;
            }

            public List<long> nextArrayLong(int n)
            {
                List<long> res = new List<long>();
                for (int i = 0; i < n; i++)
                {
                    res.Add(nextLong());
                }
                return res;
            }

            public List<string> nextArrayString(int n)
            {
                List<string> res = new List<string>();
                for (int i = 0; i < n; i++)
                {
                    res.Add(nextString());
                }
                return res;
            }
        }

        public class MultyArray<T>
        {
            int n;
            int[] lens;
            T[] array;
            int[] ks;

            public MultyArray(params int[] lens)
            {
                n = lens.Length;

                this.lens = new int[n];
                for (int i = 0; i < n; i++)
                {
                    this.lens[i] = lens[i] + 1;
                }

                ks = new int[n + 1];
                int prod = 1;
                for (int i = 0; i < n; i++)
                {
                    ks[i] = prod;
                    prod *= this.lens[i];
                }
                ks[n] = prod;

                array = new T[prod];
            }

            public int index(params int[] args)
            {
                int q = args.Length;
                int res = 0;
                for (int i = 0; i < q; i++)
                {
                    res += args[i] * ks[i];
                }

                return res;
            }

            public T get(params int[] args)
            {
                return array[index(args)];
            }

            public void set(T value, params int[] args)
            {
                array[index(args)] = value;
            }

            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public int _index(params int[] args)
            {
                int q = args.Length;

                int res = 0;
                for (int i = 0; i < q; i++)
                {
                    res += (args[i] + (lens[i] >> 1)) * ks[i];
                }

                /*
                if (q == 2)
                {
                    return (args[0] + (lens[0] << 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1];
                }

                if(q == 1){
                    return (args[0] + (lens[0] >> 1)) * ks[0];
                }

                if (q == 3)
                {
                    return (args[0] + (lens[0] >> 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1] + (args[2] + (lens[2] >> 1)) * ks[2];
                }

                if (q == 4)
                {
                    return (args[0] + (lens[0] >> 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1] + (args[2] + (lens[2] >> 1)) * ks[2] + (args[3] + (lens[3] >> 1)) * ks[3];
                }
                 * */

                return res;
            }

            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public T _get(params int[] args)
            {
                return array[_index(args)];
            }

            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public void _set(T value, params int[] args)
            {
                array[_index(args)] = value;
            }

            public override string ToString()
            {
                StringBuilder res = new StringBuilder();
                return res.ToString();
            }
        }

        public class DP<T>
        {
            public delegate T Solve(DP<T> dp, params int[] args);

            public MultyArray<T> array;
            public MultyArray<bool> exist;
            public int[] lens;
            public int[] ks;

            private Solve solve;

            public DP(Solve solve, params int[] lens)
            {
                this.lens = lens;

                ks = new int[lens.Length + 1];
                int prod = 1;
                for (int i = 0; i < lens.Length; i++)
                {
                    ks[i] = prod;
                    prod *= this.lens[i] + 1;
                }
                ks[lens.Length] = prod;

                int[] newLens = new int[lens.Length];
                for (int i = 0; i < newLens.Length; i++)
                {
                    newLens[i] = lens[i] * 2;
                }

                this.array = new MultyArray<T>(newLens);
                this.exist = new MultyArray<bool>(newLens);

                this.solve = solve;
            }

            public T dp(params int[] args)
            {
                /*
                int[] newArgs = new int[args.Length];
                for (int i = 0; i < args.Length; i++)
                {
                    newArgs[i] = args[i] + lens[i];
                }
                 * */

                if (exist._get(args))
                {
                    return array._get(args);
                }
                T value = solve(this, args);
                array._set(value, args);
                exist._set(true, args);
                return value;
            }

            public int[] indexToArgs(int index)
            {
                int[] res = new int[lens.Length];
                for (int i = 0; i < lens.Length; i++)
                {
                    res[i] = (index / ks[i]) % (lens[i] + 1);
                }
                return res;
            }

            public int index(params int[] args)
            {
                int q = args.Length;
                int res = 0;
                for (int i = 0; i < q; i++)
                {
                    res += args[i] * ks[i];
                }

                return res;
            }

            public T run(params int[] args)
            {
                int maxIndex = index(args);

                for (int i = 0; i <= maxIndex; i++)
                {
                    int[] a = indexToArgs(i);
                    dp(a);
                }

                return dp(args);
            }
        }

        public static T min<T>(T first, params T[] array) where T : IComparable
        {
            T res = first;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].CompareTo(res) < 0)
                {
                    res = array[i];
                }
            }
            return res;
        }

        public static T max<T>(T first, params T[] array) where T : IComparable
        {
            T res = first;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].CompareTo(res) > 0)
                {
                    res = array[i];
                }
            }
            return res;
        }

        public static int gcd(int a, int b)
        {
            if (b != 0)
            {
                return a;
            }
            else
            {
                return gcd(b, a % b);
            }
        }

        public static bool[] sieve(int bound)
        {
            bool[] array = new bool[bound + 1];
            for (int i = 2; i * i <= bound; i++)
            {
                if (!array[i])
                {
                    for (int j = i + i; j <= bound; j += i)
                    {
                        array[j] = true;
                    }
                }
            }
            return array;
        }

        public static List<int> sieveList(int bound)
        {
            bool[] array = new bool[bound + 1];
            for (int i = 2; i * i <= bound; i++)
            {
                if (!array[i])
                {
                    for (int j = i + i; j <= bound; j += i)
                    {
                        array[j] = true;
                    }
                }
            }

            List<int> a = new List<int>();
            for (int i = 2; i < bound + 1; i++)
            {
                if (!array[i])
                {
                    a.Add(i);
                }
            }

            return a;
        }

        public static List<int[]> factorize(int n, List<int> primeList)
        {
            List<int[]> res = new List<int[]>();
            for (int j = 0; j < primeList.Count; j++)
            {
                int i = primeList[j];
                if (n % i == 0)
                {
                    int[] comp = new int[] { i, 1 };
                    n /= i;
                    while (n % i == 0)
                    {
                        comp[1] = comp[1] + 1;
                        n /= i;
                    }
                    res.Add(comp);
                }
            }

            if (n > 1)
            {
                res.Add(new int[] { n, 1 });
            }
            return res;
        }

        public static List<int> genDivisors(int n)
        {
            List<int> res = new List<int>();
            int root = (int)(Math.Sqrt(n) + 1);
            for (int i = 1; i < root; i++)
            {
                if (n % i == 0)
                {
                    if (n / i != i)
                    {
                        res.Add(i);
                        res.Add(n / i);
                    }
                    else
                    {
                        res.Add(i);
                    }
                }
            }
            return res;
        }

        public static int fact(int n)
        {
            return n == 1 ? 1 : n * fact(n - 1);
        }

        public static List<List<int>> genPermutations(int n)
        {
            List<List<int>> res = new List<List<int>>();
            List<int> current = new List<int>();
            for (int i = 0; i < n; i++)
            {
                current.Add(i + 1);
            }

            int numberOfPerms = fact(n);

            {
                List<int> newList = new List<int>();
                newList.AddRange(current);
                res.Add(newList);
            }

            for (int i = 0; i < numberOfPerms - 1; i++)
            {
                int j = n - 2;
                while (j != -1 && current[j] > current[j + 1]) j--;
                int k = n - 1;
                while (current[j] > current[k]) k--;
                {
                    int temp = current[j];
                    current[j] = current[k];
                    current[k] = temp;
                }

                int l = j + 1, r = n - 1;
                while (l < r)
                {
                    int temp = current[l];
                    current[l] = current[r];
                    current[r] = temp;
                    l++;
                    r--;
                }

                List<int> newList = new List<int>();
                newList.AddRange(current);
                res.Add(newList);
            }

            return res;
        }

        public static int pow(int n, int k)
        {
            if (k == 0)
            {
                return 1;
            }
            else
            {
                if (k % 2 == 1)
                {
                    return pow(n, k - 1) * n;
                }
                else
                {
                    int q = pow(n, k / 2);
                    return q * q;
                }
            }

        }

        public static int SolveDP(DP<int> dp, params int[] args)
        {
            return 0;
        }

        static double sq(List<Tuple<double, double>> fig)
        {
            double res = 0;
            for (int i = 0; i < fig.Count; i++)
            {
                Tuple<double, double> p1 = i > 0 ? fig[i - 1] : fig[fig.Count - 1];
                Tuple<double, double> p2 = fig[i];
                double add = (p1.Item1 - p2.Item1) * (p1.Item2 + p2.Item2);
                res += add;
            }
            return Math.Abs(res) / 2.0;
        }

        public static Scanner s = new Scanner();

        public static void Main(string[] args)
        {
            List<Tuple<double, double>> res = new List<Tuple<double, double>>();

            res.Add(new Tuple<double, double>(0.0, 0.0));

            double cx = 0;
            double cy = 0;
            double angle = 0;

            for (int i = 0; i < 6; i++)
            {
                double santis = s.nextDouble();
                angle = angle + 60.0 * Math.PI / 180.0;

                cx = cx + Math.Cos(angle) * santis;
                cy = cy + Math.Sin(angle) * santis;

                res.Add(new Tuple<double, double>(cx, cy));
            }
            res.RemoveAt(res.Count - 1);

            double six = sq(res);
            double mn = Math.Sqrt(3.0) / 4.0;

            int rrr = (int)(six/mn+0.000000001);
            Console.WriteLine(rrr);
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    class CodeForces313_3
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader(@"D:\Sergey\Code\CodeForces\CodeForce313\3.txt"));
            string strT = Console.ReadLine();
            string[] strParams = strT.Split(new char[] { ' ' });
            int[] a = new int[6];

            for (int i = 0; i < 6; i++)
            {
                a[i] = int.Parse(strParams[i]);
            }

            int sum = (a[0] * a[1] * 2) +
                      (a[2] * a[3] * 2) +
                      (a[4] * a[5] * 2);

            int t = Math.Abs(a[5] - a[2]);
            int R = 0;
            if (t > 0)
            {
                int p = 0;
                for (int i = 0; i < t; i++)
                {
                    if (i == 0)
                    {
                        R = 1;
                        p = 1;
                    }
                    else
                    {
                        p += 2;
                        R += p;
                    }
                }
            }

            sum += R;
            Console.WriteLine(sum.ToString());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // Input
            string[] tokens = Console.ReadLine().Split(' ');
            int a = int.Parse(tokens[0]);
            int b = int.Parse(tokens[1]);
            int c = int.Parse(tokens[2]);
            int d = int.Parse(tokens[3]);
            int e = int.Parse(tokens[4]);
            int f = int.Parse(tokens[5]);

            // Main Logic
            int total = 0;
            int mode = 1;
            int l = 0;
            int r = 0;
            while (true)
            {
                if (mode == 1)
                {
                    l = f;
                    r = b;
                    int x = Math.Min(l, r);
                    total += (2*a + x)*x;
                    if (l < r)
                    {
                        mode = 2;
                    }
                    else if (l == r)
                    {
                        mode = 4;
                    }
                    else
                    {
                        mode = 3;
                    }
                }
                else if (mode == 2)
                {
                    r = b - f;
                    total += (a + f)*r*2;
                    mode = 4;
                }
                else if (mode == 3)
                {
                    r = f - b;
                    total += (a + b)*r*2;
                    mode = 4;
                }
                else if (mode == 4)
                {
                    r = Math.Min(c, e);
                    total += (2*d + r)*r;
                    break;
                }
            }

            // Output
            Console.WriteLine(total);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NorthStar
{
    class Program
    {
        static IO io;

        static void Main(string[] args)
        {
            io = new IO();

            int[] arr = new int[6];
            for (int i = 0; i < 6; i++)
            {
                arr[i] = io.nextInt();
            }
            Console.WriteLine(sqr(arr[0] + arr[1] + arr[2]) - sqr(arr[0]) - sqr(arr[2]) - sqr(arr[4]));
        }

        private static int sqr(int v)
        {
            return v * v;
        }
    }

    class IO
    {
        private int ptr;
        private string[] input;

        public IO()
        {
            input = new string[0];
            ptr = 0;
        }

        private void readMore()
        {
            while (ptr >= input.Length)
            {
                input = Console.ReadLine().Split();
                ptr = 0;
            }
        }

        public int nextInt()
        {
            readMore();
            return int.Parse(input[ptr++]);
        }

        public long nextLong()
        {
            readMore();
            return long.Parse(input[ptr++]);
        }

        public string next()
        {
            readMore();
            return input[ptr++];
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TaskCGerald
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            double[] a = new double[str.Length];
            for (int i = 0; i < str.Count(); i++)
                a[i] = int.Parse(str[i]);
            double sqrt3 = Math.Sqrt(3);
            double triangleSquare = sqrt3 / 8;
            double square = ((a[4] + a[5]) * sqrt3 / 2) * ((a[4] + a[2]) / 2 + a[3]);
            square -= a[4] * a[4] / 8 * sqrt3;
            square -= a[5] * a[5] / 8 * sqrt3;
            square -= a[2] * a[2] / 8 * sqrt3;
            square -= a[1] * a[1] / 8 * sqrt3;
            Console.WriteLine((int)Math.Round(square / triangleSquare / 2));
        }
    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _599A
    {
        public static void Main()
        {
            string[] tokens = Console.ReadLine().Split();

            int d1 = int.Parse(tokens[0]);
            int d2 = int.Parse(tokens[1]);
            int d3 = int.Parse(tokens[2]);

            int min = new int[]
            {
                d1 + d1 + d2 + d2,
                d1 + d3 + d3 + d1,
                d1 + d3 + d2,
                d2 + d3 + d3 + d2
            }.Min();

            Console.WriteLine(min);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var l = getList();
			var a1 = l[0];
			var a2 = l[1];
			var ct1 = 2 * a2 + 1;
			var ans = 0;
			for (var i = 1; i <= a1; ++i)
			{
				ans += ct1;
				ct1 += 2;
			}
			ct1 = 2 * a1 + 1;
			for (var i = 1; i <= a2; ++i)
			{
				ans += ct1;
				ct1 += 2;
			}
			Console.WriteLine(ans);
			/*			input.Close();
			output.Close();*/
		}
	}
}

using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;

namespace Program
{

    public class Solver
    {
        public void Solve()
        {
            var a = sc.Integer(6);
            var A = new long[5000];
            A[1] = 3;
            for (int i = 2; i < 5000; i++)
                A[i] = A[i - 1] + 2;
            for (int i = 0; i < 6; i++)
            {
                if (a[(i + 6 - 1) % 6] == a[(i + 1) % 6] && a[(i + 6 - 2) % 6] == a[(i + 2) % 6])
                {
                    var d = A[a[i]];
                    var h = a[(i + 1) % 6];

                    var e = A[a[(i + 3) % 6]];
                    var f = a[(i + 2) % 6];
                    var sum = d * h + e * f;
                    sum += h * (h - 1) + f * (f - 1);
                    IO.Printer.Out.WriteLine(sum);
                    return;
                }
            }
        }
        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}
#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer : StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double e = 0.1;
            int[] R = new int[6];
            string [] a=Console.ReadLine().Split(' ');
            for (int i = 0; i < 6; i++)
                R[i] = int.Parse(a[i]);

            double cos=Math.Cos(30.0*3.14159265 / 180.0);
            double s1 = Math.Abs(cos * R[0] * R[1]);
            double s2 = Math.Abs(cos * R[2] * R[3]);
            double s3 = Math.Abs(cos * R[4] * R[5]);
            double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));
            s1 = s1 + s2 + s3 + s4;
            double k = s1 / cos;
            int n = (int)k;
            if (k - 0.5 < n)

                Console.WriteLine(n);
            else
                Console.WriteLine(n+1);

            //Console.WriteLine("n={0} k={1}",n, k);
          //  Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] R = new int[6];
            string [] a=Console.ReadLine().Split(' ');
            for (int i = 0; i < 6; i++)
                R[i] = int.Parse(a[i]);

            double cos=Math.Cos(30.0*3.14159265 / 180.0);
            double s1 = Math.Abs(cos * R[0] * R[1]);
            double s2 = Math.Abs(cos * R[2] * R[3]);
            double s3 = Math.Abs(cos * R[4] * R[5]);
            double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));
            s1 = s1 + s2 + s3 + s4;
            if (s1 / cos < (int)s1 / cos)
                Console.WriteLine((int)(s1 / cos));
            else
                Console.WriteLine((int)(s1 / cos+1));

           // Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] R = new int[6];
            string [] a=Console.ReadLine().Split(' ');
            for (int i = 0; i < 6; i++)
                R[i] = int.Parse(a[i]);
            double cos=Math.Cos(30.0*3.14159265 / 180.0);
            double s1 = Math.Abs(cos * R[0] * R[1]);
            double s2 = Math.Abs(cos * R[2] * R[3]);
            double s3 = Math.Abs(cos * R[4] * R[5]);
            double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));
            s1 = s1 + s2 + s3 + s4;
            int n = (int)(s1 / cos)+1;
            Console.WriteLine(n);

            //Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] R = new int[6];
            string [] a=Console.ReadLine().Split(' ');
            for (int i = 0; i < 6; i++)
                R[i] = int.Parse(a[i]);

            double cos=Math.Cos(30.0*3.14159265 / 180.0);
            double s1 = Math.Abs(cos * R[0] * R[1]);
            double s2 = Math.Abs(cos * R[2] * R[3]);
            double s3 = Math.Abs(cos * R[4] * R[5]);
            double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));
            s1 = s1 + s2 + s3 + s4;
            if (s1 / cos > (int)s1 / cos)
                Console.WriteLine((int)s1 / cos);
            else
                Console.WriteLine((int)s1 / cos+1);

            //Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double pi=3.14159265358979323846264338327950288;
            int[] R = new int[6];
            string [] a=Console.ReadLine().Split(' ');
            for (int i = 0; i < 6; i++)
                R[i] = int.Parse(a[i]);

            double s1 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[0] * R[1]);
            double s2 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[2] * R[3]);
            double s3 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[4] * R[5]);
            double s4 = Math.Abs((R[0] + 0.5 * R[1]) * (R[5] + R[4]) * Math.Cos(30.0 / 180.0 * pi)
                - R[1] * Math.Sin(60.0 / 180.0 * pi) *0.5* (-R[5]  + R[4]));
            double s = s1 + s2 + s3 + s4;
            double k = s / Math.Sin(60.0 / 180.0 * pi);
            Console.WriteLine(k);
           /* int n = (int)k;
            if (k - 0.5 < n)

                Console.WriteLine(n);
            else
                Console.WriteLine(n+1);*/

            //Console.WriteLine("n={0} k={1}",n, k);
          //Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public PairVariable()
    {
        a = b = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;
    }

    public int CompareTo(PairVariable other)
    {
        return other.a.CompareTo(this.a);
    }
}

namespace ConsoleApplication254
{

    class Program
    {
		static double scalar(int x1,int y1,int x2,int y2,int x3,int y3)
		{
			return (x2-x1)*(x3-x2)+(y2-y1)*(y3-y2);
		}
        static bool foo(double d1, double d2, double d3)
        {
            double a1=(d1*d1)+(d3*d3)-(d2*d2);
			double a2=(d2*d2)+(d3*d3)-(d1*d1);
			bool f=a1>0&&a2>0;
			return f;
        }
        static void Main(string[] args)
        {
			string[]ss=Console.ReadLine().Split();
			int[]m=new int[6];
			for(int i=0; i<6; i++)
			{
				m[i]=int.Parse(ss[i]);
			}
			Array.Sort(m);
			if(m[0]==m[6-1])
			{
				Console.WriteLine(6*m[0]);
			}
			else
			{
				Console.WriteLine(13*(m[6-1]/2));
			}

		}
    }
}

using System;

namespace _559A.Gerald_s_Hexagon
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] tok = line.Split(' ');
            int[] sides = new int[tok.Length+1];
            int tesallate=0,nsum=0,triangle,suma=0;
            for (int i = 0; i < tok.Length; i++)
            {
                sides[i] = int.Parse(tok[i]);
            }
            while(sided_6(sides))
            {
                triangle = 0;
                for (int i = 0; i < sides.Length-1; i++)
                {
                    triangle += sides[i];
                    sides[i]--;
                }

                triangle += triangle - 6;
                tesallate += triangle;
            }
            for (int i = 0; i < sides.Length - 1; i++)
            {
                suma += sides[i];
            }
            if (suma < 6) {
                nsum = suma / 2;
            }
            else
            {
                for (int i = 0; i < sides.Length - 1; i++)
                {
                    if (sides[i] == 1 && sides[i + 1] == 1) { }
                    else
                       nsum += sides[i];
                }
                nsum += nsum / 2;
            }

            Console.WriteLine("{0}", tesallate + nsum);

        }
        static bool sided_6 (int[]sides)
        {
            int count = 0;
            for (int i = 0; i < sides.Length-1; i++)
            {
                if (sides[i] != 0)
                    count++;
            }
            if (count == 6)
                return true;
            else
                return false;
        }
    }
}

using System;

namespace _559A.Gerald_s_Hexagon
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] tok = line.Split(' ');
            int s = 0;
            int k = 7;
            while (k > 6)
            {
                for (int i = 0; i < 6; i++)
                {
                    if (Convert.ToInt32(tok[i]) > 0)
                    {
                        s += Convert.ToInt32(tok[i]);
                        tok[i] = Convert.ToString(Convert.ToInt32(tok[i]) - 1);
                    }
                }
                k = 0;
                for (int j = 0; j < 6; j++)
                {
                    k +=Convert.ToInt32(tok[j]);
                }
            }
            Console.WriteLine("{0}", s + k + k / 2);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var l = getList();
			var a1 = l[0];
			var a2 = l[1];
			var ct1 = 2 * a2 + 1;
			var ans = 0;
			for (var i = 1; i <= a1; ++i)
			{
				ans += ct1;
				ct1 += 2;
			}
			a2 = l[5];
			a1 = l[4];
			ct1 = 2 * a1 + 1;
			for (var i = 1; i <= a2; ++i)
			{
				ans += ct1;
				ct1 += 2;
			}
			Console.WriteLine(ans);
			/*			input.Close();
			output.Close();*/
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeforcesSolver
{
    class Program
    {
        static void Main()
        {
            double striangle = Math.Sqrt(3)/4;
            var a = ReadArrayInt();

            double splitline = a[1] + a[0]/2.0 + a[2]/2.0;
            double s1 = (a[1] + splitline)/2 * Math.Sqrt(3)/2*a[0];
            double s2 = (a[4] + splitline)/2 * Math.Sqrt(3)/2*a[3];

            int s = (int) ((s1 + s2)/striangle);

            Console.WriteLine(s);
        }

        #region Handy

        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        public static int[] ReadArrayInt()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));
        }

        public static string[] ReadArrayString()
        {
            return Console.ReadLine().Split(' ');
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeforcesSolver
{
    class Program
    {
        static void Main()
        {
            double striangle = Math.Sqrt(3)/4;
            var a = ReadArrayInt();

            var alpha = 2*Math.PI/3;

            double m0 = a[1]*Math.Sin(alpha) - a[2]*Math.Sin(alpha*2) + a[3]*Math.Sin(alpha*3) - a[4]*Math.Sin(alpha*4);
            double m1 = a[2]*Math.Sin(alpha) - a[3]*Math.Sin(alpha*2) + a[4]*Math.Sin(alpha*3);
            double m2 = a[3]*Math.Sin(alpha) - a[4]*Math.Sin(alpha*2);
            double m3 = a[4]*Math.Sin(alpha);

            double s = (a[0]*m0 + a[1]*m1 + a[2]*m2 + a[3]*m3)/2;

            Console.WriteLine(s/striangle);
        }

        #region Handy

        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        public static int[] ReadArrayInt()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));
        }

        public static string[] ReadArrayString()
        {
            return Console.ReadLine().Split(' ');
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    class CodeForces313_3
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader(@"D:\Sergey\Code\CodeForces\CodeForce313\3.txt"));
            string strT = Console.ReadLine();
            string[] strParams = strT.Split(new char[] { ' ' });
            int[] a = new int[6];

            for (int i = 0; i < 6; i++)
            {
                a[i] = int.Parse(strParams[i]);
            }

            int sum = (a[0] * a[1] * 2) +
                      (a[2] * a[3] * 2) +
                      (a[4] * a[5] * 2);

            int t = a[5] - a[2];
            int R = 0;
            if (t > 0)
            {
                int p = 0;
                for (int i = 0; i < t; i++)
                {
                    if (i == 0)
                    {
                        R = 1;
                        p = 1;
                    }
                    else
                    {
                        p += 2;
                        R += p;
                    }
                }
            }

            sum += R;
            Console.WriteLine(sum.ToString());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    class CodeForces313_3
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader(@"D:\Sergey\Code\CodeForces\CodeForce313\3.txt"));
            string strT = Console.ReadLine();
            string[] strParams = strT.Split(new char[] { ' ' });
            int[] a = new int[6];

            for (int i = 0; i < 6; i++)
            {
                a[i] = int.Parse(strParams[i]);
            }

            int sum = (a[0] * a[1] * 2) +
                      (a[2] * a[3] * 2) +
                      (a[4] * a[5] * 2);

            int t = a[5] - a[2];
            if (t > 0)
            {
                int R = 0, p = 0;
                for (int i = 0; i < t; i++)
                {
                    if (i == 0)
                    {
                        R = 1;
                        p = 1;
                    }
                    else
                    {
                        p += 2;
                        R += p;
                    }
                }
            }

            sum += t;
            Console.WriteLine(sum.ToString());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // Input
            string[] tokens = Console.ReadLine().Split(' ');
            int a = int.Parse(tokens[0]);
            int b = int.Parse(tokens[1]);
            int c = int.Parse(tokens[2]);
            int d = int.Parse(tokens[3]);
            int e = int.Parse(tokens[4]);
            int f = int.Parse(tokens[5]);

            // Main Logic
            int total = 0;
            int mode = 1;
            int l = 0;
            int r = 0;
            while (true)
            {
                if (mode == 1)
                {
                    l = f;
                    r = b;
                    int x = Math.Min(l, r);
                    total += (2*a + x)*x;
                    if (l < r)
                    {
                        mode = 2;
                    }
                    else if (l == r)
                    {
                        mode = 4;
                    }
                    else
                    {
                        mode = 3;
                    }
                }
                else if (mode == 2)
                {
                    r = b - f;
                    total += (a + f)*(r + 1);
                    mode = 4;
                }
                else if (mode == 3)
                {
                    r = f - b;
                    total += (a + f)*(r + 1);
                    mode = 4;
                }
                else if (mode == 4)
                {
                    r = Math.Min(c, e);
                    total += (2*d + r)*r;
                    break;
                }
            }

            // Output
            Console.WriteLine(total);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TaskCGerald
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int[] a = new int[str.Length];
            for (int i = 0; i < str.Count(); i++)
                a[i] = int.Parse(str[i]);
            double sqrt3 = Math.Sqrt(3);
            double triangleSquare = sqrt3 / 8;
            double square = (a[4] * sqrt3 * 1.0 / 2 + a[5] * sqrt3 * 1.0 / 2) * (a[4]*1.0/2 + a[3] * 1.0 + a[2] * 1.0 / 2);
            square -= a[4] * a[4] * 1.0 / 8 * sqrt3;
            square -= a[5] * a[5] * 1.0 / 8 * sqrt3;
            square -= a[2] * a[2] * 1.0 / 8 * sqrt3;
            square -= a[1] * a[1] * 1.0 / 8 * sqrt3;
            Console.WriteLine(square / triangleSquare / 2.0);
        }
    }
}