In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of two rectangles. The first rectangle has a width of $$$w_1$$$ and a height of $$$h_1$$$, while the second rectangle has a width of $$$w_2$$$ and a height of $$$h_2$$$, where $$$w_1 \ge w_2$$$. In this game, exactly one ship is used, made up of two rectangles. There are no other ships on the field.The rectangles are placed on field in the following way:  the second rectangle is on top the first rectangle;  they are aligned to the left, i.e. their left sides are on the same line;  the rectangles are adjacent to each other without a gap. See the pictures in the notes: the first rectangle is colored red, the second rectangle is colored blue.Formally, let's introduce a coordinate system. Then, the leftmost bottom cell of the first rectangle has coordinates $$$(1, 1)$$$, the rightmost top cell of the first rectangle has coordinates $$$(w_1, h_1)$$$, the leftmost bottom cell of the second rectangle has coordinates $$$(1, h_1 + 1)$$$ and the rightmost top cell of the second rectangle has coordinates $$$(w_2, h_1 + h_2)$$$.After the ship is completely destroyed, all cells neighboring by side or a corner with the ship are marked. Of course, only cells, which don't belong to the ship are marked. On the pictures in the notes such cells are colored green.Find out how many cells should be marked after the ship is destroyed. The field of the game is infinite in any direction.

Four lines contain integers $$$w_1, h_1, w_2$$$ and $$$h_2$$$ ($$$1 \leq w_1, h_1, w_2, h_2 \leq 10^8$$$, $$$w_1 \ge w_2$$$) — the width of the first rectangle, the height of the first rectangle, the width of the second rectangle and the height of the second rectangle. You can't rotate the rectangles.

Print exactly one integer — the number of cells, which should be marked after the ship is destroyed.

NoteIn the first example the field looks as follows (the first rectangle is red, the second rectangle is blue, green shows the marked squares):  In the second example the field looks as:

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

          string[]y=Console.ReadLine().Split(' ');
          Int64 a=Int64.Parse(y[0]);
          Int64 b=Int64.Parse(y[1]);
          Int64 c=Int64.Parse(y[2]);
          Int64 d=Int64.Parse(y[3]);
          Console.WriteLine((b+d+2)*2+Math.Max(a,c)*2);
        }
    }
}

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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int w1, h1, w2, h2, result;
            string []s;

                s = Console.ReadLine().Split(' ');
                w1 = int.Parse(s[0]);
                h1 = int.Parse(s[1]);
                w2 = int.Parse(s[2]);
                h2 = int.Parse(s[3]);

            result = w1 + h1 + h2 + w2 + h2 + h1;

            if (w1 == w2)
                result += 4;
            else
                result += 5 + (w1 - w2 - 1);
            Console.WriteLine(result);

        }
    }
}

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

namespace Sea_Battle
{
    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)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            int w1 = Next(), h1 = Next(), w2 = Next(), h2 = Next();

            return w1 + 2 + h1*2 + w1 + 2 - w2 + (h2 - 1)*2 + w2 + 2;
        }

        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.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;

class Ph
{
    static void Main()
    {
        var a = Console.ReadLine().Split().Select(int.Parse).ToList();
        //- - - -
        //下の辺
        long res = 0;
        res += a[0] + 2;
        res += a[2] + 2;
        res += (a[1] + a[3]) * 2;
        res += Abs(a[0] - a[2]);
        Console.WriteLine(res);
    }
}

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

namespace SeaBattle
{
    class Program
    {
        public static int Width1;
        public static int Height1;
        public static int Width2;
        public static int Height2;
        public static string InputString = Console.ReadLine();
        static void Main()
        {
            ReadInput();
            Console.WriteLine(CalculateEasy() + CalculateLessEasy());

        }
        static void ReadInput()
        {
            int Length = InputString.Length;
            int NumberCurrent = 0;
            for (int i = 0; i < Length; i++)
            {
                if ("" + InputString[i] == " ")
                {
                    NumberCurrent++;
                }
                else
                {
                    switch (NumberCurrent)
                    {
                        case 0:
                            Width1 = int.Parse(Width1 + "" + InputString[i]);
                            break;
                        case 1:
                            Height1 = int.Parse(Height1 + "" + InputString[i]);
                            break;
                        case 2:
                            Width2 = int.Parse(Width2 + "" + InputString[i]);
                            break;
                        case 3:
                            Height2 = int.Parse(Height2 + "" + InputString[i]);
                            break;

                    }

                }
            }
        }
        static int CalculateEasy()
        {
            int numberOfSquares = 0;
            numberOfSquares = 2 * Height1 + Width1 + 2 + Height2 + Width2 + 2;
            return numberOfSquares;
        }
        static int CalculateLessEasy()
        {
            int numberOfSquares = 0;
            numberOfSquares = (Width1 - Width2 + Height2);
            return numberOfSquares;
        }
    }
}

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

