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

namespace Codeforces
{
    class C
    {
        public static void Main(string[] args)
        {
            C program = new C();
            string output = program.Go();
            if (output != null)
                Wl<string>(output);
        }

        private IEnumerable<Tuple<long, int>> Decompose(long n)
        {
            if (n == 1) yield break;

            int p = 2;
            while (p * p <= n)
            {
                int r = 0;
                while (n % p == 0)
                {
                    ++r;
                    n /= p;
                }
                if (r > 0)
                    yield return new Tuple<long, int>(p, r);

                ++p;
            }

            if (n > 1)
                yield return new Tuple<long, int>(n, 1);
        }

        private IEnumerable<long> Divs(Tuple<long, int>[] decomp, int start = 0)
        {
            if (decomp.Length == 0)
            {
                yield return 1;
                yield break;
            }

            if (decomp.Length - start == 1)
            {
                long ret = 1;
                yield return 1;
                for (int i = 0; i < decomp[start].Item2; ++i)
                {
                    ret *= decomp[start].Item1;
                    yield return (ret);
                }
            }
            else
            {
                long ret = 1;
                foreach(long d in Divs(decomp, start+1))
                {
                    yield return d;
                }
                for (int i = 0; i < decomp[start].Item2; ++i)
                {
                    ret *= decomp[start].Item1;
                    foreach (long d in Divs(decomp, start + 1))
                        yield return (ret * d);
                }
            }

        }

        private string Go()
        {
            long n = GetLong();
            Tuple<long, int>[] decompN = Decompose(n).ToArray();
            Tuple<long, int>[] decompNa;

            long m = long.MaxValue;
            long M = 0;

            foreach (long A1 in Divs(decompN))
            {
                decompNa = A1 == 1 ? decompN : Decompose(n / A1).ToArray();
                foreach (long B2 in Divs(decompNa))
                {
                    long C2 = n / A1 / B2;

                    long cand = (A1 + 1) * (B2 + 2) * (C2 + 2);
                    m = cand < m ? cand : m;
                    M = cand > M ? cand : M;
                }
            }

            Wl<long>(new long[] { m - n, M - n });

            return null;
        }

        #region Template

        private IEnumerator<string> ioEnum;
        private string GetString()
        {
            while (ioEnum == null || !ioEnum.MoveNext())
            {
                ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();
            }

            return ioEnum.Current;
        }

        private int GetInt()
        {
            return int.Parse(GetString());
        }

        private long GetLong()
        {
            return long.Parse(GetString());
        }

        private double GetDouble()
        {
            return double.Parse(GetString());
        }

        private static void Wl<T>(T o)
        {
            Console.WriteLine(o.ToString());
        }

        private static void Wl<T>(IEnumerable<T> enumerable)
        {
            Wl(string.Join(" ", enumerable.Select(e => e.ToString()).ToArray()));
        }

        public struct Tuple<T, K>
        {
            public T Item1;
            public K Item2;

            public Tuple(T t, K k)
            {
                Item1 = t;
                Item2 = k;
            }

            public override bool Equals(object obj)
            {
                var o = (Tuple<T, K>)obj;
                return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);
            }

            public override int GetHashCode()
            {
                return Item1.GetHashCode() ^ Item2.GetHashCode();
            }

            public override string ToString()
            {
                return "(" + Item1 + " " + Item2 + ")";
            }
        }

        #endregion
    }
}


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

class Program
{
    public class ArrayEqualityComparer : IEqualityComparer<int[]>
    {
        public bool Equals(int[] x, int[] y)
        {
            if (x.Length != y.Length)
            {
                return false;
            }
            for (int i = 0; i < x.Length; i++)
            {
                if (x[i] != y[i])
                {
                    return false;
                }
            }
            return true;
        }

        public int GetHashCode(int[] obj)
        {
            int result = 17;
            for (int i = 0; i < obj.Length; i++)
            {
                unchecked
                {
                    result = result * 23 + obj[i];
                }
            }
            return result;
        }
    }

    public static int[] Read(string str)
    {
        string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        int[] ret = new int[tokens.Length];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = int.Parse(tokens[i]);
        }

        return ret;
    }

    public class PriorityQueue<T> where T : IComparable<T>
    {
        private List<T> data;

        public PriorityQueue()
        {
            this.data = new List<T>();
        }

        public void Enqueue(T item)
        {
            data.Add(item);
            int ci = data.Count - 1; // child index; start at end
            while (ci > 0)
            {
                int pi = (ci - 1) / 2; // parent index
                if (data[ci].CompareTo(data[pi]) >= 0) break; // child item is larger than (or equal) parent so we're done
                T tmp = data[ci]; data[ci] = data[pi]; data[pi] = tmp;
                ci = pi;
            }
        }

        public T Dequeue()
        {
            // assumes pq is not empty; up to calling code
            int li = data.Count - 1; // last index (before removal)
            T frontItem = data[0];   // fetch the front
            data[0] = data[li];
            data.RemoveAt(li);

            --li; // last index (after removal)
            int pi = 0; // parent index. start at front of pq
            while (true)
            {
                int ci = pi * 2 + 1; // left child index of parent
                if (ci > li) break;  // no children so done
                int rc = ci + 1;     // right child
                if (rc <= li && data[rc].CompareTo(data[ci]) < 0) // if there is a rc (ci + 1), and it is smaller than left child, use the rc instead
                    ci = rc;
                if (data[pi].CompareTo(data[ci]) <= 0) break; // parent is smaller than (or equal to) smallest child so done
                T tmp = data[pi]; data[pi] = data[ci]; data[ci] = tmp; // swap parent and child
                pi = ci;
            }
            return frontItem;
        }

        public T Peek()
        {
            T frontItem = data[0];
            return frontItem;
        }

        public int Count()
        {
            return data.Count;
        }

        public override string ToString()
        {
            string s = "";
            for (int i = 0; i < data.Count; ++i)
                s += data[i].ToString() + " ";
            s += "count = " + data.Count;
            return s;
        }

        public bool IsConsistent()
        {
            // is the heap property true for all data?
            if (data.Count == 0) return true;
            int li = data.Count - 1; // last index
            for (int pi = 0; pi < data.Count; ++pi) // each parent index
            {
                int lci = 2 * pi + 1; // left child index
                int rci = 2 * pi + 2; // right child index

                if (lci <= li && data[pi].CompareTo(data[lci]) > 0) return false; // if lc exists and it's greater than parent then bad.
                if (rci <= li && data[pi].CompareTo(data[rci]) > 0) return false; // check the right child too.
            }
            return true; // passed all checks
        } // IsConsistent
    } // PriorityQueue

    class Pair : IComparable<Pair>
    {
        public int Key;
        public int Value;
        public Pair(int a, int b)
        {
            Key = a; Value = b;
        }

        public int CompareTo(Pair other)
        {
            if (this.Key > other.Key) return -1;
            if (this.Key < other.Key) return 1;
            return 0;
        }
    }

    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine().Trim());
        int[] d = Read(Console.ReadLine().Trim());

        int[,,] S = new int[n + 1, 2, 2];

        for (int i = 1; i <= n; i++)
        {
            S[i, 0, 0] = Math.Max(Math.Max(S[i - 1, 0, 0], S[i - 1, 0, 1]), Math.Max(S[i - 1, 1, 0], S[i - 1, 1, 1]));
            if ((d[i - 1] & 1) != 0)
            {
                S[i, 0, 1] = Math.Max(S[i - 1, 1, 0], S[i - 1, 0, 0]) + 1;
            }
            else
            {
                S[i, 0, 1] = Math.Max(Math.Max(S[i - 1, 0, 0], S[i - 1, 0, 1]), Math.Max(S[i - 1, 1, 0], S[i - 1, 1, 1]));
            }
            if ((d[i - 1] & 2) != 0)
            {
                S[i, 1, 0] = Math.Max(S[i - 1, 0, 1], S[i - 1, 0, 0]) + 1;
            }
            else
            {
                S[i, 1, 0] = Math.Max(Math.Max(S[i - 1, 0, 0], S[i - 1, 0, 1]), Math.Max(S[i - 1, 1, 0], S[i - 1, 1, 1]));
            }
            S[i, 1, 1] = 0;
        }

        int max_d = Math.Max(Math.Max(S[n, 0, 0], S[n, 0, 1]), Math.Max(S[n, 1, 0], S[n, 1, 1]));

        Console.WriteLine(n - max_d);
    }
}


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

