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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MUH_and_Sticks
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            Array.Sort(a);
            int count = 0;
            if (a[0] == a[1] && a[1] == a[2] && a[2] == a[3])
            {
                if (a[4] == a[5])
                    Console.WriteLine("Elephant");
                else
                    Console.WriteLine("Bear");
            }
            else if (a[2] == a[3] && a[3] == a[4] && a[4] == a[5])
            {
                if ((a[0] == a[1]))
                    Console.WriteLine("Elephant");
                else
                    Console.WriteLine("Bear");
            }
            else
            {

                if(a[0] == a[1] && a[1] == a[2] && a[2] == a[3]|| a[1] == a[2] && a[2] == a[3] && a[3] == a[4]|| a[2] == a[3] && a[3] == a[4] && a[4] == a[5])
                    Console.WriteLine("Bear");
                else
                    Console.WriteLine("Alien");
            }
            Console.ReadLine();
        }
    }
}


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

namespace ReadWriteTemplate
{
    public static class Solver
    {
        private static void SolveCase()
        {
            int n = ReadInt();
            long w = ReadLong();
            var segments = new Segment[n];
            var starts = new List<PP>();
            var ends = new List<PP>();
            for (int i = 0; i < n; i++)
            {
                long x = ReadLong();
                long v = -ReadLong();
                bool swap = false;
                if (x < 0)
                {
                    x = -x;
                    v = -v;
                    swap = true;
                }
                var start = new PP(x, v + w);
                var end = new PP(x, v - w);
                if (swap)
                {
                    PP tmp = start;
                    start = end;
                    end = tmp;
                }
                segments[i] = new Segment(start, end);

                starts.Add(start);
                ends.Add(end);
            }

            starts = starts.Shuffle().ToList();
            starts.Sort(Comparison);

            for (int i = 0; i < starts.Count; i++)
            {
                starts[i].Segment.End.X = i;
            }

            ends = ends.Shuffle().ToList();
            ends.Sort(Comparison);

            var p = new int[n];
            for (int i = 0; i < n; i++)
            {
                p[i] = ends[i].X;
            }

            long ans = Permutation.InversionsCount(p);
            Writer.WriteLine(ans);
        }

        private static int Comparison(PP a, PP b)
        {
            long d = -(a.A * b.B - a.B * b.A);
            if (d != 0)
            {
                return d > 0 ? 1 : -1;
            }
            if (a.X != b.X)
            {
                return b.X - a.X;
            }
            if (a != a.Segment.End)
            {
                return Comparison(b.Segment.End, a.Segment.End);
            }
            return 0;
        }

        public static class Permutation
        {
            public static long InversionsCount(int[] permutation)
            {
                int[] a = permutation.ToArray();
                int[] b = permutation.ToArray();
                return InversionsCountInternal(a, 0, permutation.Length, b);
            }

            private static long InversionsCountInternal(int[] a, int lo, int hi, int[] b)
            {
                if (hi - lo < 2)
                    return 0;

                int mid = (lo + hi) / 2;

                return InversionsCountInternal(b, lo, mid, a) + InversionsCountInternal(b, mid, hi, a) + Merge(a, lo, mid, hi, b);
            }

            private static long Merge(int[] a, int lo, int mid, int hi, int[] b)
            {
                int i = lo;
                int j = mid;
                long result = 0;
                for (int k = lo; k < hi; k++)
                {
                    if (i < mid && (j >= hi || a[i] <= a[j]))
                    {
                        b[k] = a[i];
                        i++;
                    }
                    else
                    {
                        b[k] = a[j];
                        j++;
                        result += (mid - i);
                    }
                }
                return result;
            }
        }

        public class PP
        {
            public PP(long a, long b)
            {
                A = a;
                B = b;
                X = 0;
            }

            public long A;

            public long B;

            public int X;

            public Segment Segment;
        }

        public class Segment
        {
            public Segment(PP start, PP end)
            {
                Start = start;
                End = end;
                OnStart = 0;
                start.Segment = this;
                end.Segment = this;
            }

            public PP Start;

            public PP End;

            public long OnStart;
        }

        public static void Solve()
        {
            // int T = ReadInt();
            // for (int i = 0; i < T; i++)
            // {
            //     Writer.Write("Case #{0}: ", i + 1);
                SolveCase();
            // }
        }

        public class Point
        {
            public Point(int x, int y)
            {
                X = x;
                Y = y;
            }

            public int X;

            public int Y;

            public double Length { get { return Math.Sqrt(X * X + Y * Y); } }

            protected bool Equals(Point other)
            {
                return X == other.X && Y == other.Y;
            }

            public override bool Equals(object obj)
            {
                if (ReferenceEquals(null, obj))
                {
                    return false;
                }
                if (ReferenceEquals(this, obj))
                {
                    return true;
                }
                /*if (obj.GetType() != this.GetType())
                {
                    return false;
                }*/
                return Equals((Point) obj);
            }

            public override int GetHashCode()
            {
                unchecked
                {
                    return (X * 397) ^ Y;
                }
            }

            public int Dist2(Point p)
            {
                return (p.X - X) * (p.X - X) + (p.Y - Y) * (p.Y - Y);
            }

            public static Point operator +(Point a, Point b)
            {
                return new Point(a.X + b.X, a.Y + b.Y);
            }

            public static Point operator -(Point a, Point b)
            {
                return new Point(a.X - b.X, a.Y - b.Y);
            }
        }

        public static class Standard
        {
            public static long Power(long x, long p, long mod)
            {
                long result = 1;
                while (p > 0)
                {
                    if ((p & 1) == 0)
                    {
                        x = (x * x) % mod;
                        p >>= 1;
                    }
                    else
                    {
                        result = (result * x) % mod;
                        p--;
                    }
                }
                return result;
            }

            public static long Gcd(long a, long b)
            {
                return b == 0 ? a : Gcd(b, a % b);
            }

            public static List<int> GetPrimes(int n)
            {
                bool[] isPrime = Enumerable.Repeat(true, n + 1).ToArray();
                isPrime[0] = false;
                isPrime[1] = false;
                for (int i = 2; i <= n; i++)
                {
                    if (isPrime[i])
                    {
                        for (int j = i + i; j <= n; j += i)
                        {
                            isPrime[j] = false;
                        }
                    }
                }
                List<int> primes = new List<int>();
                for (int i = 0; i <= n; i++)
                {
                    if (isPrime[i])
                    {
                        primes.Add(i);
                    }
                }
                return primes;
            }
        }

        public static void Main()
        {
            //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if DEBUG
            //Reader = Console.In; Writer = Console.Out;
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");
#else
            Reader = Console.In; Writer = Console.Out;
#endif

            Solve();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

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

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

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

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

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));//
        }

        #endregion
    }
}


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

