using System;
using System.Collections.Generic;

namespace AprilFoolsDayContest2021
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = int.Parse(Console.ReadLine());

            Console.WriteLine((2 - i*i));
        }

        static void CMain(string[] args)
        {
            string word = Console.ReadLine();

            for (int i = 1; i < word.Length - 1; i++)
            {
                if (((word[i - 1] - 65) + (word[i] - 65)) % 26 != (word[i + 1] - 65))
                {
                    Console.WriteLine("NO");
                    return;
                }
            }

            Console.WriteLine("YES");
        }

        static void XMain(string[] args)
        {
            int num = int.Parse(Console.ReadLine());

            double root = Math.Sqrt(num);
            int _root = (int)root;
            int proot = _root - 1;
            int nroot = _root + 1;

            if (root - proot > nroot - root)
            {
                if (root - _root > nroot - root)
                {
                    Console.WriteLine(nroot);
                } else
                {
                    Console.WriteLine(_root);
                }
            } else
            {
                if (root - _root > root - proot)
                {
                    Console.WriteLine(proot);
                }
                else
                {
                    Console.WriteLine(_root);
                }
            }
        }

        static void AMain(string[] args)
        {
            while (Console.In.Peek() != -1)
            {
                string test = Console.ReadLine();
                if (test.ToLower().Equals("Is it rated?".ToLower()))
                {
                    Console.WriteLine("No");
                } else
                {
                    Console.WriteLine("No");
                }
                Console.Out.Flush();
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using static util;
using P = pair<int, int>;

class Program {
    static void Main(string[] args) {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        var solver = new Solver(sw);
        // var t = new Thread(solver.solve, 1 << 28); // 256 MB
        // t.Start();
        // t.Join();
        solver.solve();
        sw.Flush();
    }
}

class Solver {
    StreamWriter sw;
    Scan sc;
    void Prt(string a) => sw.WriteLine(a);
    void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a));
    void Prt(params object[] a) => Prt(string.Join(" ", a));
    public Solver(StreamWriter sw) {
        this.sw = sw;
        this.sc = new Scan();
    }

    public void solve() {
        string[] s = {"1","12","14","145", "15", "124", "1245",
                        "125", "24", "245", "13", "123", "134",
                        "1345", "135", "1234", "12345", "1235", "234", "2345",
                        "136", "1236", "2456", "1346", "13456", "1356"};

        var t = new string[26];
        for (int i = 0; i < 26; i++)
        {
            var cnt = new int[5];
            foreach (var item in s[i])
            {
                int c = item - '1';
                ++cnt[c % 3];
                ++cnt[3 + c / 3];
            }
            t[i] = string.Join(' ', cnt);
        }
        int n = sc.Int;
        for (int i = 0; i < n; i++)
        {
            var p = sc.Str;
            for (int j = 0; j < 26; j++)
            {
                if (p == t[j]) {
                    sw.Write((char)('a' + j));
                    break;
                }
            }
        }
        Prt();

    }
}

class pair<T, U> : IComparable<pair<T, U>> {
    public T v1;
    public U v2;
    public pair() : this(default(T), default(U)) {}
    public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }
    public int CompareTo(pair<T, U> a) {
        int c = Comparer<T>.Default.Compare(v1, a.v1);
        return c != 0 ? c : Comparer<U>.Default.Compare(v2, a.v2);
    }
    public override string ToString() => $"{v1} {v2}";
    public void Deconstruct(out T a, out U b) { a = v1; b = v2; }
}
static class util {
    public static readonly int M = 1000000007;
    // public static readonly int M = 998244353;
    public static readonly long LM = 1L << 60;
    public static readonly double eps = 1e-11;
    public static void DBG(string a) => Console.Error.WriteLine(a);
    public static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a));
    public static void DBG(params object[] a) => DBG(string.Join(" ", a));
    public static void Assert(params bool[] conds) {
        if (conds.Any(x => !x)) throw new Exception();
    }
    public static pair<T, U> make_pair<T, U>(T v1, U v2) => new pair<T, U>(v1, v2);
    public static int CompareList<T>(IList<T> a, IList<T> b) where T : IComparable<T> {
        for (int i = 0; i < a.Count && i < b.Count; i++)
            if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);
        return a.Count.CompareTo(b.Count);
    }
    public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;
    public static readonly int[] dd = { 0, 1, 0, -1 };
    // static readonly string dstring = "RDLU";
    public static IEnumerable<P> adjacents(int i, int j) {
        for (int k = 0; k < 4; k++) yield return new P(i + dd[k], j + dd[k ^ 1]);
    }
    public static IEnumerable<P> adjacents(int i, int j, int h, int w) {
        for (int k = 0; k < 4; k++) if (inside(i + dd[k], j + dd[k ^ 1], h, w))
            yield return new P(i + dd[k], j + dd[k ^ 1]);
    }
    public static IEnumerable<P> adjacents(this P p) => adjacents(p.v1, p.v2);
    public static IEnumerable<P> adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, w);
    public static IEnumerable<int> all_subset(this int p) {
        for (int i = 0; ; i = i - p & p) {
            yield return i;
            if (i == p) break;
        }
    }
    public static Dictionary<T, int> compress<T>(this IEnumerable<T> a)
        => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);
    public static Dictionary<T, int> compress<T>(params IEnumerable<T>[] a)
        => compress(a.SelectMany(x => x));
    public static T[] inv<T>(this Dictionary<T, int> dic) {
        var res = new T[dic.Count];
        foreach (var item in dic) res[item.Value] = item.Key;
        return res;
    }
    public static void swap<T>(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }
    public static void swap<T>(this IList<T> a, int i, int j) where T : struct {
        var t = a[i]; a[i] = a[j]; a[j] = t;
    }
    public static T[] copy<T>(this IList<T> a) {
        var ret = new T[a.Count];
        for (int i = 0; i < a.Count; i++) ret[i] = a[i];
        return ret;
    }
}