namespace Seabattle
{
    class Program
    {
        static void Main(string[] args)
        {
            /* 4 + h1 + h2 + w1 + w2 + h1 + h2 + abs(w1 - w2);
             w1,h1,w2,h2
            */
            int[] array1D = new int[9];
            array1D = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            int h1 = array1D[1];
            int h2 = array1D[3];
            int w1 = array1D[0];
            int w2 = array1D[2];

            Console.WriteLine(4+h1+h2+w1+w2+h1+h2+Math.Abs(w1-w2));
           // Console.ReadLine();
        }
    }
}

/*
csc -debug A.cs && mono --debug A.exe <<< "2 1 2 1"
*/

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

public class HelloWorld {
    public static void SolveCodeForces() {
        var w1 = cin.NextLong();
        var h1 = cin.NextLong();
        var w2 = cin.NextLong();
        var h2 = cin.NextLong();

        System.Console.WriteLine(
            w2 + 2 +
            2 * h2 - 2 +
            (w1 == w2 ? 4 : (4 + w1 - w2)) +
            2 * h1 - 2 +
            w1 + 2
        );
    }

    static Scanner cin = new Scanner();
    static StringBuilder cout = new StringBuilder();

    static public void Main () {
        SolveCodeForces();
        // System.Console.Write(cout.ToString());
    }
}

public static class Helpers {
    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }

    public static IEnumerable<int> IndicesWhere<T>(this IEnumerable<T> seq, Func<T, bool> cond) {
        var i = 0;
        foreach (var item in seq) {
            if (cond(item)) yield return i;
            i++;
        }
    }
}

public class Scanner
{
    private string[] line = new string[0];
    private int index = 0;

    public string Next() {
        if (line.Length <= index) {
            line = Console.ReadLine().Split(' ');
            index = 0;
        }
        var res = line[index];
        index++;
        return res;
    }

    public int NextInt() {
        return int.Parse(Next());
    }

    public long NextLong() {
        return long.Parse(Next());
    }

    public ulong NextUlong() {
        return ulong.Parse(Next());
    }

    public string[] Array() {
        line = Console.ReadLine().Split(' ');
        index = line.Length;
        return line;
    }

    public int[] IntArray(int emptyPrefixLen = 0) {
        var array = Array();
        var result = new int[emptyPrefixLen + array.Length];
        for (int i = 0; i < array.Length; i++)
            result[emptyPrefixLen + i] = int.Parse(array[i]);
        return result;
    }

    public long[] LongArray() {
        var array = Array();
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = long.Parse(array[i]);
        return result;
    }

    public ulong[] UlongArray() {
        var array = Array();
        var result = new ulong[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = ulong.Parse(array[i]);
        return result;
    }
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var w1 = input[0];
            var h1 = input[1];
            var w2 = input[2];
            var h2 = input[3];
            var ans = 0L;
            ans += w1 + 2 + h1 * 2 + w2 + 2 + h2 * 2;
            if (w1 != w2) ans += w1 - w2;

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

using System;
using System.Collections.Generic;

namespace Console_c
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] inter= str.Split(' ');
            int[] inte = new int[4];
            inte[0] = Convert.ToInt32(inter[0]);
            inte[1] = Convert.ToInt32(inter[1]);
            inte[2] = Convert.ToInt32(inter[2]);
            inte[3] = Convert.ToInt32(inter[3]);
            int S =0;
            if (inte[0] == inte[2]) {
                int S1 = (inte[0]+2)*(inte[1]+inte[3]+2)-inte[0]*(inte[1]+inte[3]);
                Console.WriteLine(""+S1);
            } else if (inte[0] > inte[2]) {
                int S1 = (inte[2] + 2) * (inte[1] + inte[3] + 2) - inte[2] * (inte[1] + inte[3]);
                S1 = S1 + (inte[0] - inte[2])*2;
                Console.WriteLine("" + S1);
            }
        }
    }
}