class Solver
{
    public void Solve(Scanner sc)
    {
        string S = sc.Str, T = sc.Str;
        var dp = Create(S.Length + 1, () => Create(T.Length+1, () => Create(201, () => int.MaxValue / 4)));
        dp[0][0][0] = 0;

        for (int i = 0; i <= S.Length; i++)
        {
            for (int j = 0; j <= T.Length; j++)
            {
                for (int k = 0; k < 200; k++)
                {
                    chmin(ref dp[i][j][k + 1], dp[i][j][k] + 1);
                }
                for (int k = 199; k >= 0; k--)
                {
                    chmin(ref dp[i][j][k], dp[i][j][k + 1] + 1);
                }
                for (int k = 0; k < 201; k++)
                {
                    if (i<S.Length&&j<T.Length&&S[i] == T[j])
                    {
                        int c = k;
                        if (S[i] == '(') c++;
                        else c--;
                        if (0 <= c && c < 201)
                            chmin(ref dp[i + 1][j + 1][c], dp[i][j][k] + 1);
                    }
                    if(i<S.Length)
                    {
                        int c = k;
                        if (S[i] == '(') c++;
                        else c--;
                        if (0 <= c && c < 201)
                            chmin(ref dp[i + 1][j][c], dp[i][j][k] + 1);
                    }
                    if(j<T.Length)
                    {
                        int c = k;
                        if (T[j] == '(') c++;
                        else c--;
                        if (0 <= c && c < 201)
                            chmin(ref dp[i][j + 1][c], dp[i][j][k] + 1);
                    }
                }
            }
        }
        var res = new List<char>();
        int s = S.Length, t = T.Length, l = 0;
        while (dp[s][t][l] != 0)
        {
            for(int j = -1; j < 2; j += 2)
            {
                int n = l + j;
                if (0 <= n && n < 201 && dp[s][t][n] + 1 == dp[s][t][l])
                {
                    l = n;
                    if (j == -1) res.Add('(');
                    else res.Add(')');
                    goto END;
                }
            }
            if (s>0&&t>0&&S[s - 1] == T[t - 1])
            {
                int n = l;
                if (S[s - 1] == '(') n--;
                else n++;
                if (0 <= n && n < 201 && dp[s - 1][t - 1][n] + 1 == dp[s][t][l])
                {
                    res.Add(S[s - 1]);
                    s--;t--;l = n;goto END;
                }
            }
            if (s > 0)
            {
                int n = l;
                if (S[s - 1] == '(') n--;
                else n++;
                if (0 <= n && n < 201 && dp[s - 1][t][n] + 1 == dp[s][t][l])
                {
                    res.Add(S[s - 1]);
                    s--; l = n; goto END;
                }
            }
            if (t > 0)
            {
                int n = l;
                if (T[t - 1] == '(') n--;
                else n++;
                if (0 <= n && n < 201 && dp[s][t-1][n] + 1 == dp[s][t][l])
                {
                    res.Add(T[t - 1]);
                    t--; l = n; goto END;
                }
            }
        END:;
        }
        res.Reverse();
        Console.WriteLine(new string(res.ToArray()));
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve(new Scanner());
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { 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) < 0) { 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 void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    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; }
    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 IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.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);
    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 (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
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 Deconstruct(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 Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


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

class Program
{
    const bool TEST_MODE = false;

    static void Main()
    {
        if (TEST_MODE)
        {
            string[] readText = File.ReadAllLines("..\\..\\TextFile1.txt");

            var testCases = new Dictionary<List<string>, string>();
            var lastKeyword = "";
            var current = new List<string>();
            foreach (string s in readText)
            {
                if(s == "Input")
                {
                    current = new List<string>();
                    lastKeyword = s;
                    continue;
                }
                if (s == "Copy")
                    continue;
                if (s == "Output")
                {
                    lastKeyword = s;
                    continue;
                }

                if (lastKeyword == "Input")
                    current.Add(s);
                if (lastKeyword == "Output")
                    testCases.Add(current,s);

            }

            foreach(var testCase in testCases)
            {
                var result = ProblemWrapper.Solve(testCase.Key.ToArray(), testCase.Value);
                if (result == testCase.Value)
                    Console.ForegroundColor = ConsoleColor.Green;
                else
                    Console.ForegroundColor = ConsoleColor.Red;

                Console.Write("input: ");
                foreach (var input in testCase.Key)
                    Console.Write(input + " // ");
                Console.Write("\noutput: ");
                Console.WriteLine(testCase.Value);

                Console.Write("Actual: ");
                Console.WriteLine(result);

                Console.ResetColor();
            }
        }
        else
            ProblemWrapper.Solve();

        Console.ReadLine();
    }
}

class ProblemWrapper
{
    public static void Solve()
    {
        string[] input = new string[2];
        input[0] = Console.ReadLine();
        input[1] = Console.ReadLine();

        var a = ReadString(input[0]);
        var b = ReadString(input[1]);

        Console.WriteLine (Algo(a, b));
    }

    public static string Solve(string[] input, string output)
    {
        var a = ReadString(input[0]);
        var b = ReadString(input[1]);

        return (Algo(a, b));
    }

    public static string Algo(string a, string b)
    {
        int answer = 0;

        //**
        {
            var row1 = a.ToCharArray();
            var row2 = b.ToCharArray();

            var n = row1.Length;
            if (n < 2)
                return "0";

            for (var i = 0; i < n; i++)
            {
                if (row1[i] == '0')
                {
                    if (i != 0 && row2[i - 1] == '0' && row2[i] == '0')
                    {
                        row1[i] = 'X'; row2[i] = 'X'; row2[i - 1] = 'X';
                        answer++;
                    }
                    else if (i != 0 && row2[i] == '0' && row1[i - 1] == '0')
                    {
                        row1[i] = 'X'; row2[i] = 'X'; row1[i - 1] = 'X';
                        answer++;
                    }
                    else if (i != n - 1 && row2[i] == '0' && row2[i + 1] == '0')
                    {
                        row1[i] = 'X'; row2[i] = 'X'; row2[i + 1] = 'X';
                        answer++;
                    }
                    else if (i != n - 1 && row2[i] == '0' && row1[i + 1] == '0')
                    {
                        row1[i] = 'X'; row2[i] = 'X'; row1[i + 1] = 'X';
                        answer++;
                    }
                }

            }
        }
        //**

        return Convert.ToString(answer);
    }

    static String   ReadString(string input)    { return input; }
    static String[] ReadStringArr(string input) { return input.Split(' '); }
    static int      ReadInt(string input)       { return int.Parse(input); }
    static long     ReadLong(string input)      { return long.Parse(input); }
    static double   ReadDouble(string input)    { return double.Parse(input); }
    static int[]    ReadIntArr(string input)    { return Array.ConvertAll(input.Split(' '), e =>    int.Parse(e)); }
    static long[]   ReadLongArr(string input)   { return Array.ConvertAll(input.Split(' '), e =>   long.Parse(e)); }
    static double[] ReadDoubleArr(string input) { return Array.ConvertAll(input.Split(' '), e => double.Parse(e)); }
}


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

namespace ConsoleApplication1
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;
        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Get();
            p.Out(x);
        }
        class Cut
        {
            public int a;
            public int b;
            public int line;
        }
        object Get()
        {
            checked
            {
                var a = ReadInts();
                var d = new[] { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
                var result = 0;
                for (int i = a[0]; i <= a[1]; i++)
                {
                    var s = i.ToString();
                    foreach (var c in s)
                        result += d[Int32.Parse(c.ToString())];
                }
                return result;
            }
        }

        object Get2()
        {
            FileName = "";
            checked
            {
                var m = ReadInt();
                var p = ReadLongs();
                var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();
                BigInteger divs = 1;
                long result = 1;
                foreach (var a in arr)
                {
                    var pi = a.Key;
                    var curr = pi;
                    var olddivs = divs;
                    var oldres = result;
                    for (int i = 0; i < a.Count; i++)
			        {
                        result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;
                        curr = curr*pi % commonMod;
                        divs = divs + olddivs;
			        }
                }
                return result;
            }
        }

        public long FastPow(long x, BigInteger pow, long mod)
        {
            if (pow == 0)
                return 1;
            if ((pow & 1) == 0)
                return FastPow(x * x % mod, pow / 2, mod);
            return x * FastPow(x, pow - 1, mod) % mod;
        }

        //object Get3()
        //{
        //    FileName = "";
        //    checked
        //    {
        //        var n = ReadInt();
        //        var hor = new List<Cut>();
        //        var ver = new List<Cut>();
        //        for (int i = 0; i < n; i++)
        //        {
        //            var a = ReadInts();
        //            if (a[0] == a[2])
        //                ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });
        //            else
        //                hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });
        //        }
        //        ver = Merge(ver);
        //        hor = Merge(hor);

        //    }
        //}

        List<Cut> Merge(List<Cut> l)
        {
            var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();
            Cut previous = null;
            var result = new List<Cut>();
            for (int i = 0; i < a.Length; i++)
                if (previous == null)
                    previous = a[i];
                else
                    if (previous.line == a[i].line && previous.b >= a[i].a)
                        previous.b = Math.Max(previous.b, a[i].b);
                    else
                    {
                        result.Add(previous);
                        previous = a[i];
                    }
            if (previous != null)
                result.Add(previous);
            return result;
        }

        object Get3()
        {
            FileName = "";
            checked
            {
                var n = ReadInt();
                var beacons = new List<Tuple<int, int>>();
                for (int i = 0; i < n; i++)
                {
                    var inp = ReadInts();
                    beacons.Add(Tuple.Create(inp[0], inp[1]));
                }
                beacons = beacons.OrderBy(x => x.Item1).ToList();
                var dp = new int[n];
                for (int i = 0; i < n; i++)
                {
                    var j = LowerBound(beacons, beacons[i].Item1 - beacons[i].Item2);
                    dp[i] = j == -1
                        ? 1
                        : dp[j] + 1;
                }
                return n - dp.Max();
            }
        }

        private int LowerBound(List<Tuple<int, int>> beacons, int v, int left, int right)
        {
            if (left == right)
                if (beacons[left].Item1 < v)
                    return left;
                else
                    return -1;
            if (right - left == 1)
                if (beacons[right].Item1 < v)
                    return right;
                else if (beacons[left].Item1 < v)
                    return left;
                else
                    return -1;
            var half = (left + right) / 2;
            if (v <= beacons[half].Item1)
                return LowerBound(beacons, v, left, half);
            else
                return LowerBound(beacons, v, half, right);
        }

        private int LowerBound(List<Tuple<int, int>> beacons, int v)
        {
            return LowerBound(beacons, v, 0, beacons.Count - 1);
        }

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

        IEnumerable<List<string>> GetS(List<string> ss)
        {
            if (ss.Count == 0)
                yield return (new List<string>());
            else
                foreach (var s in ss)
                {
                    var next = new List<string>(ss);
                    next.Remove(s);
                    foreach (var item in GetS(next))
                    {
                        item.Add(s);
                        yield return item;
                    }
                }
        }
    }
    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        protected string FileName { private get; set; }

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

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

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

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

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

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

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

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

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


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    private const int MAX = 200000;

    bool Intersect(int l1, int r1, int l2, int r2)
    {
        return !(r2 < l1 || l2 > r1);
    }

    public void Solve()
    {
        int n = ReadInt();

        var left = new int[MAX];
        var right = new int[MAX];
        int c = 1;
        for (int i = 1; i < MAX; i++)
        {
            left[i] = right[i] = c;
            if ((i & i - 1) == 0)
            {
                right[i]++;
                c++;
            }
            c++;
        }

        var idx = new Dictionary<int, int>();
        var q = Init<List<Tuple<int, int, int>>>(n);
        for (int m = ReadInt(); m > 0; m--)
        {
            if (ReadInt() == 1)
            {
                int t = ReadInt() - 1;
                int l = ReadInt();
                int r = ReadInt();
                int x = ReadInt();
                if (!idx.ContainsKey(x))
                    idx[x] = idx.Count;
                q[t].Add(Tuple.Create(l, r, idx[x]));
            }
            else
            {
                int t = ReadInt() - 1;
                int v = ReadInt();
                int l = v, r = v;
                var f = new bool[idx.Count];
                for (; t < n; t++, l = left[l], r = right[r])
                    foreach (var qq in q[t])
                        if (Intersect(qq.Item1, qq.Item2, l, r))
                            f[qq.Item3] = true;
                int ans = 0;
                for (int i = 0; i < idx.Count; i++)
                    if (f[i])
                        ans++;
                Write(ans);
            }
        }
    }

    #region Main

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

    #endregion

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


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

namespace vkcup
{
	class Program
	{
		public static int n, m, h, w;

		public static int x1, x2, y1, y2;

		public static int[] arr;
		private static String s1;
		private static String s2;
		static void Main(string[] args)
		{
			ParseAll(true);
			Solve();
		}

		static void Solve()
		{
			if ((x2 <= x1 && y2 <= y1) ||
				(y2 < y1 && x2 - x1 < y1) ||
				(x2 < x1 && y2 - y1 < x1))
			{
				Console.WriteLine("Vasiliy");
			}
			else
			{
				Console.WriteLine("Polycarp");
			}
			return;
		}

		static void ParseAll(bool console)
		{
			if (console)
			{
				ParseFirstLine(Console.ReadLine());
				//ParseArray(2);
			}
		}

		static void ParseFirstLine(String line)
		{
			int[] arr = line.Split(' ').Select(int.Parse).ToArray();
			x1 = arr[0];
			y1 = arr[1];
			x2 = arr[2];
			y2 = arr[3];
		}

		static void ParseSecondLine(String line)
		{
			int[] array = line.Split(' ').Select(int.Parse).ToArray();

		}

		static void ParseThirdLine(String line)
		{
			int[] array = line.Split(' ').Select(int.Parse).ToArray();

		}

		static void ParseArray(int count)
		{
			s1 = Console.ReadLine();
			s2 = Console.ReadLine();

		}

	}
}


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

namespace first
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c,aMod,bMod,cMod;
            string str = Console.ReadLine();
            a=int.Parse(str);
            str=str.Replace("0", "");
            aMod = int.Parse(str);
            str = Console.ReadLine();
            b = int.Parse(str);
            str=str.Replace("0", "");
            bMod = int.Parse(str);
            c = a + b;
            cMod = int.Parse(c.ToString().Replace("0", ""));
            if ((aMod + bMod) == cMod)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}


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