class Scan {
    StreamReader sr;
    public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }
    public Scan(string path) { sr = new StreamReader(path); }
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public string Str => ReadLine.Trim();
    public string ReadLine => sr.ReadLine();
    public pair<T, U> Pair<T, U>() {
        T a; U b;
        Multi(out a, out b);
        return new pair<T, U>(a, b);
    }
    public P P => Pair<int, int>();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();
    public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
                       : eq<T, long>()   ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>()   ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    public void Multi<T>(out T a) => a = cv<T>(Str);
    public void Multi<T, U>(out T a, out U b) {
        var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]);
    }
    public void Multi<T, U, V>(out T a, out U b, out V c) {
        var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
    }
    public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d) {
        var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]);
    }
    public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
        var ar = StrArr;
        a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]);
    }
    public void Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
        var ar = StrArr;
        a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        d = cv<W>(ar[3]); e = cv<X>(ar[4]); f = cv<Y>(ar[5]);
    }
}


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    long[] fact = new long[19];
    private int[] a;

    void Fun(int x, int lim, int k, long s, SDictionary<long, int>[] dicts)
    {
        if (s < 0)
            return;
        if (x == lim)
        {
            dicts[k][s]++;
            return;
        }

        if (a[x] < 19 && k > 0)
            Fun(x + 1, lim, k - 1, s - fact[a[x]], dicts);
        Fun(x + 1, lim, k, s - a[x], dicts);
        Fun(x + 1, lim, k, s, dicts);
    }

    public void Solve()
    {
        fact[0] = 1;
        for (int i = 1; i < 19; i++)
            fact[i] = fact[i - 1] * i;

        int n = ReadInt();
        int k = ReadInt();
        long s = ReadLong();
        a = ReadIntArray();

        var d1 = Enumerable.Repeat(0, k + 1).Select(x => new SDictionary<long, int>()).ToArray();
        Fun(0, n / 2, k, s, d1);
        var d2 = Enumerable.Repeat(0, k + 1).Select(x => new SDictionary<long, int>()).ToArray();
        Fun(n / 2, n, k, s, d2);

        long ans = 0;
        for (int i = 0; i <= k; i++)
            foreach (var p in d1[i])
                for (int j = k - i; j <= k; j++)
                    ans += p.Value * d2[j][s - p.Key];

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("cycle.in");
        //writer = new StreamWriter("cycle.out");
#endif
        try
        {
            //            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //            thread.Start();
            //            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            Console.WriteLine(ex);
            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);
    }

    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; }
        }
    }

    #endregion
}


using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Net.Sockets;
using System.Xml;
using System.Diagnostics;
using System.Linq;
using System.Threading;

static class Program
{
    #region IO
    public delegate ReadDelegate<T> ReadDelegate<T>(out T value);
    public delegate bool ParserDelegate<T>(string word, out T item);

    public class Input : IDisposable
    {
        private static EventArgs DefaultEventArgs = new EventArgs();

        public TextReader TextReader { get; private set; }

        public event EventHandler OnEndOfStream;
        public event EventHandler OnParseError;
        public event EventHandler OnReadError;

        public bool CanRead { get; private set; }
        public bool ThrowExceptions { get; set; }

        string line = string.Empty;
        int pos = 0;

        static EventHandler emptyHandler;

        public Input(string path)
            : this(File.OpenRead(path))
        {
        }
        public Input(Stream s)
            : this(new StreamReader(s))
        {

        }
        public Input(TextReader tr)
        {
            TextReader = tr;

            if (emptyHandler == null)
                emptyHandler = (a, b) => { };

            OnEndOfStream = emptyHandler;
            OnParseError = emptyHandler;
            OnReadError = emptyHandler;

            CanRead = true;
        }

        public static implicit operator Input(Stream s)
        {
            return new Input(s);
        }
        public static implicit operator Input(TextReader tr)
        {
            return new Input(tr);
        }

        private bool ReadStream()
        {
            if (!CanRead) return false;
            if (pos < line.Length) return true;

            Clear();

            string s = TextReader.ReadLine();
            if (s == null)
            {
                CanRead = false;
                return false;
            }

            line = s;
            return true;
        }

        public ReadDelegate<T> r<T>(out T value)
        {
            value = ReadData<T>();
            return r;
        }

        public void SkipChar()
        {
            if (pos < line.Length) pos++;
            else
            {
                ReadStream();
            }
        }
        public void SkipChars(int length)
        {
            while (length > 0)
            {
                int dt = line.Length - pos;
                if (dt <= 0)
                {
                    length--;
                    if (!ReadStream()) return;
                }
                dt = Math.Min(length, dt);
                pos += dt;
                length -= dt;
            }
        }

        public void SkipWhiteSpace()
        {
            while (true)
            {
                for (; pos < line.Length; pos++)
                {
                    if (!char.IsWhiteSpace(line[pos])) return;
                }
                if (!ReadStream())
                {
                    OnEndOfStream(this, DefaultEventArgs);
                    return;
                }
            }
        }
        public bool CanReadData()
        {
            SkipWhiteSpace();
            return CanRead;
        }

        public T[] ReadArray<T>()
        {
            int length = ReadInt32();
            return ReadArray<T>(length);
        }
        public T[] ReadArray<T>(int length)
        {
            ParserDelegate<T> parser = Parser.GetPrimitiveParser<T>();
            return ReadArray<T>(length, parser);
        }
        public T[] ReadArray<T>(ParserDelegate<T> parser)
        {
            int length = ReadInt32();
            return ReadArray<T>(length, parser);
        }
        public T[] ReadArray<T>(int length, ParserDelegate<T> parser)
        {
            T[] res = new T[length];
            for (int i = 0; i < length; i++)
            {
                res[i] = ReadData<T>(parser);
            }
            return res;
        }

        public Decimal ReadDecimal()
        {
            return ReadData<Decimal>(Parser.DecimalParser);
        }
        public Double ReadDouble()
        {
            return ReadData<Double>(Parser.DoubleParser);
        }
        public Single ReadSingle()
        {
            return ReadData<Single>(Parser.SingleParser);
        }
        public UInt64 ReadUInt64()
        {
            return ReadData<UInt64>(UInt64.TryParse);
        }
        public UInt32 ReadUInt32()
        {
            return ReadData<UInt32>(UInt32.TryParse);
        }
        public UInt16 ReadUInt16()
        {
            return ReadData<UInt16>(UInt16.TryParse);
        }
        public Int64 ReadInt64()
        {
            return ReadData<Int64>(Int64.TryParse);
        }
        public Int32 ReadInt32()
        {
            return ReadData<Int32>(Int32.TryParse);
        }
        public Int16 ReadInt16()
        {
            return ReadData<Int16>(Int16.TryParse);
        }
        public Boolean ReadYesNo()
        {
            return ReadData<Boolean>(Parser.YesNoParser);
        }
        public Boolean ReadBoolean()
        {
            return ReadData<Boolean>(Boolean.TryParse);
        }
        public Byte ReadByte()
        {
            return ReadData<Byte>(Byte.TryParse);
        }

        private bool ReadCheck()
        {
            if (!CanRead)
            {
                OnReadError(this, DefaultEventArgs);
                if (ThrowExceptions)
                {
                    throw new Exception("!CanRead");
                }
                return false;
            }
            return true;
        }
        public T ReadData<T>()
        {
            return ReadData<T>(true);
        }
        public T ReadData<T>(bool skipWhiteSpace)
        {
            ParserDelegate<T> parser = Parser.GetPrimitiveParser<T>();
            return ReadData<T>(parser, skipWhiteSpace);
        }
        public T ReadData<T>(ParserDelegate<T> parser)
        {
            return ReadData<T>(parser, true);
        }
        public T ReadData<T>(ParserDelegate<T> parser, bool skipWhiteSpace)
        {
            if (skipWhiteSpace)
                SkipWhiteSpace();

            if (!ReadCheck()) return default(T);

            string s = ReadWord(false);

            T res;
            if (!parser.Invoke(s, out res))
            {
                OnParseError(this, DefaultEventArgs);
                if (ThrowExceptions)
                {
                    throw new Exception("!validate, word = " + Output.ToString(s, 256));
                }
            }
            return res;
        }