using System;
class Codeforces_541_A
{
  static void Main()
  {
    string [] s = Console.ReadLine().Split(' ');
    int w1 = int.Parse(s[0]);
    int h1 = int.Parse(s[1]);
    int w2 = int.Parse(s[2]);
    int h2 = int.Parse(s[3]);
    int kl = (h1+h2)*2 + (w1+w2) + 4 + (w1-w2);
    Console.Write(kl);
  }
}

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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split();

            int w1 = int.Parse(token[0]);
            int h1 = int.Parse(token[1]);

            int w2 = int.Parse(token[2]);
            int h2 = int.Parse(token[3]);

            int HH = h1 + h2;

            int WW = Math.Max(w1,w2);

            int ans  = 2 * (HH+WW) + 4;

            Console.WriteLine(ans);
        }
    }
}

using System;
using System.Linq;

namespace csharp
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            // ReSharper disable once PossibleNullReferenceException
            var inputs = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            Console.WriteLine(inputs[0] + inputs[1] * 2 + inputs[2] + inputs[3] * 2 + inputs[0] - inputs[2] - 1 + 5);
        }
    }
}

/* Date: 25.02.2019 * Time: 21:45 */
//

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

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

class Example
{
	public static void Swap (ref int a, ref int b)
	{
		int c = a; a = b; b = c;
	}
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2019\\Task\\07 Codeforces\\037\\A.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2019\\Task\\07 Codeforces\\037\\A.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

		int h1, w1, h2, w2;
		string s;

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
		sw.WriteLine ("*** a = " + s);
# endif

		{
			string [] ss = s.Split (' ');
			h1 = int.Parse (ss [1]);
			w1 = int.Parse (ss [0]);
			h2 = int.Parse (ss [3]);
			w2 = int.Parse (ss [2]);
		}

# if ( ! ONLINE_JUDGE )
		sw.WriteLine ("*** 1 = " + w1 + " " + h1);
		sw.WriteLine ("*** 2 = " + w2 + " " + h2);
# endif

		int m = 2*(h1 + w1 + h2 + 2);
		if ( w1 > w2 )
			m = 2*(h1 + w1 + h2 + 2);
		else if ( w1 < w2 )
			m = 2*(h1 + w2 + h2 + 2);

# if ( ONLINE_JUDGE )
		Console.WriteLine (m);
# else
		sw.WriteLine (m);
		sw.Close ();
# endif

	}
}

using System;
using System.Collections.Generic;

public class Test
{

    private static int ReadInt()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    private static long ReadLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }

    private static int[] ReadArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));
    }
    public static void Main()
    {
       int[] A = ReadArray();

        int w1 = A[0], h1 = A[1], w2 = A[2], h2 = A[3];

        Console.WriteLine((w1 + h1) * 2 + 4 + (h2 * 2));
    }
    }

using System;

namespace CodeForces_1131A
{
    class Program
    {
        static void Main(string[] args)
        {
            int w1, w2, h1, h2,h,w;
            var s = Console.ReadLine().Split(' ');
            w1 = Convert.ToInt32(s[0]);
            h1 = Convert.ToInt32(s[1]);
            w2 = Convert.ToInt32(s[2]);
            h2 = Convert.ToInt32(s[3]);
            w = w1;
            h = h1 + h2;

            int result = (h + 1) * 2 + (w + 1) * 2;
            Console.WriteLine(result);

        }
    }
}

namespace Problem
{
    using System;
    using System.Collections.Generic;
    class Problem1
    {
        static void Main()
        {
            string[] str = Console.ReadLine().Split();
            int w1 = int.Parse( str[0] );
            int h1 = int.Parse( str[1] );
            int w2 = int.Parse( str[2] );
            int h2 = int.Parse( str[3] );
            long kq = 0;
            kq = (long)( h1 + h2 + 2 ) * ( w1 + 2 ) - (long)( h1 + h2 ) * w1;
            Console.WriteLine( kq );

        }
    }
}