namespace Problem_1C
{
    struct Point
    {
        public double X, Y;

        public Point(double X, double Y)
        {
            this.X = X;
            this.Y = Y;
        }
    }

    struct Line
    {
        public bool IsVertical { get { return double.IsPositiveInfinity(slope); } }
        public double slope, yIntercept, xIntercept;

        public Line(Point a, Point b)
        {
            if (a.X == b.X)
            {
                this.slope = double.PositiveInfinity;
                this.yIntercept = double.NaN;
                this.xIntercept = a.X;
            }
            else
            {
                var rise = b.Y - a.Y;
                var run = b.X - a.X;

                this.slope = rise / run;
                this.yIntercept = b.Y - this.slope * b.X;
                this.xIntercept = Math.Abs(rise) < 0.00001 ? double.NaN : -(b.Y - this.slope * b.X) / (rise / run);
            }
        }

        public Line(double slope, double yIntercept, Point p)
        {
            this.slope = slope;
            this.yIntercept = yIntercept;
            this.xIntercept = double.IsPositiveInfinity(slope) ? p.X : -yIntercept / slope;
        }

        public Line PerpendicularLineAt(Point p)
        {
            if (IsVertical)
                return new Line(0, -p.Y, p);
            else if (Math.Abs(this.slope) < 0.00001)
                return new Line(double.PositiveInfinity, double.NaN, p);
            else
                return new Line(-1 / this.slope, p.Y + 1 / this.slope * p.X, p);
        }