        public string ReadWord()
        {
            return ReadWord(true);
        }
        public string ReadWord(bool skipWhiteSpace)
        {
            if (skipWhiteSpace)
                SkipWhiteSpace();

            if (!ReadCheck()) return string.Empty;

            int from = pos;
            int to = pos;
            for (int i = pos; i < line.Length; i++)
            {
                if (char.IsWhiteSpace(line[i])) break;
                to = i + 1;
            }
            pos = to;

            return line.Substring(from, to - from);
        }

        public string ReadLine()
        {
            if (!ReadCheck()) return string.Empty;

            ReadStream();
            string res = line.Substring(pos);
            pos = line.Length;

            return res;
        }

        public void Close()
        {
            TextReader.Close();
        }
        public void Clear()
        {
            pos = 0;
            line = string.Empty;
        }

        private bool disposed = false;
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    line = string.Empty;
                    TextReader.Dispose();
                }
                disposed = true;
            }
        }
        ~Input()
        {
            Dispose(false);
        }
    }
    public class Output : IDisposable
    {
        static char[] space = new char[] { ' ' };

        public TextWriter TextWriter { get; private set; }
        public bool AutoFlush { get; set; }

        public static string ToString(object obj, int maxLength)
        {
            return ToString(FormatReal(obj), maxLength);
        }
        public static string ToString(string s, int maxLength)
        {
            if (s.Length <= maxLength) return s;
            else return s.Substring(0, maxLength) + "...";
        }
        public static object FormatReal(object v, string format)
        {
            if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');
            if (v is double) return ((double)v).ToString(format).Replace(',', '.');
            if (v is float) return ((float)v).ToString(format).Replace(',', '.');

            return v;
        }
        public static object FormatReal(object v)
        {
            if (v is decimal || v is double || v is float)
            {
                return v.ToString().Replace(',', '.');
            }
            return v;
        }

        public Output()
            : this(new MemoryStream())
        {
        }
        public Output(string path)
            : this(File.Create(path))
        {

        }
        public Output(Stream s)
            : this(new StreamWriter(s))
        {
        }
        public Output(TextWriter tw)
        {
            TextWriter = tw;
        }

        public static implicit operator Output(Stream s)
        {
            return new Output(s);
        }

        public static implicit operator Output(TextWriter tw)
        {
            return new Output(tw);
        }

        public static Output operator +(Output output, object obj)
        {
            output.Write(obj);
            return output;
        }
        public Output WriteArray<T>(params T[] array)
        {
            return WriteArray<T>(array, false);
        }
        public Output WriteArray<T>(T[] array, bool appendLength)
        {
            return WriteArray<T>(array, 0, array.Length, appendLength);
        }
        public Output WriteArray<T>(T[] array, int index, int count)
        {
            return WriteArray<T>(array, index, count, false);
        }
        public Output WriteArray<T>(T[] array, int index, int count, bool appendLength)
        {
            if (index + count > array.Length)
            {
                string message = string.Format(
                    "Index out of range: {0} + {1} >= {2}",
                    index,
                    count,
                    array.Length);
                throw new Exception(message);
            }
            if (appendLength)
            {
                WriteLine(count);
            }
            for (int i = 0; i < count; i++)
            {
                Write(array[i + index]);
                Write(space, 0, space.Length);
            }
            WriteLine();

            return this;
        }
        public Output WriteLine(object obj)
        {
            obj = FormatReal(obj);
            return WriteLine(obj.ToString());
        }
        public Output WriteLine(string format, params object[] args)
        {
            return WriteLine(string.Format(format, args));
        }
        public Output WriteLine(string s)
        {
            return WriteLine(s.ToCharArray());
        }
        public Output WriteLine(char[] buffer)
        {
            return WriteLine(buffer, 0, buffer.Length);
        }
        public Output WriteLine(char[] buffer, int index, int count)
        {
            TextWriter.WriteLine(buffer, index, count);
            if (AutoFlush) TextWriter.Flush();
            return this;
        }
        public Output WriteLine()
        {
            TextWriter.WriteLine();
            if (AutoFlush) TextWriter.Flush();
            return this;
        }
        public Output Write(object obj)
        {
            obj = FormatReal(obj);
            return Write(obj.ToString());
        }
        public Output Write(string format, params object[] args)
        {
            return Write(string.Format(format, args));
        }
        public Output Write(string s)
        {
            return Write(s.ToCharArray());
        }
        public Output Write(char[] buffer)
        {
            return Write(buffer, 0, buffer.Length);
        }
        public Output Write(char[] buffer, int index, int count)
        {
            TextWriter.Write(buffer, index, count);
            if (AutoFlush) TextWriter.Flush();
            return this;
        }

        public void Close()
        {
            TextWriter.Close();
        }
        public void Flush()
        {
            TextWriter.Flush();
        }

        private bool disposed = false;
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    TextWriter.Dispose();
                }
                disposed = true;
            }
        }
        ~Output()
        {
            Dispose(false);
        }
    }
    public static class Parser
    {
        public static ParserDelegate<T> GetPrimitiveParser<T>()
        {
            if (!typeof(T).IsPrimitive) throw new Exception("Unknown type");
            else if (default(T) is Byte) return new ParserDelegate<Byte>(Byte.TryParse) as ParserDelegate<T>;
            else if (default(T) is Boolean) return new ParserDelegate<Boolean>(Boolean.TryParse) as ParserDelegate<T>;
            else if (default(T) is Int16) return new ParserDelegate<Int16>(Int16.TryParse) as ParserDelegate<T>;
            else if (default(T) is Int32) return new ParserDelegate<Int32>(Int32.TryParse) as ParserDelegate<T>;
            else if (default(T) is Int64) return new ParserDelegate<Int64>(Int64.TryParse) as ParserDelegate<T>;
            else if (default(T) is UInt16) return new ParserDelegate<UInt16>(UInt16.TryParse) as ParserDelegate<T>;
            else if (default(T) is UInt32) return new ParserDelegate<UInt32>(UInt32.TryParse) as ParserDelegate<T>;
            else if (default(T) is UInt64) return new ParserDelegate<UInt64>(UInt64.TryParse) as ParserDelegate<T>;
            else if (default(T) is Single) return new ParserDelegate<Single>(Parser.SingleParser) as ParserDelegate<T>;
            else if (default(T) is Double) return new ParserDelegate<Double>(Parser.DoubleParser) as ParserDelegate<T>;
            else if (default(T) is Decimal) return new ParserDelegate<Decimal>(Parser.DecimalParser) as ParserDelegate<T>;
            else if (default(T) is String) return new ParserDelegate<String>(Parser.StringParser) as ParserDelegate<T>;
            else throw new Exception("Unknown type");
        }
        public static bool YesNoParser(string s, out Boolean result)
        {
            s = s.ToLower();
            if (s == "yes") result = true;
            else if (s == "no") result = false;
            else
            {
                result = false;
                return false;
            }
            return true;
        }
        public static bool ReplaceDot;
        public static bool StringParser(string s, out string result)
        {
            result = s;
            return string.IsNullOrEmpty(s);
        }
        private static string fs(string s)
        {
            if (ReplaceDot) return s.Replace(',', '.');
            else return s;
        }
        public static bool DecimalParser(string s, out Decimal result)
        {
            return Decimal.TryParse(fs(s), out result);
        }
        public static bool DoubleParser(string s, out Double result)
        {
            return Double.TryParse(fs(s), out result);
        }
        public static bool SingleParser(string s, out Single result)
        {
            return Single.TryParse(fs(s), out result);
        }
    }
    #endregion
    #region Streams
    static string endl = Environment.NewLine;
    static Input cin = new Input(Console.In);
    static Output cout = new Output(Console.Out);
    static Output cerr = new Output(Console.Error);
    static StringBuilder sb = new StringBuilder();
    #endregion
    #region Time
    //*
    static Stopwatch sw = new Stopwatch();
    static void Start()
    {
        sw.Reset();
        sw.Start();
    }
    static void Restart(string text = "")
    {
        Stop(text);
        Start();
    }
    static void Time(string text = "")
    {
        if (string.IsNullOrEmpty(text))
        {
            cerr.WriteLine(sw.Elapsed);
        }
        else
        {
            cerr.WriteLine(text + ": " + sw.Elapsed);
        }
    }
    static void Stop(string text = "")
    {
        sw.Stop();
        Time(text);
    }
    //*/
    #endregion

    static void InitIO(string name)
    {
#if DEBUG
#else
        cin = new Input(name + ".in");
        cout = new Output(name + ".out");
        Parser.ReplaceDot = false;
#endif
    }

    static long[] fact =
    {
        1, 1, 2, 6, 24,
        120, 720, 5040, 40320, 362880,
        3628800, 39916800, 479001600, 6227020800, 87178291200,
        1307674368000, 20922789888000, 355687428096000, 6402373705728000, 121645100408832000
    };

    static Dictionary<long, long>[] dm;
    static void Build(int[] a, int p, int k, int mk, long s)
    {
        if (p == a.Length)
        {
            for (var t = mk - k; t <= mk; t++)
            {
                if (!dm[t].ContainsKey(s))
                {
                    dm[t][s] = 0;
                }
                dm[t][s]++;
            }
            return;
        }

        var x = a[p];
        if(x < 19 && k > 0)
        {
            Build(a, p + 1, k - 1, mk, s + fact[x]);
        }
        Build(a, p + 1, k, mk, s + x);
        Build(a, p + 1, k, mk, s);
    }
    static long Search(int[] a, int p, int to, int k, long s)
    {
        if (s < 0) return 0;
        if(p == to)
        {
            long r;
            dm[k].TryGetValue(s, out r);
            return r;
        }

        long res = 0;
        if(a[p] < 19 && k > 0)
        {
            res += Search(a, p + 1, to, k - 1, s - fact[a[p]]);
        }
        res += Search(a, p + 1, to, k, s);
        res += Search(a, p + 1, to, k, s - a[p]);

        return res;
    }

    static void Main()
    {
        var n = cin.ReadInt32();
        var k = cin.ReadInt32();
        var s = cin.ReadInt64();

        var a = cin.ReadArray<int>(n);

        dm = new Dictionary<long, long>[k + 1];
        for(var i = 0; i <= k; i++)
        {
            dm[i] = new Dictionary<long, long>();
        }

        var p = n - n / 2;
        Build(a, p, k, k, 0);

        var ans = Search(a, 0, p, k, s);
        cout += ans + endl;
    }
}


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