// Problem: 1131A - Sea Battle
// Author: Gusztav Szmolik

using System;

class SeaBattle
    {
    public static int Main ()
        {
        string line;
        string[] words;
        uint w1;
        uint h1;
        uint w2;
        uint h2;
        uint ans;

        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split ();
        if (words.Length != 4)
            return -1;
        if (!UInt32.TryParse (words[0], out w1))
            return -1;
        if (w1 < 1 || w1 > 100000000)
            return -1;
        if (!UInt32.TryParse (words[1], out h1))
            return -1;
        if (h1 < 1 || h1 > 100000000)
            return -1;
        if (!UInt32.TryParse (words[2], out w2))
            return -1;
        if (w2 < 1 || w2 > 100000000 || w1 < w2)
            return -1;
        if (!UInt32.TryParse (words[3], out h2))
            return -1;
        if (h2 < 1 || h2 > 100000000)
            return -1;
        ans = 2*(w1+h1+h2+2);
        Console.WriteLine (ans);
        return 0;
        }
    }

using System;
class Program
{
    static void Main()
    {
        int[] args = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Console.WriteLine(2 * (args[0] + args[1] + args[3]) + 4);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using SB = System.Text.StringBuilder;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
using System.Numerics;
using static System.Math;
using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    readonly int dom = 998244353;
    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void solve()
    {
        var w1 = cin.nextlong;
        var h1 = cin.nextlong;
        var w2 = cin.nextlong;
        var h2 = cin.nextlong;

        long ans = 0;
        ans += h1 + h2 + 2;
        ans += w1 + 1;
        ans += h1;
        ans += w2 + 1;
        ans += h2;
        ans += w1 - w2;
        WriteLine(ans);
    }

}

static class Ex
{
    public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values));
    public static string concat<T>(this IEnumerable<T> values) => string.Concat(values);
    public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }

    public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
    public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) <= 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T f; public U s;
    public Pair(T f, U s) { this.f = f; this.s = s; }
    public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);
    public override string ToString() => $"{f} {s}";
}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan => ReadLine().Split();
    public int[] scanint => Array.ConvertAll(scan, int.Parse);
    public long[] scanlong => Array.ConvertAll(scan, long.Parse);
    public double[] scandouble => Array.ConvertAll(scan, double.Parse);
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint => int.Parse(next);
    public long nextlong => long.Parse(next);
    public double nextdouble => double.Parse(next);
}

using System;

namespace CS_CodeForces
{
    internal class Program
    {
        private static void Main()
        {
            string[] inp = Console.ReadLine().Split(' ');
            int sum = 2 * (int.Parse(inp[0]) + int.Parse(inp[1]) + int.Parse(inp[3])) + 4;
            Console.Write(sum);
        }
    }
}

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

namespace CodeForces
{
	class Program
	{
		static void Main(string[] args)
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
			var w1 = arr[0];
			var h1 = arr[1];
			var w2 = arr[2];
			var h2 = arr[3];
			var ans = (h1 + h2) * 2 + w1 * 2 + 4;
			Console.WriteLine(ans);
		}

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

		static (int, int) Int2()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
			return (arr[0], arr[1]);
		}

		static int[] Ints()
		{
			return Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
		}

		static long Long()
		{
			return Int64.Parse(Console.ReadLine());
		}

		static (long, long) Long2()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
			return (arr[0], arr[1]);
		}

		static long[] Longs()
		{
			return Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
		}

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

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

namespace codeforces
{

    class Program
    {

        static void Main(string[] args)
        {
            int count=0;
            string[] prob = { " " };
            string  r=Console .ReadLine() ;
            string[] a =  r.Split (prob,StringSplitOptions .RemoveEmptyEntries );
            double  y = 2 *( int.Parse (a[0]) + int.Parse (a[1]) + int.Parse (a[3])) + 4;
            Console.WriteLine((y) );

        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] a = Console.ReadLine().Split().Select(double.Parse).ToArray();
            Console.WriteLine(a[0]+2 + a[2]+2 + a[1] * 2 + a[3] * 2 + (a[0] - a[2]));
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
             string[] sizes = Console.ReadLine().Split(' ');

             int w1 = Convert.ToInt32(sizes[0]);
             int h1 = Convert.ToInt32(sizes[1]);
             int w2 = Convert.ToInt32(sizes[2]);
             int h2 = Convert.ToInt32(sizes[3]);