class Program
{
    const int M = 1000000007;
    const double eps = 1e-9;
    static int[] dd = { 0, 1, 0, -1, 0 };
    static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        var sc = new Scan();
        int n = sc.Int;
        var a = sc.IntArr;
        var dp = new int[n + 1][];
        for (int i = 0; i <= n; i++)
        {
            dp[i] = new int[3];
            for (int j = 0; j < 3; j++)
            {
                dp[i][j] = 100000;
            }
        }
        dp[0][0] = 0;
        for (int i = 0; i < n; i++)
        {
            if ((a[i] & 1) > 0)
            {
                dp[i + 1][1] = Math.Min(dp[i][0], dp[i][2]);
            }
            if ((a[i] & 2) > 0)
            {
                dp[i + 1][2] = Math.Min(dp[i][0], dp[i][1]);
            }
            dp[i + 1][0] = Math.Min(dp[i][0], Math.Min(dp[i][1], dp[i][2])) + 1;
        }
        sw.WriteLine(Math.Min(dp[n][0], Math.Min(dp[n][1], dp[n][2])));
        sw.Flush();
    }
    static void swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; }

    static T[] copy<T>(T[] a)
    {
        var ret = new T[a.Length];
        for (int i = 0; i < a.Length; i++) ret[i] = a[i];
        return ret;
    }
    static T[][] copy2<T>(T[][] a)
    {
        var ret = new T[a.Length][];
        for (int i = 0; i < a.Length; i++)
        {
            ret[i] = new T[a[0].Length];
            for (int j = 0; j < a[0].Length; j++) ret[i][j] = a[i][j];
        }
        return ret;
    }
}
class Scan
{
    public int Int { get { return int.Parse(Str); } }
    public long Long { get { return long.Parse(Str); } }
    public double Double { get { return double.Parse(Str); } }
    public string Str { get { return Console.ReadLine().Trim(); } }
    public int[] IntArr { get { return StrArr.Select(int.Parse).ToArray(); } }
    public int[] IntArrWithSep(char sep) { return Str.Split(sep).Select(int.Parse).ToArray(); }
    public long[] LongArr { get { return StrArr.Select(long.Parse).ToArray(); } }
    public double[] DoubleArr { get { return StrArr.Select(double.Parse).ToArray(); } }
    public string[] StrArr { get { return Str.Split(); } }
    public void Multi(out int a, out int b) { var arr = IntArr; a = arr[0]; b = arr[1]; }
    public void Multi(out int a, out int b, out int c) { var arr = IntArr; a = arr[0]; b = arr[1]; c = arr[2]; }
    public void Multi(out int a, out string b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1]; }
    public void Multi(out string a, out int b) { var arr = StrArr; a = arr[0]; b = int.Parse(arr[1]); }
    public void Multi(out int a, out char b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1][0]; }
    public void Multi(out char a, out int b) { var arr = StrArr; a = arr[0][0]; b = int.Parse(arr[1]); }
    public void Multi(out long a, out long b) { var arr = LongArr; a = arr[0]; b = arr[1]; }
    public void Multi(out long a, out int b) { var arr = LongArr; a = arr[0]; b = (int)arr[1]; }
    public void Multi(out int a, out long b) { var arr = LongArr; a = (int)arr[0]; b = arr[1]; }
    public void Multi(out string a, out string b) { var arr = StrArr; a = arr[0]; b = arr[1]; }
}
class mymath
{
    public bool isprime(long a)
    {
        if (a < 2) return false;
        for (long i = 2; i * i <= a; i++) if (a % i == 0) return false;
        return true;
    }
    public long[][] powmat(long[][] A, long n, int M)
    {
        var E = new long[A.Length][];
        for (int i = 0; i < A.Length; i++)
        {
            E[i] = new long[A.Length];
            E[i][i] = 1;
        }
        if (n == 0) return E;
        var t = powmat(A, n / 2, M);
        if ((n & 1) == 0) return mulmat(t, t, M);
        return mulmat(mulmat(t, t, M), A, M);
    }
    public long[] mulmat(long[][] A, long[] x, int M)
    {
        var ans = new long[A.Length];
        for (int i = 0; i < A.Length; i++) for (int j = 0; j < x.Length; j++) ans[i] = (ans[i] + x[j] * A[i][j]) % M;
        return ans;
    }
    public long[][] mulmat(long[][] A, long[][] B, int M)
    {
        var ans = new long[A.Length][];
        for (int i = 0; i < A.Length; i++)
        {
            ans[i] = new long[B[0].Length];
            for (int j = 0; j < B[0].Length; j++) for (int k = 0; k < B.Length; k++) ans[i][j] = (ans[i][j] + A[i][k] * B[k][j]) % M;
        }
        return ans;
    }
    public long powmod(long a, long b, long M)
    {
        if (a == 0) return 0;
        if (b == 0) return 1;
        var t = powmod(a, b / 2, M);
        if ((b & 1) == 0) return t * t % M;
        return t * t % M * a % M;
    }
    public long gcd(long a, long b)
    {
        while (b > 0) { var t = a % b; a = b; b = t; }
        return a;
    }
    public long lcm(long a, long b) { return a * (b / gcd(a, b)); }
    public long Comb(int n, int r)
    {
        const int M = 1000000007;
        if (n < 0 || r < 0 || r > n) return 0;
        if (n - r < r) r = n - r;
        if (r == 0) return 1;
        if (r == 1) return n;
        var numerator = new int[r];
        var denominator = new int[r];
        for (int k = 0; k < r; k++)
        {
            numerator[k] = n - r + k + 1;
            denominator[k] = k + 1;
        }
        for (int p = 2; p <= r; p++)
        {
            int pivot = denominator[p - 1];
            if (pivot > 1)
            {
                int offset = (n - r) % p;
                for (int k = p - 1; k < r; k += p)
                {
                    numerator[k - offset] /= pivot;
                    denominator[k] /= pivot;
                }
            }
        }
        long result = 1;
        for (int k = 0; k < r; k++) if (numerator[k] > 1) result = result * numerator[k] % M;
        return result;
    }
}


using System;

class Program
    {

        static void Main(string[] args)
        {
            string npt = Console.ReadLine();
            int fr = 0;
            int sv = 0;
            for (int i = 0; i < npt.Length; ++i)
                if (npt[i] == '4')
                    fr++;
                else if (npt[i] == '7')
                    sv++;
            if (sv == 0 && fr == 0)
                Console.WriteLine("-1");
            else Console.WriteLine(sv > fr ? "7" : "4");
        }
    }


using System;

namespace SportProg
{
    class Program
    {
        static void Main(string[] args)
        {
            string a =System.Console.ReadLine();
            int b=0,c=0;
            for (int i = 0; i<a.Length ; ++i)
            {
                if (a[i] == '4') b++;
                if (a[i] == '7') c++;
            }
            if (c > b) System.Console.WriteLine("7");
            else if ((b == c) && (c == 0)) System.Console.WriteLine(-1);
            else if (b >= c) System.Console.WriteLine("4");
            System.Console.ReadLine();
            return;

        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            /*******************************************/
            Hashtable hashtable = new Hashtable();
            hashtable.Add('6', 1);
            hashtable.Add('7', 2);
            hashtable.Add('8', 3);
            hashtable.Add('9', 4);
            hashtable.Add('T', 5);
            hashtable.Add('J', 6);
            hashtable.Add('Q', 7);
            hashtable.Add('K', 8);
            hashtable.Add('A', 9);
            /*******************************************/

            char trup = Convert.ToChar(Console.ReadLine());
            string[] Cards = Console.ReadLine().Split();

            string c1 = Cards[0];
            string c2 = Cards[1];

            if (c1[1] == c2[1])
                Console.WriteLine((int)hashtable[c1[0]] >= (int)hashtable[c2[0]] ? "YES" : "NO");
            else
                Console.WriteLine((c1[1] == trup) ? "YES" : "NO");
            //Console.Read();
        }
    }
}


using System;

namespace _82_A
{
    class Program
    {
        static void Main(string[] args)
        {
            char cosir = Console.ReadLine()[0];
            string[] cards = Console.ReadLine().Split(' ');
            if (cards[0][1] == cards[1][1])
            {
                if (price(cards[0][0]) > price(cards[1][0]))
                    Console.WriteLine("YES");
                else
                    Console.WriteLine("NO");
            }
            else if (cards[0][1] == cosir)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
        static int price(char c)
        {
            return "6789TJQKA".IndexOf(c);
        }
    }
}


using System;
class CFBR3C
{
	static void Main()
	{
		byte xCount;
		byte emptyCount;
		sbyte[,] gameState = GetGameState(out xCount, out emptyCount);
		Console.WriteLine(GetVerdict(gameState, xCount, emptyCount));
	}

	static string GetVerdict(sbyte[,] gs, byte xCount, byte eCount)
	{
		byte zCount = (byte)(9 - (xCount + eCount));
		bool firstPlayerWon = false;
		bool secondPlayerWon = false;
		if ((xCount == 0) && (zCount == 0)) return "first";
		else if (Math.Abs(xCount - zCount) > 1) return "illegal";
		else if (xCount < zCount) return "illegal";
		else if (((gs[0, 0] == 1) && (gs[1, 1] == 1) && (gs[2, 2] == 1)) || ((gs[0, 2] == 1) && (gs[1, 1] == 1) && (gs[2, 0] == 1))) firstPlayerWon = true;
		else if (((gs[0, 0] == 0) && (gs[1, 1] == 0) && (gs[2, 2] == 0)) || ((gs[0, 2] == 0) && (gs[1, 1] == 0) && (gs[2, 0] == 0))) secondPlayerWon = true;
		for (byte i = 0; i < 3; i++)
		{
			if (((gs[i, 0] == 1) && (gs[i, 1] == 1) && (gs[i, 2] == 1)) || ((gs[0, i] == 1) && (gs[1, i] == 1) && (gs[2, i] == 1))) firstPlayerWon = true;
			else if (((gs[i, 0] == 0) && (gs[i, 1] == 0) && (gs[i, 2] == 0)) || ((gs[0, i] == 0) && (gs[1, i] == 0) && (gs[2, i] == 0))) secondPlayerWon = true;
			if (firstPlayerWon == true && secondPlayerWon == true) return "illegal";
		}
		if (firstPlayerWon == true)
		{
			if (xCount == zCount) return "illegal";
			else return "the first player won";
		}
		else if (secondPlayerWon == true)
		{
			if (zCount < xCount) return "illegal";
			else return "the second player won";
		}

		if (eCount > 0)
		{
			if (xCount > zCount) return "second";
			else return "first";
		}
		return "draw";
	}