namespace Codeforces
{
    internal class Program
    {
        private const string Test = "C2";

        private static void Solve()
        {
            var s = Read();
            var t = Read();
            var n = s.Length;
            var m = t.Length;
            long res = 0L;
            int MOD = 1000000007;
            var dp = new int[n + 1, m + 1];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    dp[i + 1, j + 1] = dp[i + 1, j];
                    if (s[i] == t[j])
                        dp[i + 1, j + 1] += dp[i, j] + 1;
                    dp[i + 1, j + 1] %= MOD;
                }
            }
            for (int i = 0; i < n + 1; i++)
            {
                res += dp[i, m];
                res %= MOD;
            }
            Console.WriteLine(res);
        }

        private static void Main()
        {
            if (Debugger.IsAttached)
            {
                Console.SetIn(new StreamReader(String.Format(@"..\..\..\..\Tests\{0}.in", Test)));
            }

            Solve();

            if (Debugger.IsAttached)
            {
                Console.In.Close();
                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                Console.ReadLine();
            }
        }

        #region Reader

        private static string Read()
        {
            return Console.ReadLine();
        }

        private static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static List<int> ReadIntArray()
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();
            return input;
        }

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

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

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        #endregion
    }
}


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

namespace Codeforces
{
    class E
    {
        private static ThreadStart  s_threadStart = new E().Go;

        class Point
        {
            public int X, Y;
            public bool Keep;
        }

        long[] F;

        private void Go()
        {
            long mod = 1000000007;

            int n = GetInt();
            Point[] points = new Point[n];
            for (int i = 0; i < n; i++)
            {
                points[i] = new Point() { X = GetInt(), Y = GetInt() };
            }

            F = new long[2*n + 1];
            F[0] = 1;
            for (int i = 1; i <= 2 * n; i++)
                F[i] = (F[i - 1] * i) % mod;

            Dictionary<int, List<int>> xDict = new Dictionary<int, List<int>>();
            Dictionary<int, List<int>> yDict = new Dictionary<int, List<int>>();
            for(int i = 0; i < n; i++)
            {
                List<int> list;
                if (!xDict.TryGetValue(points[i].X, out list))
                    list = xDict[points[i].X] = new List<int>();

                list.Add(i);

                if (!yDict.TryGetValue(points[i].Y, out list))
                    list = yDict[points[i].Y] = new List<int>();

                list.Add(i);
            }

            long ans = 1;

            Queue<int> queue = new Queue<int>();
            while (xDict.Count > 0)
            {
                int k = 0;
                int m = 0;
                var pair = xDict.First();
                queue.Enqueue(pair.Value[0]);

                HashSet<int> xDir = new HashSet<int>();
                HashSet<int> yDir = new HashSet<int>();
                HashSet<int> pSet = new HashSet<int>();

                while (queue.Count > 0)
                {
                    int pp = queue.Dequeue();
                    Point point = points[pp];
                    pSet.Add(pp);
                    xDir.Add(point.X);
                    yDir.Add(point.Y);
                    if (xDict.ContainsKey(point.X))
                    {
                        foreach (int z in xDict[point.X])
                            if (z != pp)
                                queue.Enqueue(z);
                    }
                    if (yDict.ContainsKey(point.Y))
                    {
                        foreach (int z in yDict[point.Y])
                            if (z != pp)
                                queue.Enqueue(z);
                    }
                    xDict.Remove(point.X);
                    yDict.Remove(point.Y);
                }

                ans *= Bin(xDir.Count() + yDir.Count(), pSet.Count(), mod);
                ans %= mod;
            }

            Wl(ans);
        }