            int cmnWidth = w1;
            int cmnHeight = h1 + h2;
            int w2Diff = w1 - w2;

            int markedTotal = w1 + 1 + cmnHeight + 1 + w2 + 1 + h2 + w2Diff + h1 + 1;

            Console.WriteLine(markedTotal);

        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Debug = System.Diagnostics.Trace;
using SB = System.Text.StringBuilder;
using System.Numerics;
using static System.Math;
using Number = System.Int64;
using N = System.Int64;
using C = System.Int32;
namespace Program {
	public class Solver {
		Random rnd = new Random();
		public void Solve() {
			var a = Enumerate(4, x => rl);
			var ans = 0L;
			ans += 2 * (a[0] + a[1] + a[2] + a[3] + 2);
			ans -= 2 * a[2];
			Console.WriteLine(ans);

		}
		const long INF = 1L << 60;
		static int[] dx = { -1, 0, 1, 0 };
		static int[] dy = { 0, 1, 0, -1 };
		int ri { get { return sc.Integer(); } }
		long rl { get { return sc.Long(); } }
		double rd { get { return sc.Double(); } }
		string rs { get { return sc.Scan(); } }
		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 < a.Length; ++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(ie.ToArray()); }
	static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
		return string.Join(st, ie);
	}
	static public void Main() {
		//Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });
		var solver = new Program.Solver();
		solver.Solve();
		Console.Out.Flush();
	}
}
#endregion
#region Ex
namespace Program.IO {
	using System.IO;
	using System.Text;
	using System.Globalization;

	public class Printer : StreamWriter {
		public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
		public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
	}

	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 != 0; b = (char)read()) if (b != '\r') sb.Append(b);
			return sb.ToString();
		}
		public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
		public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
		public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
	}
}

#endregion

using System;

namespace CSharp
{
    class _1131A
    {
        public static void Main()
        {
            var tokens = Console.ReadLine().Split();

            int w1 = int.Parse(tokens[0]);
            int h1 = int.Parse(tokens[1]);

            int w2 = int.Parse(tokens[2]);
            int h2 = int.Parse(tokens[3]);

            Console.WriteLine(2 * (w1 + h1 + h2) + 4);
        }
    }
}

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

namespace ConsoleApp131
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int w1 = int.Parse(s.Split(' ')[0]), h1 = int.Parse(s.Split(' ')[1]), w2 = int.Parse(s.Split(' ')[2]), h2 = int.Parse(s.Split(' ')[3]), res = (h1*2+w1*2+4) + (h2*2+w2*2+4) - (w2+2)*2;
            Console.WriteLine(res);
        }
    }
}

using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int w1 = int.Parse(str[0]);
		int h1 = int.Parse(str[1]);
		int w2 = int.Parse(str[2]);
		int h2 = int.Parse(str[3]);
		int ans = 0;
		ans += w2+2;
		ans += h2*2;
		ans += h1*2;
		if(w2!=w1){
			ans += Math.Abs(w2-w1);
		}
		ans += w1+2;
		Console.WriteLine(ans);
	}
}

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

namespace ConsoleApp
{
    static class Program
    {
        static void Main()
        {
            var args = ReadArgs();

            var w1 = args[0];
            var h1 = args[1];
            var w2 = args[2];
            var h2 = args[3];

            var ans1 = 2 * (h1 + 1) + w1;
            var ans2 = 2 * (h2 + 1) + w2;

            Console.WriteLine(ans1 + ans2 + Math.Abs(w1 - w2));
        }

        public static List<int> ReadArgs()
        {
            return Console.ReadLine().Split().Select(int.Parse).ToList();
        }

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

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

namespace ConsoleApp
{
    static class Program
    {
        static void Main()
        {
            var args = Reader.ReadIntArgs();
//
            var w1 = args[0];
            var h1 = args[1];
            var w2 = args[2];
            var h2 = args[3];

            var maxW = Math.Max(w1, w2);
            var maxH = Math.Max(h1, h2);

            Console.WriteLine((maxW + 2) * (maxH * 2 + 2) - (w1 * h1) - (w2 * h2) - Math.Abs(w1 * h1 - maxH * maxW) - Math.Abs(w2 * h2 - maxH * maxW));
        }
    }