	static sbyte[,] GetGameState(out byte xCount, out byte emptyCount)
	{
		xCount = 0;
		emptyCount = 0;
		sbyte[,] gameState = new sbyte[3, 3];
		for (byte i = 0; i < 3; i++)
		{
			string line = Console.ReadLine();
			for (byte j = 0; j < 3; j++)
			{
				switch(line[j])
				{
					case 'X':
						{
							gameState[i, j] = 1;
							xCount++;
							break;
						}
					case '0':
						{
							gameState[i, j] = 0;
							break;
						}
					case '.':
						{
							gameState[i, j] = -1;
							emptyCount++;
							break;
						}
				}
			}
		}
		return gameState;
	}
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();
            bool f = false;
            bool b = false;
            for (int i = 0; i < s1.Length; i++)
            {
                if (s1.Length==s2.Length &&s1[i] == s2[(s2.Length - 1) - i]) f = true;
                else b = true;
            }
            if (f == true && b == false) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
    }
}


using System;

class A41 {
    public static void Main() {
        var s1 = Console.ReadLine().ToCharArray();
        Array.Reverse(s1);
        var s2 = Console.ReadLine();
        Console.WriteLine(new string(s1) == s2 ? "YES" : "NO");
    }
}


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

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

            #region Ввод
//lol:
            string input = Console.ReadLine();

            var data = input.Split(' ');

            int[] numbers = new int[data[0].Length];

            for (int index = 0; index < data[0].Length; index++)
            {
                numbers[index] = (int) Char.GetNumericValue(data[0][index]);
            }

            int k = Convert.ToInt32(data[1]);

            #endregion

            Tuple<int, int> pos;
            int m = 0;
            int m2 = 0;
            while (k > 0)
            {
                ////if (k+1-m2 <=0) break;

                //if (k >= numbers.Length)
                //{
                //    m = numbers.ToList().IndexOf(numbers.Max());

                //    if (m == 0)
                //    {
                //        if (fi)
                //        m2++;
                //        continue;
                //    }

                //    numbers = DvigLeft(numbers, m + m2, m2);

                //    k -= m;
                //}
                //else
                //{
                    pos = FindToChange(numbers, k);

                    if (pos.Item2 - pos.Item1 == 0) break;

                    numbers = DvigLeft(numbers, pos.Item2, pos.Item1);

                    k -= pos.Item2 - pos.Item1;
                    //m = numbers.ToList().GetRange(m2, k+1-m2).IndexOf(numbers.ToList().GetRange(m2, k+1-m2).Max());
                //}
            }

            #region Вывод

            string res = numbers.Aggregate("", (current, number) => current + number);

            Console.WriteLine(res);
            //Console.ReadKey();
            //goto lol;

            #endregion

        }

        private static int FindToChange(int[] numbers)
        {
            for (int i = 1; i < numbers.Length; i++)
            {
                if (numbers[i - 1] < numbers[i]) return i;
            }
            return 0;
        }

        private static Tuple<int, int> FindToChange(int[] numbers, int k)
        {
            int maxindex = 0;
            int minindex = 0;

            for (int i = 0; i < numbers.Length; i++)
            {
                int maxvalue = 0;

                int indx = k+1 + minindex;
                if (indx >= numbers.Length)
                    indx = numbers.Length;

                    for (int j = minindex; j < indx; j++)
                    {
                        if (maxvalue < numbers[j])
                        {
                            maxvalue = numbers[j];
                            maxindex = j;
                        }
                    }

                if (maxindex != minindex && maxindex> minindex)
                    return new Tuple<int, int>(minindex, maxindex);

                minindex++;
            }

            return new Tuple<int, int>(0,0);
        }

        static int[] DvigLeft(int[] old, int oldpos, int newpos)
        {
            int[] res = (int[]) old.Clone();

            res[newpos] = old[oldpos];

            for (int i = newpos; i < oldpos; i++)
            {
                res[i+1] = old[i];
            }

            return res;
        }
    }
}


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

namespace lab13
{
    class Program
    {
        static string a = null;
        static long[] aa = new long[20];

        static void Main(string[] args)
        {
            int i;
            long k;

            FillChar<long>(aa, 0);
            int f = 1;

            long[] input = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(p => long.Parse(p)).ToArray<long>();
            a = input[0].ToString();
            k = input[1];

            int len = a.Length;
            for (i = 1; i <= len; i++) aa[i] = a[i - 1] - '0';

            while(k > 0)
            {
                long max = -1;
                int flag = 0;
                for(i = f; i <= f + k && i <= len; i++)
                {
                    if(max < aa[i])
                    {
                        max = aa[i];
                        flag = i;
                    }
                }
                for(i = flag; i > f; i--)
                {
                    long c = aa[i];
                    aa[i] = aa[i-1];
                    aa[i-1] = c;
                }
                k = k - flag + f;
                f++;
                if(f > len) break;
            }
            for(i = 1; i <= len; i++)
                Console.Write(aa[i]);
            Console.WriteLine();
        }
        public static void FillChar<T>(T[] array, T value)
        {
            for (int i = 0; i < array.Length; i++)
                array[i] = value;
        }
    }
}


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

namespace A.Carrot_Cakes
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int x = 0;
            int y = 0;
            while(y<r[0]){
                x += r[1];
                y += r[2];
            }
            if (x > r[3]+r[1])
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        bool flag = false;

        int n, t, k, d;
        n = cin.nextInt();
        t = cin.nextInt();
        k = cin.nextInt();
        d = cin.nextInt();

        int needtime = (n + (k - 1)) / k * t;
        if (needtime - d > t) flag = true;

        if (flag) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }

}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}


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

namespace CodeForce
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string Data = Console.ReadLine().Replace("0", "");
            if (Data.Length == 0) { Console.WriteLine("YES"); return; };
            for (int i = 1; i < Data.Length; i++)
            {
                string measure = Data.Remove(i);
                int int_main = Func(measure);
                string pickup = Data.Remove(0,i);
                for (int j = 0; j < pickup.Length; j++)
                {
                    string S = pickup.Substring(0, j+1);
                    int Varable = Func(S);
                    if (Varable > int_main) break;
                    if (Varable == int_main)
                    {
                        pickup = pickup.Remove(0, j+1);
                        j = -1;
                    }
                    if (pickup.Length == 0) { Console.WriteLine("YES"); return; }
                }
            }
            Console.WriteLine("NO");
        }
        static int Func(string num)
        {
            int A = 0;
            for (int i = 0; i < num.Length; i++)
            {
                string S = num[i].ToString();
               A += int.Parse(S);
            }
            return A;
        }
    }
}


using System;

class Solution {
	static int Main () {
		string s;
		int n;
		n = Convert.ToInt32(Console.ReadLine());
		s = Console.ReadLine();

		for (int i = 0; i < n-1; i++) {
			int tmp = 0;
			for (int j = 0; j <= i; j++) tmp += s[j]-'0';
			bool ans = false;
			int aux = 0;
			for (int j = i+1; j < n; j++) {
				aux += s[j]-'0';
				if (aux == tmp) {
					ans = true;
					if (j < n-1) aux = 0;
					else break;
				} else if (aux > tmp) {
					ans = false;
					break;
				}
			}
			if (aux != 0 && aux < tmp) ans = false;
			if (ans) {
				Console.WriteLine("YES");
				return 0;
			}
		}

		Console.WriteLine("NO");
		return 0;
	}
}


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