        long Bin(long n, long k, long mod)
        {
            if (n < k)
                k = n;

            long ans = 0;
            for (int i = 0; i <= k; i++)
            {
                long add = F[n];
                add *= Inv(F[i], mod);
                add %= mod;
                add *= Inv(F[n - i], mod);
                add %= mod;
                ans += add;
                ans %= mod;
            }
            return ans;
        }

        public static long Pow(long a, long n, long mod)
        {
            long res = 1L;
            while (n > 0)
            {
                if ((n & 1) != 0)
                    res = (res * a) % mod;
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long Inv(long a, long mod)
        {
            return Pow(a, mod - 2, mod);
        }

        #region Template

        private static StringBuilder output = new StringBuilder();

        public static void Main(string[] args)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            output.Length = 0;
            Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);
            timer.Start();
            main.Start();
            main.Join();
            Console.Write(output);
            timer.Stop();
            Console.Error.WriteLine(timer.ElapsedMilliseconds);
        }

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

            return ioEnum.Current;
        }

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

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

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

        private static List<int> GetIntArr(int n)
        {
            List<int> ret = new List<int>(n);
            for (int i = 0; i < n; i++)
            {
                ret.Add(GetInt());
            }
            return ret;
        }

        private static void Wl<T>(T o)
        {
            W(o);
            output.Append(Console.Out.NewLine);
        }

        private static void Wl<T>(IEnumerable<T> enumerable)
        {
            W(enumerable);
            output.Append(Console.Out.NewLine);
        }

        private static void W<T>(T o)
        {
            if (o is double)
            {
                Wd((o as double?).Value, "");
            }
            else if (o is float)
            {
                Wd((o as float?).Value, "");
            }
            else
                output.Append(o.ToString());
        }

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

        private static void Wd(double d, string format)
        {
            W(d.ToString(format, CultureInfo.InvariantCulture));
        }

        #endregion
    }
}


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

namespace The_Wall__medium_
{
    internal class Program
    {
        private const int mod = 1000003;
        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 long[] fact;
        private static long[] fact1;

        private static void Main(string[] args)
        {
            int n = Next();
            int c = Next();

            InitFact(n + c + 1);
            long ans = (GetCFact(n + c, c) - 1 + mod)%mod;

            writer.WriteLine(ans);
            writer.Flush();
        }

        private static void InitFact(int n)
        {
            fact = new long[n];
            fact1 = new long[n];

            fact[0] = 1;

            for (int i = 1; i < fact.Length; i++)
            {
                fact[i] = (fact[i - 1]*i)%mod;
            }
            fact1[n - 1] = Pow(fact[n - 1], mod - 2);
            for (int i = fact1.Length - 2; i >= 0; i--)
            {
                fact1[i] = (fact1[i + 1]*(i + 1))%mod;
            }
        }

        private static long Pow(long a, int k)
        {
            long r = 1;
            while (k > 0)
            {
                if ((k & 1) == 1)
                {
                    r = (r*a)%mod;
                }
                a = (a*a)%mod;
                k >>= 1;
            }
            return r;
        }

        private static long GetCFact(int n, int k)
        {
            return (((fact[n]*fact1[k])%mod)*fact1[n - k])%mod;
        }

        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 Solver
{
    const int MOD = 1000003;

    long[] f, rf, inv;
    void InitFacts(int size)
    {
        f = new long[size + 1];
        rf = new long[size + 1];
        inv = new long[size + 1];
        f[0] = f[1] = rf[0] = rf[1] = inv[1] = 1;
        for (int i = 2; i <= size; i++)
        {
            f[i] = f[i - 1] * i % MOD;
            inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
            rf[i] = inv[i] * rf[i - 1] % MOD;
        }
    }

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

        InitFacts(n + m + 1);

        long ans = 0;
        for (int i = 1; i <= n; i++)
            ans += f[i + m - 1] * rf[m - 1] % MOD * rf[i] % MOD;

        Write(ans % MOD);
    }

    #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(),Encoding.ASCII);
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
#if DEBUG
            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.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 bool Equals(object obj)
        {
            var co = obj as P<T1, T2>;

            return co != null && co.GetHashCode() == GetHashCode();
        }

        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 : Value.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 n = io.NextInt();
            var m = io.NextInt();

            var x = io.NextInt();
            var y = io.NextInt();
            x = Math.Abs(x - io.NextInt());
            y = Math.Abs(y - io.NextInt());

            var res = (x > 4 || y > 4) || (x + y > 6);

            io.PrintLine(res ? "Second" : "First");
        }
    }

}


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

namespace AlgoTraining.Codeforces.C_s
{
    public class FastScanner : StreamReader
    {
        private string[] _line;
        private int _iterator;

        public FastScanner(Stream stream) : base(stream)
        {
            _line = null;
            _iterator = 0;
        }
        public string NextToken()
        {
            if (_line == null || _iterator >= _line.Length)
            {
                _line = base.ReadLine().Split(' ');
                _iterator = 0;
            }
            if (_line.Count() == 0) throw new IndexOutOfRangeException("Input string is empty");
            return _line[_iterator++];
        }
        public int NextInt()
        {
            return Convert.ToInt32(NextToken());
        }
        public long NextLong()
        {
            return Convert.ToInt64(NextToken());
        }
        public float NextFloat()
        {
            return float.Parse(NextToken());
        }
        public double NextDouble()
        {
            return Convert.ToDouble(NextToken());
        }
    }
    class PlayingWithSuperglueCroc
    {
        public static void Main(string[] args)
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                int n = fs.NextInt(), m = fs.NextInt();
                int x1 = fs.NextInt(), y1 = fs.NextInt();
                int x2 = fs.NextInt(), y2 = fs.NextInt();
                int w = Math.Abs(x1 - x2) + 1, h = Math.Abs(y1 - y2) + 1;
                if ((w == 5 && h == 5) || (w >= 6 || h >= 6) || (w == 4 && h == 5) || (w == 5 && h == 4)) writer.WriteLine("Second");
                else writer.WriteLine("First");
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
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 SC = Scanner;

public partial class Solver
{
    int N, X;
    string S;
    public void Solve()
    {
        sc.Make(out N, out X);
        S = sc.Str;
        if (X <= 1) Fail(ToInt32(S.Length==1&&S[0] - '0' == X));
        //dp[k][i][j]:=F(k)の部分列に含まれるS[j,i)の数の和
        var cur = Create(N + 1, () => new ModInt[N + 1]);
        var nxt = Create(N + 1, () => new ModInt[N + 1]);
        for (int i = 0; i < N; i++)
        {
            cur[i][i] = nxt[i][i] = 1;
            if (S[i] - '0' == 0) nxt[i + 1][i] = 1;
            else cur[i + 1][i] = 1;
        }
        //端はとっても取らなくてもいいので2
        cur[0][0] = cur[N][N] = nxt[0][0] = nxt[N][N] = 2;
        for (int i = 0; i < X - 1; i++)
        {
            nxt = matmul(nxt, cur);
            swap(ref cur, ref nxt);
        }
        Console.WriteLine(cur[N][0]);
    }