    static class Reader
    {
        public static List<int> ReadIntArgs()
        {
            return ReadArgs(int.Parse);
        }

        public static List<long> ReadLongArgs()
        {
            return ReadArgs(long.Parse);
        }

        private static List<T> ReadArgs<T>(Func<string, T> parser)
        {
            return Console.ReadLine().Split().Select(parser).ToList();
        }

        public static int ReadIntValue()
        {
            return ReadValue(int.Parse);
        }

        public static long ReadLongValue()
        {
            return ReadValue(long.Parse);
        }

        private static T ReadValue<T>(Func<string, T> parser)
        {
            return parser(Console.ReadLine());
        }
    }
}

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

namespace ConsoleApp
{
    static class Program
    {
        static void Main()
        {
            var args = Reader.ReadIntArgs();

            var w1 = args[0];
            var h1 = args[1];
            var w2 = args[2];
            var h2 = args[3];

            var maxW = Math.Max(w1, w2);
            var maxH = Math.Max(h1, h2);

            Console.WriteLine((maxW + 2) * (maxH * 2 + 2) - (w1 * h1) - (w2 * h2) - Math.Abs(w1 * h1 - maxH * maxW) - Math.Abs(w2 * h2 - maxH * maxW));
        }
    }

    static class Reader
    {
        public static List<int> ReadIntArgs()
        {
            return ReadArgs(int.Parse);
        }

        public static List<long> ReadLongArgs()
        {
            return ReadArgs(long.Parse);
        }

        private static List<T> ReadArgs<T>(Func<string, T> parser)
        {
            return Console.ReadLine().Split().Select(parser).ToList();
        }

        public static int ReadIntValue()
        {
            return ReadValue(int.Parse);
        }

        public static long ReadLongValue()
        {
            return ReadValue(long.Parse);
        }

        private static T ReadValue<T>(Func<string, T> parser)
        {
            return parser(Console.ReadLine());
        }
    }
}

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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int w1, h1, w2, h2, result;
            string []s;

                s = Console.ReadLine().Split(' ');
                w1 = int.Parse(s[0]);
                h1 = int.Parse(s[1]);
                w2 = int.Parse(s[2]);
                h2 = int.Parse(s[3]);

            result = w1 + h1 + h2 + w2 + h2 + h1+(w1-w2);

            if (w1 == w2)
                result += 4;
            else
                result += 5;
            Console.WriteLine(result);

        }
    }
}

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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int w1, h1, w2, h2, result;
            string []s;

                s = Console.ReadLine().Split(' ');
                w1 = int.Parse(s[0]);
                h1 = int.Parse(s[1]);
                w2 = int.Parse(s[2]);
                h2 = int.Parse(s[3]);

            result = w1 + h1 + h2 + w2 + h2 + h2;

            if (w1 == w2)
                result += 4;
            else
                result += 5;
            Console.WriteLine(result);

        }
    }
}

using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;

class P
{
    static void Main()
    {
        var a = Console.ReadLine().Split().Select(int.Parse).ToList();
        //- - - -
        //下の辺
        long res = 0;
        res += a[0] + 2;
        res += a[2] + 2;
        res += (a[1] + a[3]) * 2;
        res += Abs(a[1] - a[3]);
        Console.WriteLine(res);
    }
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var w1 = input[0];
            var h1 = input[1];
            var w2 = input[2];
            var h2 = input[3];
            var ans = 0L;
            ans += w1 + 2 + h1 * 2 + w2 + 2 + h2 * 2;
            if (w1 != w2) ans++;

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

/* Date: 25.02.2019 * Time: 21:45 */
//

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

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

class Example
{
	public static void Swap (ref int a, ref int b)
	{
		int c = a; a = b; b = c;
	}
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2019\\Task\\07 Codeforces\\037\\A.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2019\\Task\\07 Codeforces\\037\\A.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

		int h1, w1, h2, w2;
		string s;

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
		sw.WriteLine ("*** a = " + s);
# endif

		{
			string [] ss = s.Split (' ');
			h1 = int.Parse (ss [1]);
			w1 = int.Parse (ss [0]);
			h2 = int.Parse (ss [3]);
			w2 = int.Parse (ss [2]);
		}

# if ( ! ONLINE_JUDGE )
		sw.WriteLine ("*** 1 = " + w1 + " " + h1);
		sw.WriteLine ("*** 2 = " + w2 + " " + h2);
# endif