namespace task160B
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string input = Console.ReadLine();
            List<Int32> f = new List<Int32>();
            for (Int32 i = 0; i < input.Length >> 1; i++)
            {
                f.Add(input[i] - 48);
            }
            List<Int32> s = new List<Int32>();
            for (Int32 i = input.Length >> 1; i < input.Length; i++)
            {
                s.Add(input[i] - 48);
            }
            f.Sort();
            s.Sort();
            Int32 k = 0;
            Int32 l = 0;
            for (Int32 i = 0;i< f.Count; i++)
            {
                if (f[i] < s[i])
                {
                    k++;
                }
                else
                    if (f[i] > s[i])
                    {
                        l++;
                    }
            }
            if (k == f.Count)
            {
                Console.WriteLine("YES");
                return;
            }
            else
                if (l == f.Count)
                {
                    Console.WriteLine("YES");
                    return;
                }
                else
                    Console.WriteLine("NO");
            //Console.ReadLine();
        }
    }
}


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

    public class unluckyTicket
    {
        public static void Main()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string input = Console.ReadLine();

            //int n = 2;
            //string input = "2421";
            char[] leftHalf = input.ToCharArray(0, n);
            char[] rightHalf = input.ToCharArray(n, n);

            Array.Sort(leftHalf);
            Array.Sort(rightHalf);

            string answer = "YES";
            if (leftHalf[0] > rightHalf[0])
            {
                for (int i = 1; i < leftHalf.Length; i++)
                {
                    if (leftHalf[i] <= rightHalf[i])
                    {
                        answer = "NO";
                        break;
                    }
                }
            }
            else
            {
                if (leftHalf[0] < rightHalf[0])
                {
                    for (int i = 1; i < leftHalf.Length; i++)
                    {
                        if (leftHalf[i] >= rightHalf[i])
                        {
                            answer = "NO";
                            break;
                        }
                    }
                }
                else
                {
                    answer = "NO";
                }
            }

            Console.WriteLine(answer);
        }
    }


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int tot = 0;

		tot += A;
		if(X > tot){
			Console.WriteLine("NO");
			return;
		}
		tot -= X;
		tot += B;
		if(Y > tot){
			Console.WriteLine("NO");
			return;
		}

		tot -= Y;
		tot += C;
		if(Z > tot){
			Console.WriteLine("NO");
			return;
		}

		Console.WriteLine("YES");
	}
	int X,Y,Z;
	int A,B,C;
	public Sol(){
		var d = ria();
		X = d[0]; Y = d[1]; Z = d[2];
		d = ria();
		A = d[0]; B = d[1]; C = d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using static Template;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pi = Pair<int, int>;

class Solver
{
    Scanner sc = new Scanner();
    //

    public void Solve()
    {
        int x, y, z, a, b, c;
        sc.Make(out x, out y, out z, out a, out b, out c);
        if (x > a) Fail("NO");
        a -= x;
        if (a + b < y) Fail("NO");
        if (a + b + c - y < z) Fail("NO");
        WriteLine("YES");
    }
}

#region Template
public class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b)
    { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f();
        return rt;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<int, T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f(i);
        return rt;
    }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}

public class Scanner
{
    public string Str => ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    public Pair<T1, T2> PairMake<T1, T2>() => new Pair<T1, T2>(Next<T1>(), Next<T2>());
    public Pair<T1, T2, T3> PairMake<T1, T2, T3>() => new Pair<T1, T2, T3>(Next<T1>(), Next<T2>(), Next<T3>());
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
}

public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using SB = System.Text.StringBuilder;
//using System.Threading.Tasks;
//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()
    {
        int N = cin.nextint;
        var dp = new ModInt[2 * N + 1, N + 1];
        dp[0, 0] = 1;
        for (int i = 1; i <= 2 * N; i++)
        {
            for (int j = i % 2; j <= Min(N, 2 * N - i); j += 2)
            {
                if (j > 0) dp[i, j] = dp[i - 1, j - 1];
                if (j < N) dp[i, j] += dp[i - 1, j + 1];
            }
        }

        var S = new ModInt[2 * N + 1];
        for (int i = 0; i < S.Length; i++)
        {
            for (int j = 0; j <= N; j++)
            {
                S[i] += dp[i, j];
            }
        }
        S.Reverse();
       // S.join();

        ModInt ans = 0;
        for (int i = 1; i < S.Length; i += 2)
        {
            ans += S[i];
        }
        WriteLine(ans);

        //for (int i = 0; i < N; i++)
        //{
        //    for (int j = 0; j < (i + 1) * 2; j++)
        //    {
        //        dp[j] += 1;
        //    }
        //    if (i > 0) dp[i * 2] += 1;
        //}
        //dp.join();
        //ModInt ans = 1;
        //foreach (var item in dp)
        //{
        //    ans *= item;
        //}
        //WriteLine(ans);
    }

}

/// <OriginalAuthor>camypaper</OriginalAuthor>
class FenwickTree
{
    readonly int n;
    readonly long[] bit;
    readonly int max = 1;
    public FenwickTree(int size)
    {
        n = size; bit = new long[n + 1];
        while ((max << 1) <= n) max <<= 1;
    }
    /// sum[a, b] 0-indexed
    public long this[int i, int j] { get { i++; j++; return i <= j ? this[j] - this[i - 1] : 0; } }
    /// sum[1, i] 1-indexed
    public long this[int i] { get { long s = 0; for (; i > 0; i -= i & -i) s += bit[i]; return s; } }
    public int LowerBound(long w)
    {
        if (w <= 0) return 0;
        int x = 0;
        for (int k = max; k > 0; k >>= 1)
            if (x + k <= n && bit[x + k] < w)
            {
                w -= bit[x + k];
                x += k;
            }
        return x + 1;
    }
    /// add v to bit[i] 0-indexed
    public void Add(int i, long v)
    {
        i++;
        //if (i == 0) System.Diagnostics.Debug.Fail("BIT is 1 indexed");
        for (; i <= n; i += i & -i) bit[i] += v;
    }
    public long[] Items
    {
        get
        {
            var ret = new long[n + 1];
            for (int i = 0; i < ret.Length; i++)
                ret[i] = this[i, i];
            return ret;
        }
    }
}

class RangeAddFenwickTree
{
    readonly int n;
    FenwickTree a, b;
    public RangeAddFenwickTree(int n)
    {
        this.n = n;
        a = new FenwickTree(n);
        b = new FenwickTree(n);
    }
    /// Add V to[i, j] 0-indexed
    public void Add(int i, int j, long v)
    {
        //a.Add(i, -(i - 1) * v); a.Add(j + 1, j * v);
        //b.Add(i, v); b.Add(j + 1, -v);
        a.Add(i, -i * v); a.Add(j + 1, (j + 1) * v);
        b.Add(i, v); b.Add(j + 1, -v);
    }
    /// Sum [1, i] 1-indexed
    public long this[int i] => a[i] + b[i] * i;
    /// Sum [i, j] 0-indexed
    public long this[int i, int j] { get { i++; j++; return i <= j ? this[j] - this[i - 1] : 0; } }
    public long[] Items
    {
        get
        {
            var ret = new long[n + 1];
            for (int i = 0; i < ret.Length; i++)
                ret[i] = this[i, i];
            return ret;
        }
    }
}

///
/// [0,<see cref="Mod"/>) までの値を取るような数
///
/// <OriginalAuthor>camypaper</OriginalAuthor>
struct ModInt
{
    ///
    /// 剰余を取る値．
    ///
    public const long Mod = (int)1e9 + 7;

    ///
    /// 実際の数値．
    ///
    public long num;
    ///
    /// 値が <paramref name="n"/> であるようなインスタンスを構築します．
    ///
    /// <param name="n">インスタンスが持つ値</param>
    /// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
    public ModInt(long n) { num = n; }
    ///
    /// このインスタンスの数値を文字列に変換します．
    ///
    /// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
    public override string ToString() { return num.ToString(); }
    public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
    public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
    public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
    public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

    ///
    /// 与えられた 2 つの数値からべき剰余を計算します．
    ///
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

    ///
    /// 与えられた 2 つの数値からべき剰余を計算します．
    ///
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    public static ModInt Pow(long v, long k)
    {
        long ret = 1;
        for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
            if ((k & 1) == 1) ret = ret * v % Mod;
        return new ModInt(ret);
    }
    ///
    /// 与えられた数の逆元を計算します．
    ///
    /// <param name="v">逆元を取る対象となる数</param>
    /// <returns>逆元となるような値</returns>
    /// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
    public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
}