        public Point IntersectionWith(Line l)
        {
            if (l.IsVertical)
                return new Point(l.xIntercept, this.slope * l.xIntercept + this.yIntercept);
            else if (this.IsVertical)
                return new Point(this.xIntercept, l.slope * this.xIntercept + l.yIntercept);
            else
            {
                double x = (l.yIntercept - this.yIntercept) / (this.slope - l.slope);
                return new Point(x, this.slope * x + this.yIntercept);
            }
        }
    }

    class Program
    {
        static Point GetPoint()
        {
            var line = Console.ReadLine().Split(' ');
            return new Point(double.Parse(line[0], System.Globalization.CultureInfo.InvariantCulture), double.Parse(line[1], System.Globalization.CultureInfo.InvariantCulture));
        }

        static Point Midpoint(Point a, Point b)
        {
            return new Point((b.X + a.X) / 2, (b.Y + a.Y) / 2);
        }

        static double Distance(Point a, Point b)
        {
            return Math.Sqrt(Math.Pow(b.X - a.X, 2) + Math.Pow(b.Y - a.Y, 2));
        }

        static void Main(string[] args)
        {
            var p1 = GetPoint();
            var p2 = GetPoint();
            var p3 = GetPoint();

            var l1 = new Line(p1, p2);
            var l2 = new Line(p2, p3);
            var l3 = new Line(p3, p1);

            var la = l1.IsVertical ? l2 : l1;
            var lb = l3.IsVertical ? l2 : l3;
            var ma = l1.IsVertical ? Midpoint(p2, p3) : Midpoint(p1, p2);
            var mb = l3.IsVertical ? Midpoint(p2, p3) : Midpoint(p3, p1);
            var pba = la.PerpendicularLineAt(ma);
            var pbb = lb.PerpendicularLineAt(mb);
            var o = pba.IntersectionWith(pbb);
            var r = Distance(o, p1);

            for (int i = 3; i <= 100; i++)
            {
                double theta = Math.Abs(p1.X - o.X) < 0.00001 ? Math.PI / 2 : Math.Atan((p1.Y - o.Y) / (p1.X - o.X));
                if (p1.X - o.X < 0) theta += Math.PI;
                double addTheta = 2 * Math.PI / i;
                bool p2Matched = false, p3Matched = false;
                for (int j = 1; j < i; j++)
                {
                    theta += addTheta;
                    double y = r * Math.Sin(theta) + o.Y;
                    double x = r * Math.Cos(theta) + o.X;
                    if (Math.Abs(p2.X - x) < 0.00001 && Math.Abs(p2.Y - y) < 0.00001) p2Matched = true;
                    if (Math.Abs(p3.X - x) < 0.00001 && Math.Abs(p3.Y - y) < 0.00001) p3Matched = true;
                }

                if (p2Matched && p3Matched)
                {
                    var area = i * r * r / 2 * Math.Sin(2 * Math.PI / i);
                    Console.WriteLine(area.ToString("0.000000", System.Globalization.CultureInfo.InvariantCulture));
                    break;
                }
            }

        }
    }
}


using System;
using System.Linq;

namespace Test
{
    class Program
    {
        static void Main()
        {
            byte[] input = Console.ReadLine().Split(' ').Select(num => Convert.ToByte(num)).ToArray();
            Console.WriteLine((int)(input[0] * input[1] / 2));
        }
    }
}


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

namespace codeforces
{
    class Program
    {