    ModInt[][] matpow(ModInt[][] A, long k)
    {
        var res = Create(A.Length, () => new ModInt[A.Length]);
        for (int i = 0; i < A.Length; i++) res[i][i] = 1;
        while (k != 0)
        {
            if (k % 2 == 1) res = matmul(res, A);
            k >>= 1;
            A = matmul(A, A);
        }
        return res;
    }
    ModInt[][] matmul(ModInt[][] A, ModInt[][] B)
    {
        var rt = Create(A.Length, () => new ModInt[B[0].Length]);
        for (int i = 0; i < A.Length; i++)
            for (int j = 0; j < B[0].Length; j++)
            {
                for (int k = 0; k < B.Length; k++)
                    rt[i][j] += A[i][k] * B[k][j];
            }
        return rt;
    }
    ModInt[] matdot(ModInt[][] A, ModInt[] B)
    {
        var rt = new ModInt[A.Length];
        for (int i = 0; i < A.Length; i++)
        {
            ModInt now = 0;
            for (int j = 0; j < B.Length; j++)
            {
                now += A[i][j] * B[j];
            }
            rt[i] = now;
        }
        return rt;
    }
}

public struct ModInt
{
    public const long MOD = (int)1e9 + 7;
    //public const long MOD = 998244353;
    public long Value { get; set; }
    public ModInt(long n = 0) { Value = n; }
    private static ModInt[] fac, inv, facinv;
    public override string ToString() => Value.ToString();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt l, ModInt r)
    {
        l.Value += r.Value;
        if (l.Value >= MOD) l.Value -= MOD;
        return l;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt l, ModInt r)
    {
        l.Value -= r.Value;
        if (l.Value < 0) l.Value += MOD;
        return l;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator long(ModInt l) => l.Value;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator ModInt(long n)
    {
        n %= MOD; if (n < 0) n += MOD;
        return new ModInt(n);
    }

    public static ModInt Pow(ModInt m, long n)
    {
        if (n == 0) return 1;
        if (n % 2 == 0) return Pow(m * m, n >> 1);
        else return Pow(m * m, n >> 1) * m;
    }

    public static void Build(int n)
    {
        fac = new ModInt[n + 1];
        facinv = new ModInt[n + 1];
        inv = new ModInt[n + 1];
        inv[1] = fac[0] = fac[1] = facinv[0] = facinv[1] = 1;
        for (var i = 2; i <= n; i++)
        {
            fac[i] = fac[i - 1] * i;
            inv[i] = MOD - inv[MOD % i] * (MOD / i);
            facinv[i] = facinv[i - 1] * inv[i];
        }
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt Fac(int n) => fac[n];
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt Inv(int n) => inv[n];
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt FacInv(int n) => facinv[n];
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt Comb(int n, int r)
    {
        if (n < r) return 0;
        if (n == r) return 1;
        return fac[n] * facinv[r] * facinv[n - r];
    }
    public static ModInt Perm(int n, int r)
    {
        if (n < r) return 0;
        return fac[n] * facinv[n - r];
    }

}
#region Template
public partial class Solver
{
    public SC sc = new SC();
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var sol = new Solver();
        int testcase = 1;
        //testcase = sol.sc.Int;
        //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();
        while (testcase-- > 0)
            sol.Solve();
        Console.Out.Flush();
    }
}
public static class Template
{
    [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 void Out<T>(this IList<T> A, out T a) => a = A[0];
    public static void Out<T>(this IList<T> A, out T a, out T b) { a = A[0]; b = A[1]; }
    public static void Out<T>(this IList<T> A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }
    public static void Out<T>(this IList<T> A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }
    public static string Concat<T>(this IEnumerable<T> A, string sp) => string.Join(sp, A);
    public static char ToChar(this int s, char begin = '0') => (char)(s + begin);
    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 string ToStr<T>(this T[][] A) => A.Select(a => a.Concat(" ")).Concat("\n");
    public static int ArgMax<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 void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    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); }
}

#endregion


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

public class Solution
{
    int mod;

    long Fun(int n)
    {
        var dp = new long[n + 1];
        dp[1] = 1;
        long sum = 1;
        var pdp = new long[n + 1];
        for (int i = 1; i <= n; i++)
        {
            pdp[i] = (pdp[i] + pdp[i - 1]) % mod;
            dp[i] = (sum + pdp[i]) % mod;

            for (int j = i * 2, k = 2; j <= n; j += i, k++)
            {
                pdp[j] = (pdp[j] + dp[i]) % mod;
                if (j + k <= n)
                    pdp[j + k] = (pdp[j + k] + mod - dp[i]) % mod;
            }

            if (i > 1)
                sum = (sum + dp[i]) % mod;
        }
        return dp[n];
    }

    public void Solve()
    {
        int n = ReadInt();
        mod = ReadInt();
        Write(Fun(n));
    }

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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    const int MOD = 1000000007;

    long[] f, rf, inv;
    void InitFacts(int size)
    {
        f = new long[size + 1];
        rf = new long[size + 1];
        inv = new long[size + 1];
        f[0] = f[1] = rf[0] = rf[1] = inv[1] = 1;
        for (int i = 2; i <= size; i++)
        {
            f[i] = f[i - 1] * i % MOD;
            inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
            rf[i] = inv[i] * rf[i - 1] % MOD;
        }
    }

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

        InitFacts(n);
        var ps = new long[n];
        for (int i = m + 1; i < n; i++)
        {
            long v = f[i - 1] * (i - m + ps[i - 1] - ps[i - m - 1] + MOD) % MOD;
            ps[i] = (ps[i - 1] + v * rf[i]) % MOD;
        }

        Write(ps[n - 1] * f[n - 1] % MOD);
    }

    #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("stations.in");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
#if DEBUG
            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.IO;
using System.Text;

namespace Ability_To_Convert
{
    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)
        {
            int n = int.Parse(reader.ReadLine());
            string s = reader.ReadLine();

            long prev = 0;
            long ans = 0;
            long pow = 1;
            long bpow = 1;
            int lastback0 = s.Length - 1;
            for (int i = s.Length - 1; i >= 0; i--)
            {
                long next = prev + pow*(s[i] - '0');
                if (next >= n || pow > n)
                {
                    ans = ans + bpow*prev;
                    bpow *= n;
                    pow = 10;
                    while (i + 1 < lastback0 && s[i + 1] == '0')
                    {
                        i++;
                    }
                    lastback0 = Math.Min(i, lastback0);
                    prev = s[i] - '0';
                }
                else
                {
                    prev = next;
                    pow *= 10;
                }
            }
            ans = ans + bpow*prev;

            writer.WriteLine(ans);
            writer.Flush();
        }
    }
}