class BinomialCoefficient
{
    public ModInt[] fact, ifact;
    public BinomialCoefficient(int n)
    {
        fact = new ModInt[n + 1];
        ifact = new ModInt[n + 1];
        fact[0] = 1;
        for (int i = 1; i <= n; i++)
            fact[i] = fact[i - 1] * i;
        ifact[n] = ModInt.Inverse(fact[n]);
        for (int i = n - 1; i >= 0; i--)
            ifact[i] = ifact[i + 1] * (i + 1);
        ifact[0] = ifact[1];
    }
    public ModInt this[int n, int r]
    {
        get
        {
            if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;
            return fact[n] * ifact[n - r] * ifact[r];
        }
    }
    public ModInt RepeatedCombination(int n, int k)
    {
        if (k == 0) return 1;
        return this[n + k - 1, k];
    }
}

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
{
    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;
using System.Linq;
using CompLib.Util;
using System.Threading;
using CompLib.Mathematics;

public class Program
{
    int N;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        // 長さ2Nのかっこ列すべて
        // Trieの最大マッチング

        // 木
        // 2色に塗って少ない方

        // 頂点増え方
        // 以降>しか置けない

        // < >>>>>

        //    0 1 2 3
        // 0: 1
        // 1: 1 1 ... 1
        // 2: 2 2 1 ... 3
        // 3: 5 5 3 1
        // 4:

        var dp = new ModInt[N + 1][];
        for (int i = 0; i <= N; i++)
        {
            dp[i] = new ModInt[i + 1];
        }

        dp[0][0] = 1;
        for (int i = 0; i < N; i++)
        {
            ModInt tmp = 0;
            for (int j = i; j >= 0; j--)
            {
                tmp += dp[i][j];
                dp[i + 1][j + 1] = tmp;
            }
            dp[i + 1][0] = tmp;
        }

        ModInt ans = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                ans += dp[i][j] * ((j + 2) / 2);
            }
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

// https://bitbucket.org/camypaper/complib
namespace CompLib.Mathematics
{
    #region ModInt
    /// <summary>
    /// [0,<see cref="Mod"/>) までの値を取るような数
    /// </summary>
    public struct ModInt
    {
        /// <summary>
        /// 剰余を取る値．
        /// </summary>
        public const long Mod = (int)1e9 + 7;
        // public const long Mod = 998244353;

        /// <summary>
        /// 実際の数値．
        /// </summary>
        public long num;
        /// <summary>
        /// 値が <paramref name="n"/> であるようなインスタンスを構築します．
        /// </summary>
        /// <param name="n">インスタンスが持つ値</param>
        /// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
        public ModInt(long n) { num = n; }
        /// <summary>
        /// このインスタンスの数値を文字列に変換します．
        /// </summary>
        /// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
        public override string ToString() { return num.ToString(); }
        public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
        public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
        public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
        public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

        /// <summary>
        /// 与えられた 2 つの数値からべき剰余を計算します．
        /// </summary>
        /// <param name="v">べき乗の底</param>
        /// <param name="k">べき指数</param>
        /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
        public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

        /// <summary>
        /// 与えられた 2 つの数値からべき剰余を計算します．
        /// </summary>
        /// <param name="v">べき乗の底</param>
        /// <param name="k">べき指数</param>
        /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
        public static ModInt Pow(long v, long k)
        {
            long ret = 1;
            for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
                if ((k & 1) == 1) ret = ret * v % Mod;
            return new ModInt(ret);
        }
        /// <summary>
        /// 与えられた数の逆元を計算します．
        /// </summary>
        /// <param name="v">逆元を取る対象となる数</param>
        /// <returns>逆元となるような値</returns>
        /// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
        public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
    }
    #endregion
    #region Binomial Coefficient
    public class BinomialCoefficient
    {
        public ModInt[] fact, ifact;
        public BinomialCoefficient(int n)
        {
            fact = new ModInt[n + 1];
            ifact = new ModInt[n + 1];
            fact[0] = 1;
            for (int i = 1; i <= n; i++)
                fact[i] = fact[i - 1] * i;
            ifact[n] = ModInt.Inverse(fact[n]);
            for (int i = n - 1; i >= 0; i--)
                ifact[i] = ifact[i + 1] * (i + 1);
            ifact[0] = ifact[1];
        }
        public ModInt this[int n, int r]
        {
            get
            {
                if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;
                return fact[n] * ifact[n - r] * ifact[r];
            }
        }
        public ModInt RepeatedCombination(int n, int k)
        {
            if (k == 0) return 1;
            return this[n + k - 1, k];
        }
    }
    #endregion
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


using System;

namespace _596A
{
    class Program
    {
        static void Main(string[] args)
        {
            int numberOfPoint = Convert.ToInt32(Console.ReadLine());
            int[,] coordinate = new int[numberOfPoint, 2];
            double area = 0;

            for (int i = 0; i < numberOfPoint; i++)
            {
                string str = Console.ReadLine();
                int index = str.IndexOf(' ');
                coordinate[i, 0] = Convert.ToInt32(str.Substring(0, index));
                coordinate[i, 1] = Convert.ToInt32(str.Substring(index));
            }

            if (numberOfPoint == 1) Console.WriteLine(-1);
            if (numberOfPoint == 2)
            {
                if (coordinate[0, 0] != coordinate[1, 0] && coordinate[0, 1] != coordinate[1, 1])
                {
                    area = Math.Abs(coordinate[0, 0] - coordinate[1, 0]) * Math.Abs(coordinate[0, 1] - coordinate[1, 1]);
                }
                else area = -1;
                Console.WriteLine(area);
            }
            if (numberOfPoint == 3)
            {
                if (coordinate[0, 0] != coordinate[1, 0] && coordinate[0, 1] != coordinate[1, 1])
                {
                    area = Math.Abs(coordinate[0, 0] - coordinate[1, 0]) * Math.Abs(coordinate[0, 1] - coordinate[1, 1]);
                }
                else if (coordinate[0, 0] != coordinate[2, 0] && coordinate[0, 1] != coordinate[2, 1])
                {
                    area = Math.Abs(coordinate[0, 0] - coordinate[2, 0]) * Math.Abs(coordinate[0, 1] - coordinate[2, 1]);
                }
                else
                {
                    if (coordinate[0, 0] == coordinate[1, 0])
                    {
                        area = Math.Abs(coordinate[0, 1] - coordinate[1, 1]) * Math.Abs(coordinate[0, 0] - coordinate[2, 0]);
                    }
                    else
                    {
                        area = Math.Abs(coordinate[0, 0] - coordinate[1, 0]) * Math.Abs(coordinate[0, 1] - coordinate[2, 1]);
                    }
                }
                Console.WriteLine(area);
            }
            if (numberOfPoint == 4)
            {
                for(int i = 1; i < 4; i++)
                {
                    if(coordinate[0, 0] != coordinate[i, 0] && coordinate[0, 1] != coordinate[i, 1])
                    {
                        area = Math.Abs(coordinate[0, 0] - coordinate[i, 0]) * Math.Abs(coordinate[0, 1] - coordinate[i, 1]);
                        break;
                    }
                }
                Console.WriteLine(area);
            }
        }
    }
}


using System;

namespace Olymp596A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            if (n == 1)
            {
                Console.WriteLine(-1);
            }
            else if (n == 2)
            {
                string input = Console.ReadLine();
                int x1 = int.Parse(input.Split()[0]), y1 = int.Parse(input.Split()[1]);
                input = Console.ReadLine();
                int x2 = int.Parse(input.Split()[0]), y2 = int.Parse(input.Split()[1]);

                if (x1 != x2 && y1 != y2)
                    Console.WriteLine(Math.Abs(x2 - x1) * Math.Abs(y2 - y1));
                else Console.WriteLine(-1);
            }
            else if (n == 3)
            {
                string input = Console.ReadLine();
                int x1 = int.Parse(input.Split()[0]), y1 = int.Parse(input.Split()[1]);
                input = Console.ReadLine();
                int x2 = int.Parse(input.Split()[0]), y2 = int.Parse(input.Split()[1]);
                input = Console.ReadLine();
                int x3 = int.Parse(input.Split()[0]), y3 = int.Parse(input.Split()[1]);

                if (x1 != x2 && y1 != y2)
                    Console.WriteLine(Math.Abs(x2 - x1) * Math.Abs(y2 - y1));
                else if (x1 != x3 && y1 != y3)
                    Console.WriteLine(Math.Abs(x3 - x1) * Math.Abs(y3 - y1));
                else if (x2 != x3 && y2 != y3)
                    Console.WriteLine(Math.Abs(x2 - x3) * Math.Abs(y2 - y3));
            }
            else if (n == 4)
            {
                string input = Console.ReadLine();
                int x1 = int.Parse(input.Split()[0]), y1 = int.Parse(input.Split()[1]);
                input = Console.ReadLine();
                int x2 = int.Parse(input.Split()[0]), y2 = int.Parse(input.Split()[1]);
                input = Console.ReadLine();
                int x3 = int.Parse(input.Split()[0]), y3 = int.Parse(input.Split()[1]);
                input = Console.ReadLine();
                int x4 = int.Parse(input.Split()[0]), y4 = int.Parse(input.Split()[1]);

                if (x1 != x2 && y1 != y2)
                    Console.WriteLine(Math.Abs(x2 - x1) * Math.Abs(y2 - y1));
                else if (x1 != x3 && y1 != y3)
                    Console.WriteLine(Math.Abs(x3 - x1) * Math.Abs(y3 - y1));
                else if (x2 != x3 && y2 != y3)
                    Console.WriteLine(Math.Abs(x2 - x3) * Math.Abs(y2 - y3));
            }
            Console.ReadLine();
        }
    }
}


using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] a = Console.ReadLine().Split().Select(double.Parse).ToArray();
            int forOne = (int)a[1] / (int)a[2] + ((a[1] / a[2]) % 1 != 0 ? 1 : 0);
            double rez = a[0] * forOne/ a[3];
            Console.WriteLine((int)rez + (rez % 1 != 0 ? 1 : 0));
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int ans=0;
            string[] tokens = Console.ReadLine().Split();
            int k = int.Parse(tokens[0]);
            int n = int.Parse(tokens[1]);
            int s = int.Parse(tokens[2]);
            int p = int.Parse(tokens[3]);
            /*ans=(k*(n+s-1)/s+p-1)/p;
            Console.WriteLine(ans);
            */
            n=((n-1)/s+1)*k;
            /*ans=(n-1)/p+1;*/
            ans=(n+p-1)/p;

            Console.WriteLine(ans);
        }
    }
}


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