		int m = 2*(h1 + w1 + h2 + 2) + w2;
		if ( w1 != w2 )
			m += (w2 - w1)*2 - 1;

		if ( w1 == w2 )
			m -= w1;
		else
			m++;

# if ( ONLINE_JUDGE )
		Console.WriteLine (m);
# else
		sw.WriteLine (m);
		sw.Close ();
# endif

	}
}

namespace Problem
{
    using System;
    using System.Collections.Generic;
    class Problem1
    {
        static void Main()
        {
            string[] str = Console.ReadLine().Split();
            int w1 = int.Parse( str[0] );
            int h1 = int.Parse( str[1] );
            int w2 = int.Parse( str[2] );
            int h2 = int.Parse( str[3] );
            long kq = 0;
            kq = (long)( h1 + h2 + 2 ) * ( w1 + 2 ) - ( h1 + h2 ) * w1;
            Console.WriteLine( kq );

        }
    }
}

using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int w1 = int.Parse(str[0]);
		int h1 = int.Parse(str[1]);
		int w2 = int.Parse(str[2]);
		int h2 = int.Parse(str[3]);
		int ans = 0;
		ans += w2+2;
		ans += h2*2;
		ans += h1*2;
		if(w2!=w1){
			ans += 1;
		}
		ans += w1+2;
		Console.WriteLine(ans);
	}
}

using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int w1 = int.Parse(str[0]);
		int h1 = int.Parse(str[1]);
		int w2 = int.Parse(str[2]);
		int h2 = int.Parse(str[3]);
		int ans = 0;
		ans += w2+2;
		ans += h2*2;
		ans += h1*2;
		if(w2!=w1){
			ans += 1;
		}
		ans += w1*2;
		Console.WriteLine(ans);
	}
}

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

namespace ConsoleApp
{
    static class Program
    {
        static void Main()
        {
            var args = ReadArgs();

            var w1 = args[0];
            var h1 = args[1];
            var w2 = args[2];
            var h2 = args[3];

            var ans1 = 2 * (h1 + 1) + w1;
            var ans2 = 2 * (h2 + 1) + w2;

            Console.WriteLine(ans1 + ans2 + Math.Abs(ans1 - ans2));
        }

        public static List<int> ReadArgs()
        {
            return Console.ReadLine().Split().Select(int.Parse).ToList();
        }

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


Kuro has recently won the "Most intelligent cat ever" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games.Kuro challenged Katie to create a game with only a white paper, a pencil, a pair of scissors and a lot of arrows (you can assume that the number of arrows is infinite). Immediately, Katie came up with the game called Topological Parity.The paper is divided into $$$n$$$ pieces enumerated from $$$1$$$ to $$$n$$$. Shiro has painted some pieces with some color. Specifically, the $$$i$$$-th piece has color $$$c_{i}$$$ where $$$c_{i} = 0$$$ defines black color, $$$c_{i} = 1$$$ defines white color and $$$c_{i} = -1$$$ means that the piece hasn't been colored yet.The rules of the game is simple. Players must put some arrows between some pairs of different pieces in such a way that for each arrow, the number in the piece it starts from is less than the number of the piece it ends at. Also, two different pieces can only be connected by at most one arrow. After that the players must choose the color ($$$0$$$ or $$$1$$$) for each of the unpainted pieces. The score of a valid way of putting the arrows and coloring pieces is defined as the number of paths of pieces of alternating colors. For example, $$$[1 \to 0 \to 1 \to 0]$$$, $$$[0 \to 1 \to 0 \to 1]$$$, $$$[1]$$$, $$$[0]$$$ are valid paths and will be counted. You can only travel from piece $$$x$$$ to piece $$$y$$$ if and only if there is an arrow from $$$x$$$ to $$$y$$$.But Kuro is not fun yet. He loves parity. Let's call his favorite parity $$$p$$$ where $$$p = 0$$$ stands for "even" and $$$p = 1$$$ stands for "odd". He wants to put the arrows and choose colors in such a way that the score has the parity of $$$p$$$.It seems like there will be so many ways which satisfy Kuro. He wants to count the number of them but this could be a very large number. Let's help him with his problem, but print it modulo $$$10^{9} + 7$$$.

The first line contains two integers $$$n$$$ and $$$p$$$ ($$$1 \leq n \leq 50$$$, $$$0 \leq p \leq 1$$$) — the number of pieces and Kuro's wanted parity. The second line contains $$$n$$$ integers $$$c_{1}, c_{2}, ..., c_{n}$$$ ($$$-1 \leq c_{i} \leq 1$$$) — the colors of the pieces.

Print a single integer — the number of ways to put the arrows and choose colors so the number of valid paths of alternating colors has the parity of $$$p$$$.

NoteIn the first example, there are $$$6$$$ ways to color the pieces and add the arrows, as are shown in the figure below. The scores are $$$3, 3, 5$$$ for the first row and $$$5, 3, 3$$$ for the second row, both from left to right.

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

namespace E
{
    class Program
    {
        //static long _2_n(int n)
        //{
        //    //2^50=1125899906842624
        //    long res = 1;
        //    if (n <= 0) return res;
        //    for (int i = 1; i <= n; i++) res = res * 2;
        //    return res;
        //}