using System;
using System.Globalization;

public class Class4
{
    public static void Main()
    {
        Solve(new ConsoleInput());
    }

    private static void Solve(IInput input)
    {
        // HAI
        // I HAS A TUX
        // GIMMEH TUX
        // I HAS A FOO ITS 0
        // I HAS A BAR ITS 0
        // I HAS A BAZ ITS 0
        // I HAS A QUZ ITS 1
        // TUX IS NOW A NUMBR
        var tux = int.Parse(input.ReadLine());
        var foo = 0;
        var bar = 0;
        var baz = 0;
        var quz = 0;

        // IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0
        for (; tux > 0; tux--)
        {
            // I HAS A PUR
            // GIMMEH PUR
            // PUR IS NOW A NUMBR
            var pur = int.Parse(input.ReadLine());

            // FOO R SUM OF FOO AN PUR
            foo += pur;

            // BAR R SUM OF BAR AN 1
            bar += 1;

            // BOTH SAEM ( BIGGR OF ( (PRODUKT OF FOO AN QUZ) AN (PRODUKT OF BAR BAZ)) AN PRODUKT OF FOO AN QUZ) )
            // O RLY?
            if (Math.Max(foo * quz, bar * baz) == (foo * quz))
            {
                // YA RLY
                // BAZ R FOO
                // QUZ R BAR
                baz = foo;
                quz = bar;

                // OIC
            }

            // IM OUTTA YR LOOP
        }

        // BAZ IS NOW A NUMBAR
        // VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ
        Console.WriteLine(((float)baz / quz).ToString("F6", CultureInfo.InvariantCulture));

        // KTHXBYE
    }
}

#region input
public interface IInput
{
    string ReadLine();
}

public class ConsoleInput : IInput
{
    public string ReadLine()
    {
        return Console.ReadLine();
    }
}

public abstract class AbstractMockInput : IInput
{
    protected virtual string[] lines { get; }

    private int currentLine = 0;

    public string ReadLine()
    {
        if (this.currentLine >= this.lines.Length)
        {
            return string.Empty;
        }

        var res = this.lines[this.currentLine];
        this.currentLine++;
        return res;
    }
}

public class MockInput1 : AbstractMockInput
{
    protected override string[] lines => new[] { "3", "0", "1", "1" };
}

#endregion


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using CompLib.Util;

public class Program
{
    private int N;
    private List<(int to, int num)>[] E;
    private int[] U, V;
    private int Max;

    private int R;
    private bool[] IsX;
    private bool Found;
    private int XSize;

    private int[] Len;
    private int[] Dist;
    private int TmpX;
    private int TmpY;

    void Scan()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        E = new List<(int to, int num)>[N];
        U = new int[N - 1];
        V = new int[N - 1];
        for (int i = 0; i < N; i++)
        {
            E[i] = new List<(int to, int num)>();
        }

        for (int i = 0; i < N - 1; i++)
        {
            int u = sc.NextInt() - 1;
            int v = sc.NextInt() - 1;
            U[i] = u + 1;
            V[i] = v + 1;
            E[u].Add((v, i));
            E[v].Add((u, i));
        }

        Max = 2 * N * N / 9;
    }

    void SetFlag(int cur, int par)
    {
        foreach ((int to, int num) e in E[cur])
        {
            if (e.to == par) continue;
            SetFlag(e.to, cur);
        }

        IsX[cur] = true;
    }

    int Go(int cur, int par)
    {
        var ls = new List<(int to, int size)>();
        int size = 1;
        foreach (var e in E[cur])
        {
            if (e.to == par) continue;
            int tmp = Go(e.to, cur);
            ls.Add((e.to, tmp));
            size += tmp;
        }

        if (par != -1)
        {
            ls.Add((par, N - size));
        }

        if (!Found)
        {
            bool[,] dp = new bool[ls.Count + 1, N];
            dp[0, 0] = true;
            for (int i = 0; i < ls.Count; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (dp[i, j])
                    {
                        dp[i + 1, j] = true;
                        dp[i + 1, j + ls[i].size] = true;
                    }
                }
            }

            int x = -1;
            for (int i = 0; i < N; i++)
            {
                if (!dp[ls.Count, i]) continue;
                int y = N - 1 - i;
                if (Max < (i + 1) * (y + 1))
                {
                    x = i;
                    break;
                }
            }

            if (x != -1)
            {
                XSize = x;
                R = cur;
                for (int i = ls.Count - 1; i >= 0; i--)
                {
                    if (x - ls[i].size >= 0 && dp[i, x - ls[i].size])
                    {
                        SetFlag(ls[i].to, cur);
                        x -= ls[i].size;
                    }
                }

                Found = true;
            }
        }

        return size;
    }

    // r、x,yの頂点を決める
    void SearchR()
    {
        IsX = new bool[N];
        Found = false;
        Go(0, -1);
        if (!Found) throw new Exception();
    }

    // 現在地、親、par-curが辺num
    void SetX(int cur, int par, int num)
    {
        Dist[cur] = TmpX++;
        if (par != -1)
        {
            Len[num] = Dist[cur] - Dist[par];
        }

        foreach ((int to, int num) e in E[cur])
        {
            if (e.to == par) continue;
            if (!IsX[e.to]) continue;
            SetX(e.to, cur, e.num);
        }
    }

    void SetY(int cur, int par, int num)
    {
        Dist[cur] = TmpY;
        TmpY += (XSize + 1);
        if (par != -1)
        {
            Len[num] = Dist[cur] - Dist[par];
        }

        foreach ((int to, int num) e in E[cur])
        {
            if (e.to == par) continue;
            if (IsX[e.to]) continue;
            SetY(e.to, cur, e.num);
        }
    }

    void SetLen()
    {
        // 辺の長さ
        Len = new int[N - 1];
        // R->頂点までの距離
        Dist = new int[N];
        // X側の頂点はRに近い順に距離1~Xを割り当てる
        // それぞれの頂点までの距離になるように頂点の長さを割り当てる
        TmpX = 0;
        SetX(R, -1, -1);

        // Y (X+1)刻みで割り当てる
        TmpY = 0;
        SetY(R, -1, -1);
    }

    void Write()
    {
        var sb = new StringBuilder();
        for (int i = 0; i < N - 1; i++)
        {
            sb.AppendLine($"{U[i]} {V[i]} {Len[i]}");
        }

        Console.Write(sb);
    }

    public void Solve()
    {
        // ある頂点rを境目に2つに分ける
        // 片方x個 もう片方 y個 x + y + 1 = N
        // 片方でrからの距離 0~xをつくる
        // 残り x+1刻みで y個
        // 0 <= p < (x+1)(y+1)できる

        Scan();
        SearchR();
        SetLen();
        Write();
    }

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

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

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

#if DEBUG
			TextReader reader = new StreamReader("../../input.txt");