        static void Main(string[] args)
        {
            // Console.SetIn(new StreamReader("text.txt"));
            int[] count = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int x = count[0], y = count[1], z = count[2];
            string rez = "";
            if (x == y && z == 0)
                rez = "0";
            else if (x > y && y + z < x)
                rez = "+";
            else if (x < y && x+ z < y)
                rez = "-";
            else
                rez = "?";

            Console.WriteLine(rez);
        }
    }
}


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

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			//string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			var inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
			//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();

			long n = inputs1[0];
			long k = inputs1[1];

			if (k < 3)
			{
				Console.WriteLine(0);
				return;
			}

			long count = 0;
			long min = 0, max = 0;

			if (k <= n)
			{
				min = 1;
				max = k - min;
			}
			else
			{
				min = k - n;
				if (min > n)
				{
					Console.WriteLine(0);
					return;
				}

				max = n;
			}

			Console.WriteLine((Math.Max(min, max) - Math.Min(min, max) + 1) / 2);
		}

		public class Team
		{
			public string Name { get; set; }

			public int Points { get; set; }

			public int GoalsFor { get; set; }

			public int GoalsAgainst { get; set; }
		}

		static long Factorial(long a)
		{
			return a > 1 ? a * Factorial(a - 1) : 1;
		}
	}
}


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

namespace CodeforcesCs
{
    class Date18
    {
        public static void Main(string[] args)
        {
            string fDate = Console.ReadLine();
            string vDate = Console.ReadLine();

            int[] finalN = Array.ConvertAll<string, int>(fDate.Split('.'), int.Parse);
            int[] vasyaN = Array.ConvertAll<string, int>(vDate.Split('.'), int.Parse);

            DateTime finalReal = new DateTime(finalN[2] + 2000, finalN[1], finalN[0]);

            string[] perms = {"012", "021", "102", "120", "201", "210"};

            for (int i = 0; i < perms.Length; ++i )
            {
                int[] perm = new int[3];
                for (int j = 0; j < 3; ++j)
                    perm[j] = perms[i][j] - '0';

                int day = vasyaN[perm[0]], month = vasyaN[perm[1]], year = 2000 + vasyaN[perm[2]];
                DateTime date = DateTime.Now;
                bool wrong = false;
                try
                {
                    date = new DateTime(year, month, day);
                }
                catch
                {
                    wrong = true;
                }

                if (!wrong)
                {
                    DateTime lesserDate = GetNeedDay(finalReal);
                    if (lesserDate.Year >= 2000 && IsPositive(lesserDate.Subtract(date)))
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }
            }

            Console.WriteLine("NO");
        }

        private static bool IsPositive(TimeSpan timeSpan)
        {
            return timeSpan.Days >= 0 && timeSpan.Minutes >= 0;
        }

        private static DateTime GetNeedDay(DateTime finalReal)
        {
            if (finalReal.Month == 2 && finalReal.Day == 29)
                return new DateTime(finalReal.Year - 18, 2, 28);
            return new DateTime(finalReal.Year - 18, finalReal.Month, finalReal.Day);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Collections;

namespace Task
{

    #region MyIo

    internal class MyIo : IDisposable
    {
        private readonly TextReader inputStream;
        private readonly TextWriter outputStream = Console.Out;

        private string[] tokens;
        private int pointer;

        public MyIo()
#if  LOCAL_TEST
            : this(new StreamReader("input.txt"))
#else
            : this(System.Console.In)
#endif
        {

        }

        public MyIo(TextReader inputStream)
        {
            this.inputStream = inputStream;
        }

        public char NextChar()
        {
            try
            {
                return (char)inputStream.Read();
            }
            catch (IOException)
            {
                return '\0';
            }
        }

        public string NextLine()
        {
            try
            {
                return inputStream.ReadLine();
            }
            catch (IOException)
            {
                return null;
            }
        }

        public string NextString()
        {
            try
            {
                while (tokens == null || pointer >= tokens.Length)
                {
                    tokens = (NextLine() + string.Empty).Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    pointer = 0;
                }
                return tokens[pointer++];
            }
            catch (IOException)
            {
                return null;
            }
        }

        public int NextInt()
        {
            return Next<int>();
        }

        public long NextLong()
        {
            return Next<long>();
        }

        public T Next<T>()
        {
            var t = typeof(T);

            if (t == typeof(char))
                return (T)(object)NextChar();

            object s = NextString();

            if (t == typeof(string))
                return (T)s;

            return (T)Convert.ChangeType(s, typeof(T));
        }

        public IEnumerable<T> NextWhile<T>(Predicate<T> pred)
        {
            if (pred == null)
                yield break;

            T res = Next<T>();

            while (pred(res))
            {
                yield return res;

                res = Next<T>();
            }
        }

        public IEnumerable<T> NextSeq<T>(long n)
        {
            for (var i = 0; i < n; i++)
                yield return Next<T>();
        }

        public void Print(string format, params object[] args)
        {
            outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));
        }

        public void PrintLine(string format, params object[] args)
        {
            Print(format, args);

            outputStream.WriteLine();
        }

        public void Print(bool o)
        {
            Print(o ? "YES" : "NO");
        }

        public void PrintLine(bool o)
        {
            PrintLine(o ? "YES" : "NO");
        }

        public void Print<T>(T o)
        {
            outputStream.Write(Convert.ToString(o, CultureInfo.InvariantCulture));
        }

        public void PrintLine<T>(T o)
        {
            Print(o);

            outputStream.WriteLine();
        }

        public void Close()
        {
            inputStream.Close();
            outputStream.Close();
        }

        void IDisposable.Dispose()
        {
            Close();

#if  LOCAL_TEST
            Console.ReadLine();
#endif
        }
    }

    public static class ListExtensions
    {

        public static IEnumerable<T> ToCycleEnumerable<T>(this IEnumerable<T> self)
        {
            if (self != null)
            {
                for (; ; )
                {
                    foreach (var x in self)
                        yield return x;
                }
            }
        }

        public static T CycleGet<T>(this IList<T> self, int index)
        {
            var c = self.Count;
            return self[(index % c + c) % c];
        }

        public static IList<T> Shuffle<T>(this IList<T> self)
        {
            var rnd = new Random(DateTime.Now.Millisecond);

            var n = self.Count;

            while (n > 1)
            {
                n--;
                var k = rnd.Next(n + 1);
                var value = self[k];
                self[k] = self[n];
                self[n] = value;
            }

            return self;
        }

        public static IList<IList<T>> UseForNew2D<T>(this T def, int fd, int sd)
        {
            var fdim = new T[fd][];

            for (int i = 0; i < fd; i++)
            {
                fdim[i] = new T[sd];
                Fill(fdim[i], def);
            }

            return fdim;
        }

        public static IList<T> Fill<T>(this IList<T> self, Func<T> fval)
        {
            for (var i = 0; i < self.Count; i++)
                self[i] = fval();

            return self;
        }

        public static IList<T> Fill<T>(this IList<T> self, T val)
        {
            return self.Fill(() => val);
        }