namespace ZAD_1
{
    class Program
    {
        const decimal byte_size = 127;
        const decimal short_size = 32767;
        const decimal int_size = 2147483647;
        const decimal long_size = 9223372036854775807;
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            decimal n;
            if (Decimal.TryParse(input, out n))
            {
                if (Decimal.Compare(n, Decimal.Zero) < 0)
                {
                    n = Decimal.Negate(n);
                    n = Decimal.Subtract(n, Decimal.One);
                }
                if (Decimal.Compare(n, byte_size) <= 0)
                {
                    Console.WriteLine("byte");
                }
                else if (Decimal.Compare(n, short_size) <= 0)
                {
                    Console.WriteLine("short");
                }
                else if (Decimal.Compare(n, int_size) <= 0)
                {
                    Console.WriteLine("int");
                }
                else if (Decimal.Compare(n, long_size) <= 0)
                {
                    Console.WriteLine("long");
                }
                else
                {
                    Console.WriteLine("BigInteger");
                }
            }
            else
            {
                Console.WriteLine("BigInteger");
            }
        }
    }
}


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

namespace CF2
{
    class Program
    {
        static void Main(string[] args)
        {  long val=0;
        string s1 = Console.ReadLine();

        if (long.TryParse(s1, out val))
            {
                if (val >= -128 && val <= 127) Console.WriteLine("byte");
                else if (val >= -32768 && val <= 32767) Console.WriteLine("short");
                else if (val >= -2147483648 && val <= 2147483647) Console.WriteLine("int");
                else  Console.WriteLine("long");
            }

        else Console.WriteLine("BigInteger");
        }

    }
}


using System;
using System.Linq;

namespace FlippingGame
{
    class FlippingGame
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] values = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] partialOnesObtained = new int[n];

            int numOfOnes = values.Count(v => v == 1);

            if (numOfOnes == n)
                Console.WriteLine(n - 1);
            else
            {
                partialOnesObtained[0] = 1 - values[0];

                for (int i = 1; i < n; i++)
                {
                    if (values[i] == 0)
                        partialOnesObtained[i] = partialOnesObtained[i - 1] + 1;
                    else
                        partialOnesObtained[i] = partialOnesObtained[i - 1] - 1 < 0 ? 0 : partialOnesObtained[i - 1] - 1;
                }

                Console.WriteLine(numOfOnes + partialOnesObtained.Max());
            }
        }
    }
}


/*
There are n integers a1, a2, ..., an. Each of those integers can be either 0 or 1. We are allowed to do exactly one move: We must choose two indices i and j (1 <= i <= j <= n) and flip all values ak for which their positions are in range [i, j] (that is i <= k <= j). Flip the value of x means to apply operation x = 1 - x.

The goal is - After exactly one move to obtain the maximum number of ones.

Input:-

The first line of the input contains an integer n (1 <= n <= 10^6). In the second line of the input there are n integers: a1, a2, ..., an. It is guaranteed that each of those n values is either 0 or 1

Output:-
Print an integer - the maximal number of 1s that can be obtained after exactly one move.

Sample test(s)
input
5
1 0 0 1 0
output
4

input
4
1 0 0 1
output
4

Note:-
In the first case, flip the segment from 2 to 5 (i=2, j=5). That flip changes the sequence, it becomes: [1 1 1 0 1]. So, it contains four ones. There is no way to make the whole sequence equal to [1 1 1 1 1].

In the second case, flipping only the second and the third element (i=2, j=3) will turn all numbers into 1.

Source: http://codeforces.ru/problemset/problem/327/A
*/

using System;

namespace FlippingGame327A
{
    class Program
    {
        static int kkMax(int a, int b)
        {
            return (a < b) ? b : a;
        }

        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int n = Convert.ToInt32(str);
            str = Console.ReadLine();
            string[] strArray = str.Split(' ');
            int[] input = new int[n + 3];
            int sum = 0;
            for (int i = 0; i < n; i++)
            {
                input[i] = Convert.ToInt32(strArray[i]);
                if (input[i] == 1)
                {
                    sum++;
                }
            }

            // main logic
            // O(n^2) solution
            int[,] res = new int[n, n];
            int ans = Int32.MinValue;
            for (int i = 0; i < n; i++)
            {
                int zeros = 0;
                for (int j = i; j < n; j++)
                {
                    if (input[j] == 0)
                    {
                        zeros++;
                        res[i, j] = zeros;
                    }
                    int temp = sum - (j - i + 1 - res[i, j]) + res[i, j];
                    ans = (temp > ans) ? temp : ans;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

namespace consoleTraining
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = Console.ReadLine();

            List<string> coords = new List<string>();
            coords.Add("0;0");
            int lastX = 0, lastY = 0; char lastCh = path[0];
            foreach (char ch in path)
            {
                if (ch == 'L') { lastX--; }
                if (ch == 'R') { lastX++; }
                if (ch == 'U') { lastY++; }
                if (ch == 'D') { lastY--; }
                string[] checkStrs = strs(ch, lastX, lastY);
                foreach (string checkStr in checkStrs) if (coords.Contains(checkStr)) { Console.WriteLine("BUG"); return; }
                if ((ch == 'L' && lastCh == 'R') || (ch == 'R' && lastCh == 'L') || (ch == 'U' && lastCh == 'D') || (ch == 'D' && lastCh == 'U')) { Console.WriteLine("BUG"); return; }
                coords.Add(string.Format("{0};{1}", lastX, lastY)); lastCh = ch;
            }
            Console.WriteLine("OK");
        }

        static string[] strs(char ch, int x, int y)
        {
            List<string> checkCoords = new List<string>();
            string up = string.Format("{0};{1}", x, y + 1);
            string down = string.Format("{0};{1}", x, y - 1);
            string left = string.Format("{0};{1}", x - 1, y);
            string right = string.Format("{0};{1}", x + 1, y);
            if (ch == 'U') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(left); }
            if (ch == 'D') { checkCoords.Add(down); checkCoords.Add(right); checkCoords.Add(left); }
            if (ch == 'L') { checkCoords.Add(up); checkCoords.Add(down); checkCoords.Add(left); }
            if (ch == 'R') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(down); }
            return checkCoords.ToArray();
        }

    }
}


/*******************************************************************************
* Author: Nirushuu
*******************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.IO;
using System.Globalization;
using System.Numerics;

/*******************************************************************************
* IO from Kattio.cs from open.kattis.com/help/csharp                          */
public class NoMoreTokensException : Exception
{
}

public class Tokenizer
{
    string[] tokens = new string[0];
    private int pos;
    StreamReader reader;

    public Tokenizer(Stream inStream)
    {
        var bs = new BufferedStream(inStream);
        reader = new StreamReader(bs);
    }

    public Tokenizer() : this(Console.OpenStandardInput())
    {
        // Nothing more to do
    }

    private string PeekNext()
    {
        if (pos < 0)
            // pos < 0 indicates that there are no more tokens
            return null;
        if (pos < tokens.Length)
        {
            if (tokens[pos].Length == 0)
            {
                ++pos;
                return PeekNext();
            }
            return tokens[pos];
        }
        string line = reader.ReadLine();
        if (line == null)
        {
            // There is no more data to read
            pos = -1;
            return null;
        }
        // Split the line that was read on white space characters
        tokens = line.Split(null);
        pos = 0;
        return PeekNext();
    }

    public bool HasNext()
    {
        return (PeekNext() != null);
    }

    public string Next()
    {
        string next = PeekNext();
        if (next == null)
            throw new NoMoreTokensException();
        ++pos;
        return next;
    }
}

public class Scanner : Tokenizer
{

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

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

    public float NextFloat()
    {
        return float.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }
}

public class BufferedStdoutWriter : StreamWriter
{
    public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))
    {
    }
}
/******************************************************************************/

/*******************************************************************************
* DisjointSet datastructure                                                   */
public struct DisjointSet {
    public int[] parent;
    public int[] rank;
    public DisjointSet(int n) {
        parent = new int[n];
        for (int i = 0; i < n; ++i) {
            parent[i] = i;
        }
        rank = new int[n];
    }

    public int Find(int i) {
        int idx = i;
        var compress = new List<int>();
        while (idx != parent[idx]) {
            compress.Add(idx);
            idx = parent[idx];
        }

        foreach (var e in compress) {   // path compress
            parent[e] = idx;
        }
        return idx;
    }

    public void Union(int a, int b) {
        int aPar = this.Find(a);
        int bPar = this.Find(b);

        if (rank[aPar] > rank[bPar]) {  // by rank
            parent[bPar] = aPar;
        } else {
            parent[aPar] = bPar;
        }
        if (rank[aPar] == rank[bPar]) {
            ++rank[bPar];
        }
    }
}

class MaxHeap {
    List<int> data;

    public MaxHeap() {
        data = new List<int>();
    }

    public void Add(int a) {
        data.Add(a);
        int idx = data.Count - 1;
        int parent = (int) Math.Floor((double) (idx - 1) / 2);
        while (idx != 0 && (data[idx] > data[parent])) {
            int tmp = data[parent];
            data[parent] = data[idx];
            data[idx] = tmp;

            idx = parent;
            parent = (int) Math.Floor((double) (idx - 1) / 2);
        }
    }