        static void Main(string[] args)
        {
            //for (int z = 1; z <= 25; z++)
            //{
            //    StreamReader sr = new StreamReader("in" + z + ".txt");
            TextReader sr = Console.In;

            const long modl = 1000000007;
                //const long modi = 1000000007;

                string[] s = sr.ReadLine().Split();
                int n = Convert.ToInt32(s[0]);
                int p = Convert.ToInt32(s[1]);
                s = sr.ReadLine().Split();
                int[] c = new int[n + 1];//0-черный;1-белый
                for (int i = 1; i <= n; i++) c[i] = Convert.ToInt32(s[i - 1]);
                sr.Close();

                long[,,,] f = new long[n + 1, n + 1, n + 1, n + 1];
                //f[0, 0, 0, 0] = 1;

                //2^50=1125899906842624
                long[] pw = new long[n + 1];//2^i
                pw[0] = 1;
                for (int i = 1; i <= n; i++) pw[i] = (pw[i - 1] * 2) % modl;

                long res = 0;
                int ew;
                for (int i = 1; i <= n; i++)
                {
                    for (int ob = 0; ob <= i; ob++)
                    {
                        for (int eb = 0; ob + eb <= i; eb++)
                        {
                            for (int ow = 0; ob + eb + ow <= i; ow++)
                            {
                                ew = i - ob - eb - ow;

                                f[ob, eb, ow, ew] = 0;
                                if (c[i] != 0)//если узел может быть белым
                                {
                                    if (i == 1)
                                    {
                                        if (ow == 1) f[ob, eb, ow, ew] = f[ob, eb, ow, ew] + 1;
                                    }
                                    else
                                    {
                                        if (ob == 0)
                                        {
                                            if (ow > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 1] * f[ob, eb, ow - 1, ew])%modl) % modl;
                                        }
                                        else
                                        {
                                            if (ow > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob, eb, ow - 1, ew]) % modl) % modl;
                                            if (ew > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob, eb, ow, ew - 1]) % modl) % modl;
                                        }
                                    }
                                }

                                if (c[i] != 1)//если узел может быть черным
                                {
                                    if (i == 1)
                                    {
                                        if (ob == 1) f[ob, eb, ow, ew] = f[ob, eb, ow, ew]+1;
                                    }
                                    else
                                    {
                                        if (ow == 0)
                                        {
                                            if (ob > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 1] * f[ob - 1, eb, ow, ew]) % modl) % modl;
                                        }
                                        else
                                        {
                                            if (ob > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob - 1, eb, ow, ew]) % modl) % modl;
                                            if (eb > 0) f[ob, eb, ow, ew] = (f[ob, eb, ow, ew] + (pw[i - 2] * f[ob, eb - 1, ow, ew]) % modl) % modl;
                                        }
                                   }
                                }

                                if ((i == n) && ((ob + ow) % 2 == p))
                                    res = (res + f[ob, eb, ow, ew]) % modl;
                            }
                        }
                    }
                }

                //вывод решения
                Console.WriteLine(res);
            //}
        }
    }
}