        public static long Hash<T>(this IList<T> self, Func<T, long> val = null)
        {
            return val != null ? self.Hash((t, current) => unchecked(current * 19L + val(t))) : self.Hash(HashOne);
        }

        public static long Hash<T>(this IList<T> self, Func<T, long, long> val)
        {
            return self.Aggregate(0L, (current, t) => unchecked(val(t, current)));
        }

        public static long HashOne<T>(this T self, long current)
        {
            return unchecked(current * 19L + (Equals(self, default(T)) ? 0 : self.GetHashCode()));
        }

    }

    public static class P
    {
        public static P<T1, T2> Create<T1, T2>(T1 key, T2 val)
        {
            return new P<T1, T2>(key, val);
        }
    }

    public class P<T1, T2>
    {
        private class PComparer : IComparer<P<T1, T2>>
        {
            private readonly bool? byKey;

            public PComparer(bool? byKey)
            {
                this.byKey = byKey;
            }

            public int Compare(P<T1, T2> x, P<T1, T2> y)
            {
                x = x ?? new P<T1, T2>();
                y = y ?? new P<T1, T2>();

                if (byKey == true)
                    return Comparer<T1>.Default.Compare(x.Key, y.Key);
                else if (byKey == false)
                    return Comparer<T2>.Default.Compare(x.Value, y.Value);
                else
                {
                    var tr = Comparer<T1>.Default.Compare(x.Key, y.Key);

                    if (tr != 0)
                        tr = Comparer<T2>.Default.Compare(x.Value, y.Value);

                    return tr;
                }
            }
        }

        public P()
        {
        }

        public P(T1 key, T2 val)
        {
            this.Key = key;
            this.Value = val;
        }

        public T1 Key
        {
            get;
            set;
        }

        public T2 Value
        {
            get;
            set;
        }

        public P<T1, T2> Clone()
        {
            return new P<T1, T2>(Key, Value);
        }

        public static IComparer<P<T1, T2>> KeyComparer
        {
            get { return new PComparer(true); }
        }

        public static IComparer<P<T1, T2>> ValueComparer
        {
            get { return new PComparer(false); }
        }

        public static implicit operator T1(P<T1, T2> obj)
        {
            return obj.Key;
        }

        public static implicit operator T2(P<T1, T2> obj)
        {
            return obj.Value;
        }

        public P<T1, T2> SetKey(T1 key)
        {
            Key = key;
            return this;
        }

        public P<T1, T2> SetValue(T2 value)
        {
            Value = value;
            return this;
        }

        public override string ToString()
        {
            return string.Format("Key: {0}, Value: {1}", Key, Value);
        }

        public override int GetHashCode()
        {
            int hash = 17;
            hash = hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode());
            hash = hash * 31 + ((Equals(Value, default(T1))) ? 0 : Key.GetHashCode());
            return hash;

        }
    }

    #endregion

    internal class Program
    {
        #region Program

        private readonly MyIo io;

        public Program(MyIo io)
        {
            this.io = io;
        }

        public static void Main(string[] args)
        {
            using (MyIo io = new MyIo())
            {
                new Program(io)
                    .Solve();
            }
        }

        #endregion
        public const long MOD = 1000000007;
        public const double EPS = 1e-14;

        private void Solve()
        {
            var a = io.NextLine();
            var b = io.NextLine();

            var n = (long)a.Length;

            var k = io.NextInt();

            var ak = 0L;
            var ak0 = 1L;
            var sprd = 1L;

            for (var i = 1; i <= k; ++i)
            {
                ak0 = (sprd - ak0) % MOD;
                ak = (sprd - ak) % MOD;

                sprd = ((n - 1L) * (sprd % MOD));
            }

            var res = (a == b) ? ak0 : 0;

            for (var i = 1; i < n; i++)
            {
                if (a.Substring(i) + a.Substring(0, i) == b)
                    res = (res + ak) % MOD;
            }

            io.PrintLine(res);
        }
    }

}


using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]);
        int K = int.Parse(str[1]);
        str = Console.ReadLine().Split(' ');
        int[] A = new int[K];
        for(int i=0;i<K;i++){
            A[i] = int.Parse(str[i]);
        }
        int f = 0;
        int tw = 0;
        int o = 0;
        int th = 0;
        for(int i=0;i<K;i++){
            f += A[i]/4;
            if(A[i] % 4 == 2){
                tw++;
            }
            if(A[i] % 4 == 3){
                th++;
            }
            if(A[i] % 4 == 1){
                o++;
            }
        }
        bool b;
        int F = N;
        int T = 2*N;
        int O = 0;
        for(int i=0;i<f;i++){
            if(F <= 0){
                T -= 2;
            }
            else{
                F--;
            }
        }
        for(int i=0;i<th;i++){
            if(F <= 0){
                T -= 2;
            }
            else{
                F--;
            }
        }
        for(int i=0;i<o;i++){
            if(F <= 0){
                T--;
            }
            else{
                F--;
                T++;
            }
        }
        for(int i=0;i<tw;i++){
            if(F <= 0 && T <= 0){
                O -=2;
            }
            else if(T <= 0){
                F--;
                O++;
            }
            else{
                T--;
            }
        }
        b = F >= 0 && T >= 0 && O >= 0;
        if(b){
            sb.Append("YES\n");
        }
        else{
            sb.Append("NO\n");
        }
    }
}


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

namespace codeforces
{
	class Program
	{
		public const int Osn = 1000000007;

		public class Pair
		{
			public long First;

			public long Second;
		}

		public class PairComparer : IComparer<Pair>
		{
			public int Compare(Pair x, Pair y)
			{
				if (x.First < y.First || (x.First == y.First && x.Second > y.Second))
					return -1;
				return 1;
			}
		}

		public static long GetGcd(long a, long b)
		{
			while (true)
			{
				if (b == 0)
					return a;
				var a1 = a;
				a = b;
				b = a1 % b;

			}
		}

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

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

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

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

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

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

		public class Vertex
		{
			public int Was;

			public List<int> Edges;
		}

		public static List<Vertex> Graph = new List<Vertex>();

		public static bool Dfs(int u)
		{
			if (Graph[u].Was == 1) return true;
			if (Graph[u].Was == 2) return false;
			Graph[u].Was = 1;
			foreach (var t in Graph[u].Edges)
			{
				if (Dfs(t)) return true;
			}

			Graph[u].Was = 2;
			return false;
		}

		public static bool IsPrime(int x)
		{
			for (var j = 2; j * j <= x; ++j)
				if (x % j == 0)
					return false;
			return true;
		}

		public class LinkedVertex
		{
			public int Next;