    public int Pop() {
        int res = data[0];
        data[0] = data[data.Count - 1];
        data.RemoveAt(data.Count - 1);

        int idx = 0;
        while (true) {
            int child1 = (2 * idx) + 1;
            int child2 = (2 * idx) + 2;

            if (child1 >= data.Count) { // no children
                break;
            } else if (child2 >= data.Count) {  // one child
                if (data[idx] < data[child1]) {
                    int tmp = data[idx];
                    data[idx] = data[child1];
                    data[child1] = tmp;
                }
                break;
            } else {    // two children
                int maxChild = data[child1] > data[child2] ? child1 : child2;
                if (data[idx] < data[maxChild]) {
                    int tmp = data[idx];
                    data[idx] = data[maxChild];
                    data[maxChild] = tmp;
                    idx = maxChild;
                    continue;
                } else {    // no swap
                    break;
                }
            }
        }

        return res;
    }

}

class Dequeue {
    public Dictionary<int, int> data = new Dictionary<int, int>();
    int firstIdx;
    public int Count;
    public Dequeue() {
        data = new Dictionary<int, int>();
        firstIdx = 1;
        Count = 0;
    }

    public void PushFront(int a) {
        data[firstIdx - 1] = a;
        ++Count;
        --firstIdx;
    }

    public void PushBack(int a) {
        data[firstIdx + Count] = a;
        ++Count;
    }

    public int PopFront() {
        --Count;
        ++firstIdx;
        return data[firstIdx - 1];
    }

    public int PopBack() {
        --Count;
        return data[firstIdx + Count];
    }

    public int Get(int n) {
        return data[firstIdx + n];
    }
}
/******************************************************************************/

class MainClass {

    // Debug functions
    static void debug<T>(IEnumerable<T> a, string s = "") {
        Console.WriteLine($"name: {s}");
        int i = 0;
        foreach (var e in a) {
            Console.WriteLine($"value {i}: {e}");
            ++i;
        }
    }
    static void dbg<T>(T a, string s = "") {
        Console.WriteLine($"name: {s} value: {a}");
    }
    ////////////////////

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

    // class PairInt{
    //     public int fst;
    //     public int snd;

    //     // void Add(Pair<int> p) {
    //     //     fst += p.fst;
    //     //     snd += p.snd;
    //     // }
    // }

    public static void Main() {

        var sc = new Scanner();
        var wr = new BufferedStdoutWriter();
        var dot = new NumberFormatInfo();
        dot.NumberDecimalSeparator = ".";

        // int T = sc.NextInt();

        // for (int t = 0; t < T; ++t) {
        // }

        string s = sc.Next();

        var visited = new HashSet<Tuple<int, int>>();
        var dir = new Dictionary<char, Tuple<int, int>>{
            {'R', new Tuple<int, int>(1, 0)},
            {'L', new Tuple<int, int>(-1, 0)},
            {'U', new Tuple<int, int>(0, 1)},
            {'D', new Tuple<int, int>(0, -1)}
        };

        var pos = new Tuple<int, int>(0, 0);
        visited.Add(pos);

        foreach (var e in s) {
            var prev = pos;
            pos = new Tuple<int, int>(pos.Item1 + dir[e].Item1, pos.Item2 + dir[e].Item2);

            if (visited.Contains(pos)) {
                wr.Write("BUG");
                wr.Flush();
                return;
            }

            visited.Add(pos);

            foreach (var d in dir.Values) {
                var nbr = new Tuple<int, int>(pos.Item1 + d.Item1, pos.Item2 + d.Item2);
                if (visited.Contains(nbr) && !(nbr.Equals(prev))) {
                    // wr.Write(e);
                    // wr.Write(pos);
                    // wr.Write(nbr);
                    wr.Write("BUG");
                    wr.Flush();
                    return;
                }
            }
        }

        // debug(pos);
        // foreach (var e in visited) {
        //     debug(e);
        // }

        wr.Write("OK");

        wr.Flush();

    }
}


using System;
using System.Linq;

namespace Task922Asecondtry
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse);
            int X = input.ElementAt(0), Y = input.ElementAt(1);

            if(
                Y == 1 && X!=0             ||
                Y == 0                     ||
                Y % 2 == 0  &&  X % 2 == 0 ||
                Y % 2 != 0 && X % 2 != 0   ||
                X < Y - 1

                )

            Console.WriteLine("NO");
            else Console.WriteLine("yes");

        }
    }
}


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

namespace KlonirovanijeIgrushek
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int x = int.Parse(s[0]);
            int y = int.Parse(s[1]);

            if (y == 1 && x > 0)
                Console.Write("no");
            else if ((x - y + 1) % 2 == 0 && (y - 1 <= x) && y > 0)
                Console.Write("yes");
            else
                Console.Write("no");

        }
    }
}


using System;
using System.Linq;

public class Program
{
    public static void Main()
    {
        var input = Console.ReadLine().Split(' ');
        var n = int.Parse(input[0]);
        var a = int.Parse(input[1]);
        var b = int.Parse(input[2]);
        var c = int.Parse(input[3]);
        var d = int.Parse(input[4]);

        long totalCombinations = 0;
        for (var x1i = 1; x1i <= n; ++x1i)
        {
            var x2i = x1i + b - c;
            // x3i can be any number with [1, n] range.
            var x4i = x1i + a - d;
            var x5i = x1i + a + b - c - d;
            if (x2i >= 1 && x2i <= n && x4i >= 1 && x4i <= n && x5i >= 1 && x5i <= n)
                ++totalCombinations;
        }
        // Current total combinations is valid for any x3i.
        totalCombinations *= n;
        Console.WriteLine(totalCombinations);
    }
}


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

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine()
                .Split()
                .Select(int.Parse)
                .ToList();
            int n = input[0], a = input[1], b = input[2], c = input[3], d = input[4];
            long count = 0;
            for (int x = 1; x <= n; x++)
            {
                int m = x + a - d, z = x + b - c, k = x + b - c + a - d;
                if (m >=  1 && z >= 1 && k >= 1 &&
                    m <= n && z <= n && k <= n)
                {

                    int f = x + a + b, s = b + m + d, t = d + c + k, fo = a + z + c;
                    if (f == s && f == t && f == fo)
                        count += n;
                }
            }
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Linq;

namespace _985A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int zoma = n / 2, oddCount=0,evenCount=0;
            int[] posArray = new int[zoma];
            var inputs = Console.ReadLine().Split().Select(int.Parse);
            posArray = inputs.ToArray();
            Array.Sort(posArray);
            for (int i=n, j = zoma-1; i > 0; i-=2,j--)
                if (posArray[j] != i) evenCount+= Math.Abs(i - posArray[j]);
            for (int i = n-1, j = zoma - 1; i > 0; i -= 2, j--)
                if (posArray[j] != i)  oddCount+= Math.Abs(i - posArray[j]);
            Console.WriteLine(evenCount < oddCount ? evenCount : oddCount);
        }
    }
}


using System;

namespace Codeforces {

    class Chess {

        static int N;
        static int numCount;
        static int[] an = new int[2000];

        static void ReadData() {
            Int32.TryParse(Console.ReadLine(), out N);
            var line = Console.ReadLine().Split(new char[]{' '});
            numCount = line.Length;
            for (int i = 1; i <= numCount; ++i)
            {
                Int32.TryParse(line[i-1], out an[i]);
            }
        }

        static int TrySolve(int color) {
            var result = 0;
            for (int i = 1; i<=numCount; ++i) {
                var loc = (i*2) - color;
                result += Math.Abs(an[i]-loc);
            }
            return result;
        }

        static void Main(string[] args) {
            ReadData();
            Array.Sort(an,1,numCount);
            Console.WriteLine(Math.Min(TrySolve(0), TrySolve(1)));
        }

    }
}


using System;
class A
{
				static void Main()
				{
								string input = Console.ReadLine();
								string[] split = input.Split(' ');
								int n = int.Parse(split[0]);
								int m = int.Parse(split[1]);
								input = Console.ReadLine();
								split = input.Split(' ');
								int[] button = new int [m];
								for(int i = 0; i < m; i++)
								{
												button[i] = int.Parse(split[i]);
								}
								int[] light = new int [n];
								for(int i = 0; i<m; i++)
								{
												for(int j = 0; j<n; j++)
												{
																if(button[i]<=j+1)
																				if(light[j]==0)
																								light[j]=button[i];
												}
								}
								string output = "";
								foreach(int l in light)
								{
												output+=l+" ";
								}
								Console.WriteLine(output);
				}
}


using System;
using System.Collections.Generic;