#else
			TextReader reader = Console.In;
#endif

			#region INIT
			int[] c1 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
			int[] c2 = reader.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

			int x1 = c1[0];
			int y1 = c1[1];
			int r1 = c1[2];
			int R1 = c1[3];

			int x2 = c2[0];
			int y2 = c2[1];
			int r2 = c2[2];
			int R2 = c2[3];
			#endregion

			int count = 0;

			if (AreCircleWithBallOk(x1, y1, r1, x2, y2, r2, R2)) count++;
			if (AreCircleWithBallOk(x1, y1, R1, x2, y2, r2, R2)) count++;
			if (AreCircleWithBallOk(x2, y2, r2, x1, y1, r1, R1)) count++;
			if (AreCircleWithBallOk(x2, y2, R2, x1, y1, r1, R1)) count++;

			Console.WriteLine(count);

#if DEBUG
			Console.ReadKey();
#endif

		}

		static bool AreCircleWithBallOk(int x1, int y1, int rd1, int x2, int y2, int rd2, int Rd2) {

			bool res1 = !(AreBallsIntercect(x1, y1, rd1, x2, y2, rd2) ||
						  AreBallsIntercect(x1, y1, rd1, x2, y2, Rd2));

			if (!res1) return false;

			double centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));

			double t1 = centersDist + rd2;
			double t2 = rd1;
			double t3 = centersDist + Rd2;
			if (t1 <= t2 && t2 < t3) return false;

			t1 = centersDist - Rd2;
			t2 = -rd1;
			t3 = centersDist - rd2;
			if (t1 <= t2 && t2 < t3) return false;

			return true;

		}

		static bool AreBallsIntercect(int x1, int y1, int rd1, int x2, int y2, int rd2) {

			double centersDist = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));

			double l1 = -rd1;
			double r1 = rd1;

			double l2 = centersDist - rd2;
			double r2 = centersDist + rd2;

			if (r1 <= l2)  return false;
			if (l1 <= l2 && r1 >= r2) return false;
			if (l2 <= l1 && r2 >= r1) return false;

			return true;

		}

	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Text;
using System.Diagnostics;
using static util;
using P = pair<int, int>;

class Program {
    static void Main(string[] args) {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        var solver = new Solver(sw);
        // var t = new Thread(solver.solve, 1 << 26); // 64 MB
        // t.Start();
        // t.Join();
        solver.solve();
        sw.Flush();
    }
}

class Solver {
    StreamWriter sw;
    Scan sc;
    void Prt(string a) => sw.WriteLine(a);
    void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a));
    void Prt(params object[] a) => Prt(string.Join(" ", a));
    public Solver(StreamWriter sw) {
        this.sw = sw;
        this.sc = new Scan();
    }

    public void solve() {
        int n = sc.Int;
        if (n == 1) {
            Prt(1);
            return;
        }
        int m = 1;
        while (m <= n) m *= 2;
        int c = 0;
        for (int i = m / 2; i < m; ++i)
        {
            int bc = bitcnt(i);
            int next = -1;
            int p = i;
            while (p > 0) {
                if (p % 2 == 0) {
                    next = p / 2;
                    break;
                }
                p >>= 1;
            }
            if (next != -1 && bc % 2 != bitcnt(next) % 2) {
                ++c;
            }
        }
        // DBG(c);
        if (m / 2 - 1 + c == n || m / 2 - 1 + c + 1 == n) {
            Prt(1);
        }
        else Prt(0);

    }
    int bitcnt(int a) {
        int ret = 0;
        while (a > 0) {
            ret += a & 1;
            a >>= 1;
        }
        return ret;
    }
}

class pair<T, U> : IComparable<pair<T, U>> {
    public T v1;
    public U v2;
    public pair() : this(default(T), default(U)) {}
    public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }
    public int CompareTo(pair<T, U> a) {
        int c = Comparer<T>.Default.Compare(v1, a.v1);
        return c != 0 ? c : Comparer<U>.Default.Compare(v2, a.v2);
    }
    public override string ToString() => v1 + " " + v2;
    public void Deconstruct(out T a, out U b) { a = v1; b = v2; }
}
static class util {
    public static readonly int M = 1000000007;
    // public static readonly int M = 998244353;
    public static readonly long LM = 1L << 60;
    public static readonly double eps = 1e-11;
    public static void DBG(string a) => Console.Error.WriteLine(a);
    public static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a));
    public static void DBG(params object[] a) => DBG(string.Join(" ", a));
    public static void Assert(bool cond) { if (!cond) throw new Exception(); }
    public static pair<T, U> make_pair<T, U>(T v1, U v2) => new pair<T, U>(v1, v2);
    public static int CompareList<T>(IList<T> a, IList<T> b) where T : IComparable<T> {
        for (int i = 0; i < a.Count && i < b.Count; i++)
            if (a[i].CompareTo(b[i]) != 0) return a[i].CompareTo(b[i]);
        return a.Count.CompareTo(b.Count);
    }
    public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;
    static readonly int[] dd = { 0, 1, 0, -1 };
    // static readonly string dstring = "RDLU";
    public static P[] adjacents(int i, int j)
        => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).ToArray();
    public static P[] adjacents(int i, int j, int h, int w)
        => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1]))
                                         .Where(p => inside(p.v1, p.v2, h, w)).ToArray();
    public static P[] adjacents(this P p) => adjacents(p.v1, p.v2);
    public static P[] adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, w);
    public static Dictionary<T, int> compress<T>(this IEnumerable<T> a)
        => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);
    public static Dictionary<T, int> compress<T>(params IEnumerable<T>[] a) => compress(a.Aggregate(Enumerable.Union));
    public static int[] compressed<T>(this IEnumerable<T> a) {
        var cmp = a.compress();
        return a.Select(x => cmp[x]).ToArray();
    }
    public static T[] inv<T>(this Dictionary<T, int> dic) {
        var res = new T[dic.Count];
        foreach (var item in dic) res[item.Value] = item.Key;
        return res;
    }
    public static void swap<T>(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }
    public static void swap<T>(this IList<T> a, int i, int j) where T : struct { var t = a[i]; a[i] = a[j]; a[j] = t; }
    public static T[] copy<T>(this IList<T> a) {
        var ret = new T[a.Count];
        for (int i = 0; i < a.Count; i++) ret[i] = a[i];
        return ret;
    }
}

class Scan {
    StreamReader sr;
    public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }
    public Scan(string path) { sr = new StreamReader(path); }
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public string Str => sr.ReadLine().Trim();
    public pair<T, U> Pair<T, U>() {
        T a; U b;
        Multi(out a, out b);
        return new pair<T, U>(a, b);
    }
    public P P => Pair<int, int>();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();
    public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
                       : eq<T, long>()   ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>()   ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    public void Multi<T>(out T a) => a = cv<T>(Str);
    public void Multi<T, U>(out T a, out U b)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); }
    public void Multi<T, U, V>(out T a, out U b, out V c)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); }
    public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); }
    public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); }
}