			public int Prev;

			public int Value;
		}

		public static int BinarySearch(List<int> list, int value)
		{
			var l = -1;
			var r = list.Count;
			while (r - l > 1)
			{
				var m = (r + l) / 2;
				if (list[m] >= value)
					r = m;
				else
					l = m;
			}

			return r;
		}

		private static void Main()
		{
			var l = ReadListOfLongs();
			var a = l[0];
			var b = l[1];
			long ans = (a * (a + 1) / 2) % Osn;
			ans = (ans * b + a) % Osn;
			ans = (((b * (b - 1) / 2) % Osn) * ans) % Osn;
			Console.WriteLine(ans);
			Console.ReadLine();
		}
	}
}


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

namespace CodeForces
{
    class Program
    {

        static void Main(string[] args)
        {
            long[] v = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            long max = v.Max();
            long min = v.Min();
            Console.WriteLine(max - (max - min)+" "+ ((max - min) / 2));

        }
    }
}


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

namespace cfgr14
{
    class Program
    {
        static void Main(string[] args)
        {
           Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_cfgr14E();
            Console.Out.Flush();
        }

        public static long[] fact = new long [405];
        public static long[] inv = new long [405];
        public static long[,] choose = new long [405, 405];
        public static long[] pow2 = new long [405];
        public static long n;
        public static long mod;
        /*
        Editorial:

        */
        public static void solve_cfgr14E()
        {
            long[] nm = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            n = nm[0];
            mod = nm[1];
            precompute();
            long[,] dp = new long[405, 405];
            dp[0, 0] = 1;
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    for (int k = 1; i + k <= n; k++)
                    {
                        dp[i + k + 1, j + k] += (dp[i, j] * pow2[k - 1]) % mod * choose[j + k, k];
                        dp[i + k + 1, j + k] %= mod;
                    }
                }
            }