public class Test
{
    public static void Main()
    {
        string input = Console.ReadLine();
        string[] splits = input.Split(' ');
        int n = int.Parse(splits[0]);
        int m = int.Parse(splits[1]);
        splits = Console.ReadLine().Split(' ');
        List<int> list = new List<int>();
        for (int i = 0; i < splits.Length; i++)
            {
                list.Add(int.Parse(splits[i]));
            }

        string output = "";
         for (int i = 1; i <= n; i++)
            {
                for (int j = 0; j < list.Count; j++)
                {
                    if (i >= list[j])
                    {
                        output += list[j]+" ";
                        break;
                    }
                }
            }

            Console.Write(output.Trim());
    }
}


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            var S = s.Split();
            int n = Convert.ToInt32(S[0]);
            int m = Convert.ToInt32(S[1]);
            s = Console.ReadLine();
            S = s.Split();
            List<int> A = new List<int>();
            foreach (var item in S) A.Add(Convert.ToInt32(item));
            s = Console.ReadLine();
            S = s.Split();
            List<int> B = new List<int>();
            foreach (var item in S) B.Add(Convert.ToInt32(item));
            for (int i = 0; i < A.Count; i++)
            {
                if (!B.Contains(A[i])) { A.RemoveAt(i); i--; }
            }
            foreach (var a in A)
                Console.Write(a +" ");
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
    static void Main(String[] args) {
       int[] nk = Console.ReadLine().Trim().Split(' ').Select(arTemp => Convert.ToInt32(arTemp)).ToArray();
        int[] ar = Console.ReadLine().Trim().Split(' ').Select(arTemp => Convert.ToInt32(arTemp)).ToArray();
        int[] cnt=new int[10];
        int[] finger = Console.ReadLine().Trim().Split(' ').Select(arTemp => Convert.ToInt32(arTemp)).ToArray();
        for(int i=0;i<finger.Length;i++){
            cnt[finger[i]]++;
        }
        for(int j=0;j<ar.Length;j++){
            if(cnt[ar[j]]>0){
                Console.Write(ar[j]+" ");
            }
        }

    }
}


using System;

namespace A._Expression
{
    class Program
    {
        static void Main(string[] args)
        {
            short a = Convert.ToInt16(Console.ReadLine());
            short b = Convert.ToInt16(Console.ReadLine());
            short c = Convert.ToInt16(Console.ReadLine());

            short max = 0;

            if ((a + b + c) > max) max = (short)(a + b + c);
            if (((a + b) + c) > max) max = (short)(a + b + c);
            if ((a + b * c) > max) max = (short)(a + b * c);
            if ((a * (b + c)) > max) max = (short)(a * (b + c));
            if ((a * b * c) > max) max = (short)(a * b * c);
            if (((a + b) * c) > max) max = (short)((a + b) * c);

            Console.WriteLine(max);

        }
    }
}


using System;
using System.IO;
using System.Linq;

class Program
{
    static char[] SPACE = new[] { ' ' };

    static void Main(string[] args)
    {
#if DEBUG
        using (var input = new StreamReader("input.txt"))
        using (var output = new StreamWriter("output.txt"))
        {
            Console.SetIn(input);
            Console.SetOut(output);

            int n = 0;
            do
            {
                Console.WriteLine();
                Console.WriteLine("Sample {0}", ++n);
                Prog();
            } while (Console.ReadLine() == string.Empty);
        }
#else
            Prog();
#endif
    }

    static int __ptr = 0;
    static string[] __input;
    static int NextInt()
    {
        return int.Parse(__input[__ptr++]);
    }
    static void ReadTokens(int n)
    {
        __ptr = 0;
        __input = Console.ReadLine().Split(SPACE, n);
    }

    //

    static void Prog()
    {
        ReadTokens(1);
        int a = NextInt();
        ReadTokens(1);
        int b = NextInt();
        ReadTokens(1);
        int c = NextInt();

        int r = 0;
        r = Math.Max(r, a + b + c);
        r = Math.Max(r, a * b + c);
        r = Math.Max(r, a + b * c);
        r = Math.Max(r, a * b * c);
        r = Math.Max(r, (a + b) * c);
        r = Math.Max(r, a * (b + c));

        Console.WriteLine(r);
    }
}


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

namespace A {
	class Program {
		static void Main() {
			int[] arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
			int a = arr[0];
			int b = arr[1];
			string ret = "NO";

			if (-1 <= a-b && a-b <= 1 && a+b > 0) ret = "YES";

			Console.WriteLine(ret);
		}
	}
}


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

namespace A.Dasha_and_Stairs
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
          here:  int a =int.Parse(s[0]);
            int b = int.Parse(s[1]);
            if(a<0||b>100)
            {
                goto here;
            }
            if((a==b&&a!=0)||a==b+1||b==a+1)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


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

namespace work01
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var n = Int32.Parse (Console.ReadLine ());

			var l1 = n > 4 ? (n + 1) / 3 : n > 0 ? 1 : 0;
			var l2 = n > 4 ? n / 3 : n > 1 ? 1 : 0;
			var l3 = n > 2 ? 1 : 0;
			var l4 = n > 4 ? (n - 1) / 3 : n > 3 ? 1 : 0;

			Func <int, int, string> print = (k, m) => {
				var sb = new StringBuilder();
				for (var i = 1; i <= m; i++) {
					sb.AppendFormat("{0}.", (i <= k) ? "O" : "#" );
				}
				return sb.ToString();
			};

			Console.WriteLine("+------------------------+");
			Console.WriteLine("|{0}|D|)", print(l1, 11));
			Console.WriteLine("|{0}|.|", print(l2, 11));
			Console.WriteLine("|{0}......................|", print(l3, 1));
			Console.WriteLine("|{0}|.|)", print(l4, 11));
			Console.WriteLine("+------------------------+");
		}
	}
}


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

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            //using (var sw = new StreamWriter("output.txt"))
            {
                task.Solve(sr, sw);
                //Console.ReadKey();
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var matrix = new char[4, 4];
            for (var i = 0; i < 4; i++) {
                var next = sr.NextString();
                for (var j = 0; j < 4; j++) {
                    matrix[i, j] = next[j];
                }
            }
            for (var i = 0; i < 4; i++) {
                for (var j = 0; j < 4; j++) {
                    var old = matrix[i, j];
                    if (matrix[i, j] == '.') {
                        matrix[i, j] = 'x';
                        if (Check(matrix)) {
                            sw.WriteLine("YES");
                            return;
                        }
                        matrix[i, j] = old;
                    }
                }
            }

            sw.WriteLine("NO");
        }

        private bool Check(char[,] matrix)
        {
            for (var i = 0; i < 4; i++) {
                for (var j = 0; j < 4; j++) {
                    if (i - 2 >= 0) {
                        if (matrix[i, j] == 'x' && matrix[i - 1, j] == 'x' && matrix[i - 2, j] == 'x') {
                            return true;
                        }
                    }
                    if (i + 2 < 4) {
                        if (matrix[i, j] == 'x' && matrix[i + 1, j] == 'x' && matrix[i + 2, j] == 'x') {
                            return true;
                        }
                    }
                    if (j - 2 >= 0)
                    {
                        if (matrix[i, j] == 'x' && matrix[i, j - 1] == 'x' && matrix[i, j - 2] == 'x')
                        {
                            return true;
                        }
                    }
                    if (j + 2 < 4)
                    {
                        if (matrix[i, j] == 'x' && matrix[i, j + 1] == 'x' && matrix[i, j + 2] == 'x')
                        {
                            return true;
                        }
                    }
                    if (i - 1 >= 0 && j - 1 >= 0 && i + 1 < 4 && j + 1 < 4) {
                        if (matrix[i, j] == 'x' && matrix[i - 1, j - 1] == 'x' && matrix[i + 1, j + 1] == 'x') {
                            return true;
                        }
                    }
                    if (i - 1 >= 0 && j + 1 < 4 && j - 1 >= 0 && i + 1 < 4) {
                        if (matrix[i, j] == 'x' && matrix[i - 1, j + 1] == 'x' && matrix[i + 1, j - 1] == 'x') {
                            return true;
                        }
                    }
                }
            }

            return false;
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


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

namespace Ilya_and_tic_tac_toe_game
{
    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)
        {
            var nn = new int[10,10];
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    nn[i + 3, j + 3] = Next();
                }
            }

            var dx = new[] {0, 1, 1, -1};
            var dy = new[] {1, 0, 1, 1};
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (nn[i + 3, j + 3] == 0)
                    {
                        for (int k = 0; k < dx.Length; k++)
                        {
                            for (int l = -2; l <= 0; l++)
                            {
                                int c = 0;
                                for (int m = 0; m < 3; m++)
                                {
                                    c += nn[i + 3 + dx[k]*(l + m), j + 3 + dy[k]*(l + m)];
                                }
                                if (c == 2)
                                {
                                    writer.WriteLine("YES");
                                    writer.Flush();
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            writer.WriteLine("NO");
            writer.Flush();
        }

        private static int Next()
        {
            do
            {
                int c = reader.Read();
                if (c == 'x')
                    return 1;
                if (c == '.')
                    return 0;
                if (c == 'o')
                    return -1;
                if (c == -1)
                    return -2;
            } while (true);
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool otv = true;
            string pass = Console.ReadLine();
            int n = int.Parse(Console.ReadLine());
            string[] a = new string[n];
            string s = null;
            for (int i = 0; i < n; i++)
            {
                a[i] = Console.ReadLine();
            }
            for(int k = 0; k < n; k++)
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < i; j++)
                    {
                        s += a[j];
                    }
                    s += a[k];
                    for (int j = i; j < n; j++)
                    {
                        s += a[j];
                    }
                    if (s.Contains(pass))
                    {
                        otv = false;
                        s = null;
                        break;
                    }
                    else
                    {
                        s = null;
                    }
                }
            }

            if (otv)
                Console.WriteLine("NO");
            else
                Console.WriteLine("YES");
            Console.Read();
        }
    }
}