            long ans = 0;
            for (int i = 0; i <= n; i++)
            {
                ans = (ans + dp[n + 1, i]) % mod;
            }
            Console.WriteLine(ans);
        }

        public static void precompute()
        {
            fact[0] = 1;
            inv[0] = 1;
            for (int i = 1; i <= n; i++)
            {
                fact[i] = (fact[i - 1] * i) % mod;
                inv[i] = binExp(fact[i], mod - 2);
            }

            for (int i = 0; i <= n; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    choose[i, j] = ((fact[i] * inv[j]) % mod * inv[i - j]) % mod;
                }
            }

            for (int i = 0; i <= n; i++)
            {
                pow2[i] = binExp(2, i);
            }
        }

        public static long binExp(long a, long exp)
        {
            if (exp == 0)
            {
                return 1;
            }
            long tmp = binExp(a, exp / 2);
            tmp = (tmp * tmp) % mod;
            if (exp % 2 == 1)
            {
                tmp *= a;
            }
            return tmp % mod;
        }

        public static void solve_cfgr14C()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            while(t-- > 0)
            {
                int[] nmx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                int n = nmx[0];
                int m = nmx[1];
                int x = nmx[2];
                int[] h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                Array.Sort(h);
                int[] cnt = new int[m];
                for (int i = 0; i < n; i++)
                {
                    cnt[i % m] += h[i];
                }
                int min = int.MaxValue;
                int max = int.MinValue;
                bool ok = true;
                for (int i = 0; i < m; i++)
                {
                    min = Math.Min(min, cnt[i]);
                    max = Math.Max(max, cnt[i]);
                    if (max - min > x)
                    {
                        ok = false;
                        break;
                    }
                }
                if (ok)
                {
                    Console.WriteLine("YES");
                    for (int i = 0; i < n; i++)
                    {
                        Console.Write("{0} ", (i % m) + 1);
                    }
                }
                else
                {
                    Console.Write("NO");
                }
                Console.WriteLine();
            }
        }

        public static void solve_cfgr14B()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            while(t-- > 0)
            {
                int n = Convert.ToInt32(Console.ReadLine());
                bool ok = false;
                if (n > 1 && (n & (n - 1)) == 0)
                {
                    ok = true;
                }
                else
                {
                    for (int i = 2; i * i <= 1000000000; i++)
                    {
                        if (i % 2 != 0)
                        {
                            if (n % (i * i) == 0)
                            {
                                int r = n / (i * i);
                                if (r > 1 && (r & (r - 1)) == 0)
                                {
                                    ok = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                Console.WriteLine(ok ? "YES" : "NO");
            }

        }

        public static void solve_cfgr14A()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            while(t-- > 0)
            {
                int[] nx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                int n = nx[0];
                int x = nx[1];
                int[] w = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                Array.Sort(w, (a, b) => b.CompareTo(a));
                int sum = 0;
                int posToChange = -1;
                for (int i = 0; i < n; i++)
                {
                    sum += w[i];
                    if (sum == x)
                    {
                        posToChange = i;
                    }
                }
                if (sum != x)
                {
                    Console.WriteLine("YES");
                    for (int i = 0; i < n; i++)
                    {
                        if (i == posToChange)
                        {
                            if (i + 1 < n)
                            {
                                int tmp = w[i];
                                w[i] = w[i + 1];
                                w[i + 1] = tmp;
                            }
                        }
                        Console.Write("{0} ", w[i]);
                    }
                }
                else
                {
                    Console.Write("NO");
                }
                Console.WriteLine();

            }
        }
    }
}


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

namespace ProgrammingContest.Codeforces.SchoolTeam2
{
    class H
    {
        public static void Main()
        {
            string s = Console.ReadLine();
            int n = s.Length;
            long[,] dp = new long[n, 10];

            long res = 0;
            bool self = false;
            for (int u = 0; u < 10; u++)
            {
                for (int i = 0; i < n; i++)
                    for (int j = 0; j < 10; j++)
                        dp[i, j] = 0;
                dp[0, u] = 1;
                for (int i = 1; i < n; i++)
                {
                    int x = s[i] - '0';
                    for (int j = 0; j < 10; j++)
                    {
                        int y = j + x;
                        for (int k = 0; k <= y % 2; k++)
                            dp[i, y / 2 + k] += dp[i - 1, j];
                    }
                }
                for (int i = 0; i < 10; i++) res += dp[n - 1, i];

                bool b = true;
                for (int i = 0; i < n; i++) b &= dp[i, s[i] - '0'] > 0;
                self |= b;
            }

            Console.WriteLine(res - (self ? 1 : 0));
        }
    }
}


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

namespace ConsoleApplication11 {
    class Program {
        static char[] inputSeparators = new char[] { ' ' };
        static int[] ballInStock = new int[3];
        static int[] ballsNeeded = new int[3];
        static int[] deficitArray = new int[3];

        static void Main(string[] args) {
            List<int> input1 = GetInputList_int(inputSeparators);
            ballInStock[0] = input1[0];
            ballInStock[1] = input1[1];
            ballInStock[2] = input1[2];

            List<int> input2 = GetInputList_int(inputSeparators);
            ballsNeeded[0] = input2[0];
            ballsNeeded[1] = input2[1];
            ballsNeeded[2] = input2[2];

            for (int i = 0; i < 3; i++) {
                deficitArray[i] = ballsNeeded[i] - ballInStock[i];
            }

            //Environment.Exit(0);

            for (int i = 0; i < deficitArray.Length; i++) {
                if (deficitArray[i] > 0) {
                    FillDeficit(i);
                }
            }
            Console.WriteLine("Yes");
        }

        static void FillDeficit(int deficitIndex) {
            while (deficitArray[deficitIndex] > 0) {
                bool transformationIsPossible = false;
                for (int i = 0; i < deficitArray.Length; i++) {
                    if (i != deficitIndex) { // other magic balls
                        if (deficitArray[i] <= -2) { // if we can
                            transformationIsPossible = true;
                            deficitArray[i] += 2;
                            deficitArray[deficitIndex] -= 1;
                            break;
                        }
                    }
                }
                if (!transformationIsPossible) {
                    Console.WriteLine("No");
                    Environment.Exit(0);
                }
            }
        }

        static List<int> GetInputList_int(char[] separator) {
            string inputLine1 = Console.ReadLine();
            List<string> inputList1 = inputLine1.Split(' ').ToList();
            List<int> inputList1_int = new List<int>();
            inputList1.ForEach(i => {
                int i_int = int.Parse(i);
                inputList1_int.Add(i_int);
            });
            return inputList1_int;
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args) ? "YES" : "NO");
            writer.Flush();
        }

        private static bool Solve(string[] args)
        {
            int x1 = Next(), y1 = Next(), x2 = Next(), y2 = Next();
            int x3 = Next(), y3 = Next(), x4 = Next(), y4 = Next();
            int x5 = Next(), y5 = Next(), x6 = Next(), y6 = Next();

            x3 = Math.Min(x4, Math.Max(x3, x1));
            y3 = Math.Min(y4, Math.Max(y3, y1));

            x5 = Math.Min(x6, Math.Max(x5, x1));
            y5 = Math.Min(y6, Math.Max(y5, y1));

            x4 = Math.Max(x3, Math.Min(x4, x2));
            y4 = Math.Max(y3, Math.Min(y4, y2));

            x6 = Math.Max(x5, Math.Min(x6, x2));
            y6 = Math.Max(y5, Math.Min(y6, y2));

            long s = (long) (x2 - x1)*(y2 - y1);
            long s1 = (long) (x4 - x3)*(y4 - y3);
            long s2 = (long) (x6 - x5)*(y6 - y5);

            if (s > s1 + s2)
                return true;

            x3 = Math.Min(x4, Math.Max(x3, x5));
            y3 = Math.Min(y4, Math.Max(y3, y5));
            x4 = Math.Max(x3, Math.Min(x4, x6));
            y4 = Math.Max(y3, Math.Min(y4, y6));

            long s12 = (long) (x4 - x3)*(y4 - y3);

            return s > s1 + s2 - s12;
        }

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


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solution
{
    string Sort(int[] a)
    {
        int n = a.Length;
        var b = new int[n];
        var log = new List<int>();

        void MergeSort(int l, int r)
        {
            if (r - l <= 1)
                return;
            int m = (l + r) / 2;
            MergeSort(l, m);
            MergeSort(m, r);
            Write(l, r, m);
            int i = l;
            int j = m;
            int k = l;
            while (i < m && j < r)
            {
                if (a[i] < a[j])
                {
                    log.Add(0);
                    b[k] = a[i];
                    i++;
                }
                else
                {
                    log.Add(1);
                    b[k] = a[j];
                    j++;
                }
                k++;
            }
            while (i < m)
            {
                b[k] = a[i];
                i++;
                k++;
            }
            while (j < r)
            {
                b[k] = a[j];
                j++;
                k++;
            }
            for (int p = l; p < r; p++)
                a[p] = b[p];
        }

        MergeSort(0, n);
        return string.Concat(log);
    }

    int p;
    string log;
    int[] a, b;
    void Fun(int l, int r)
    {
        if (r - l <= 1)
            return;
        int m = (l + r) / 2;
        Fun(l, m);
        Fun(m, r);
        int i = l;
        int j = m;
        int k = l;
        while (i < m && j < r)
        {
            if (log[p++] == '0')
            {
                b[k] = a[i];
                i++;
            }
            else
            {
                b[k] = a[j];
                j++;
            }
            k++;
        }
        while (i < m)
        {
            b[k] = a[i];
            i++;
            k++;
        }
        while (j < r)
        {
            b[k] = a[j];
            j++;
            k++;
        }
        for (int p = l; p < r; p++)
            a[p] = b[p];
    }

    public void Solve()
    {
        log = ReadToken();
        int n = 16;
        a = Enumerable.Range(0, n).ToArray();
        b = new int[n];
        Fun(0, n);

        var ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[a[i]] = i + 1;
        Write(n);
        WriteArray(ans);
    }

    #region Main

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

    #endregion

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


using System;
using System.Linq;
using CompLib.Util;

public class Program
{
    int N;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();

        /*
         * クイーン
         *
         * たて、よこ、ななめ
         * 駒があったら取る
         *
         * n*nチェス盤
         *
         * (1,1)に白
         * (1,n)に黒
         * それ以外全部緑
         *
         * 白先手
         *
         * 必ず駒を取る
         *
         * 駒を取られる or 駒を取れない 負け
         *
         * 勝つほう
         */

        /*
         * 2 w 1 2
         * 3 b
         * 4 w 1 2
         */

        if (N % 2 == 0)
        {
            Console.WriteLine("white");
            Console.WriteLine("1 2");
        }
        else
        {
            Console.WriteLine("black");
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

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;
using System.IO;
using System.Text;

namespace Kavi_on_Pairing_Duty
{
    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)
        {
            const int mod = 998244353;

            int n = Next();

            var p = new int[n + 1];
            var s = new long[n + 1];
            s[1] = 1;
            long sum = 2;

            for (int i = 2; i < p.Length; i++)
            {
                for (int j = i + i; j < p.Length; j += i)
                {
                    p[j]++;
                }

                s[i] = (1 + sum + p[i])%mod;
                sum += s[i];
                sum %= mod;
            }
            writer.WriteLine(s[n]);
            writer.Flush();
        }

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