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

namespace Codeforces
{
    public class Input
    {
        private static string _line;

        public static bool Next()
        {
            _line = Console.ReadLine();
            return !string.IsNullOrEmpty(_line);
        }

        public static bool Next(out long a)
        {
            var ok = Next();
            a = ok ? long.Parse(_line) : 0;
            return ok;
        }

        public static bool Next(out long a, out long b)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
            }
            else
            {
                a = b = 0;
            }

            return ok;
        }

        public static bool Next(out long a, out long b, out long c)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
            }
            else
            {
                a = b = c = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
            }
            else
            {
                a = b = c = d = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d, out long e)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
            }
            else
            {
                a = b = c = d = e = 0;
            }
            return ok;
        }

        public static List<long> Numbers()
        {
            return !Next() ? new List<long>() : _line.Split(' ').Select(long.Parse).ToList();
        }

        public static bool Next(out string value)
        {
            value = string.Empty;
            if (!Next()) return false;
            value = _line;
            return true;
        }
    }

    public class DisjointSet
    {
        private readonly int[] _parent;
        private readonly int[] _rank;
        public int Count { get; private set; }

        public DisjointSet(int count, int initialize = 0)
        {
            Count = count;
            _parent = new int[Count];
            _rank = new int[Count];
            for (var i = 0; i < initialize; i++) _parent[i] = i;
        }

        private DisjointSet(int count, int[] parent, int[] rank)
        {
            Count = count;
            _parent = parent;
            _rank = rank;
        }

        public void Add(int v)
        {
            _parent[v] = v;
            _rank[v] = 0;
        }

        public int Find_Recursive(int v)
        {
            if (_parent[v] == v) return v;
            return _parent[v] = Find(_parent[v]);
        }

        public int Find(int v)
        {
            if (_parent[v] == v) return v;
            var last = v;
            while (_parent[last] != last) last = _parent[last];
            while (_parent[v] != v)
            {
                var t = _parent[v];
                _parent[v] = last;
                v = t;
            }
            return last;
        }

        public int this[int v]
        {
            get { return Find(v); }
            set { Union(v, value); }
        }

        public void Union(int a, int b)
        {
            a = Find(a);
            b = Find(b);
            if (a == b) return;
            if (_rank[a] < _rank[b])
            {
                var t = _rank[a];
                _rank[a] = _rank[b];
                _rank[b] = t;
            }
            _parent[b] = a;
            if (_rank[a] == _rank[b]) _rank[a]++;
        }

        public int GetSetCount()
        {
            var result = 0;
            for (var i = 0; i < Count; i++)
            {
                if (_parent[i] == i) result++;
            }
            return result;
        }

        public DisjointSet Clone()
        {
            var rank = new int[Count];
            _rank.CopyTo(rank, 0);
            var parent = new int[Count];
            _parent.CopyTo(parent, 0);
            return new DisjointSet(Count, parent, rank);
        }

        public override string ToString()
        {
            return string.Join(",", _parent.Take(50));
        }
    }

    public class Matrix
    {
        public static Matrix Create(int i, int j)
        {
            var m = new Matrix(i, j);
            return m;
        }

        public static Matrix Create(int i)
        {
            var m = new Matrix(i, i);
            return m;
        }

        public long Modulo { get; set; }

        private readonly int _width;
        private readonly int _height;
        private readonly long[,] _data;
        public int Width{get { return _width; }}
        public int Height{get { return _height; }}

        private Matrix(int i, int j)
        {
            Modulo = 1000000000000000000L;
            _width = j;
            _height = i;
            _data = new long[_height, _width];
        }

        public static Matrix operator *(Matrix m1, Matrix m2)
        {
            if (m1.Width != m2.Height) throw new InvalidDataException("m1.Width != m2.Height");
            var m = Create(m2.Width, m1.Height);
            m.Modulo = m1.Modulo;
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                {
                    for (var k = 0; k < m1.Width; k++)
                        m[j, i] += (m1[j, k]*m2[k, i]) % m1.Modulo;
                    m[j, i] %= m1.Modulo;
                }
            return m;
        }

        public static Matrix operator +(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator -(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator *(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i=0;i<m1.Width;i++)
                for (var j=0;j<m1.Height;j++)
                        m[j, i] = (m[j, i] * l) % m.Modulo;
            return m;
        }

        public static Matrix operator *(long l, Matrix m1)
        {
            return m1*l;
        }

        public static Matrix operator +(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i = 0; i < m1.Width; i++)
                    m[i, i] = (m[i, i] + l) % m.Modulo;
            return m;
        }

        public static Matrix operator +(long l, Matrix m1)
        {
            return m1 + l;
        }

        public static Matrix operator -(Matrix m1, long l)
        {
            return m1 + (-l);
        }

        public static Matrix operator -(long l, Matrix m1)
        {
            var m = m1.Clone() * -1;
            return m + l;
        }

        public Matrix BinPower(long l)
        {
            var n = 1;
            var m = Clone();
            var result = new Matrix(m.Height, m.Width) + 1;
            result.Modulo = m.Modulo;
            while (l != 0)
            {
                var i = l & ~(l - 1);
                l -= i;
                while (n < i)
                {
                    m = m*m;
                    n <<= 1;
                }
                result *= m;
            }
            return result;
        }

        public void Fill(long l)
        {
            l %= Modulo;
            for (var i = 0; i < _height; i++)
                for (var j = 0; j < _width; j++)
                    _data[i, j] = l;
        }

        public Matrix Clone()
        {
            var m = new Matrix(_width, _height);
            Array.Copy(_data, m._data, _data.Length);
            m.Modulo = Modulo;
            return m;
        }

        public long this[int i, int j]
        {
            get { return _data[i, j]; }
            set { _data[i, j] = value % Modulo; }
        }
    }
}

namespace Codeforces.TaskE
{
    public class Task
    {
        public static void Main()
        {
            var task = new Task();
            try
            {
                task.Solve();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
                throw;
            }
        }

        bool Check(long b, long a)
        {
            if (a == 0) return false;
            if (!Check(a, b%a)) return true;
            var c = b/a - 1;
            if (a%2 == 1) return c%2 == 1;
            return c%(a+1)==1;
        }

        void Solve()
        {
            long t;
            Input.Next(out t);

            for (var i = 0; i < t; i++)
            {
                long a, b;
                Input.Next(out a, out b);
                if (a < b)
                {
                    var c = b;
                    b = a;
                    a = c;
                }
                Console.WriteLine(Check(a,b) ? "First" : "Second");
            }
        }
    }
}


namespace PostcardAndPhotos
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string Ps = "PPPPP";
            string Cs = "CCCCC";
            string change = "XXXXX";
            int result = 0;
            int count = 5;
            int Xs = 0;
            while (Xs != input.Length)
            {
                Regex rr = new Regex(Cs.Substring(0, count));
                while (rr.IsMatch(input))
                {
                    int index = rr.Match(input).Index;
                    input = input.Insert(index, change.Substring(0, count));
                    input = input.Remove(index + count, count);
                    result++;
                }
                Regex r = new Regex(Ps.Substring(0, count));
                while (r.IsMatch(input))
                {
                    int index = r.Match(input).Index;
                    input = input.Insert(index, change.Substring(0, count));
                    input = input.Remove(index + count, count);
                    result++;
                }
                count--;
                Xs = input.Select(x => x).Where(x => x == 'X').Count();
            }
            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}


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

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

            Console.SetIn(new StreamReader("file.in"));
            /*
            FileStream filestream = new FileStream("out.txt", FileMode.Create);
            var streamwriter = new StreamWriter(filestream);
            streamwriter.AutoFlush = true;
            Console.SetOut(streamwriter);
            */

            char[] s = Console.ReadLine().ToCharArray();
            int ans = 0;
            for (int i = 0; i < s.Length; i++) {
                int cur = 0;
                ans++;
                int k = i;
                while (k < s.Length && cur < 5 && s[k] == s[i]) {
                    cur++;
                    k++;
                }
                i = k - 1;
            }
            Console.Write(ans);

            //Console.ReadKey();
        }
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{CFF74FAA-1C76-4632-987A-AB7304DC07F5}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>C.Primes_or_Palindromes</RootNamespace>
    <AssemblyName>C.Primes_or_Palindromes</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


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

namespace ConsoleApp
{
    public class Program
    {
        public static void Main()
        {
            //int n = Convert.ToInt32(Console.ReadLine());
            //int[] array = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            //StringBuilder stringBuilder = new StringBuilder();
            int n = Convert.ToInt32(Console.ReadLine());
            int degree = Convert.ToInt32(Console.ReadLine());
            BitArray bitArray = new BitArray(360);
            bitArray[degree] = true;
            bitArray[360 - degree] = true;
            BitArray left = (BitArray)bitArray.Clone();
            BitArray right = (BitArray)bitArray.Clone();
            BitArray temp1;
            BitArray temp2;
            for (; n > 1; n--)
            {
                degree = Convert.ToInt32(Console.ReadLine());
                temp1 = (BitArray)left.Clone();
                temp2 = (BitArray)left.Clone();
                left = (BitArray)(temp1.LeftShift(degree).Or(temp2.LeftShift(360 - degree))).Clone();
                temp1 = (BitArray)right.Clone();
                temp2 = (BitArray)right.Clone();
                right = (BitArray)(temp1.RightShift(degree).Or(temp2.RightShift(360 - degree))).Clone();

                bitArray = (BitArray)left.Or(right).Clone();
            }

            if (bitArray[0])
            {
                Console.Write("YES");
            }
            else
            {
                Console.Write("NO");
            }
        }
    }
}


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

namespace ConsoleApplication14
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());
            int[] vs = new int[n];
            for (int i = 0; i < n; i++)
            {
                vs[i] = Convert.ToInt32(Console.ReadLine());

                bool result = DegreeChecker(vs, 0, 0);
                if (result)
                    Console.WriteLine("YES");
                else
                    Console.WriteLine("NO");
            }
        }
        static bool DegreeChecker(int[] vs, int sum, int i)
        {
            if (i == vs.Length)
            {
                return sum % 360 == 0;
            }
            return DegreeChecker(vs, sum - vs[i], i + 1) || DegreeChecker(vs, sum + vs[i], i + 1);
        }
    }
}


#define FileIO

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

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            D();

#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static void A()
        {
            int n = ReadInt();
            int[] a = new int[n];
            int[] b = new int[n];
            for (int i = 0; i < n; i++)
            {
                string[] tokens = ReadArray(' ');
                a[i] = int.Parse(tokens[0]);
                b[i] = int.Parse(tokens[1]);
            }
            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                bool isHere = false;
                for (int j = 0; j < n; j++)
                {
                    if (i == j) continue;
                    if (b[j] == a[i])
                        isHere = true;
                }
                if (!isHere)
                    ans++;
            }
            Console.WriteLine(ans);
        }

        static void B()
        {
            int n, m;
            string[] tokens = ReadArray(' ');
            n = int.Parse(tokens[0]);
            m = int.Parse(tokens[1]);
            int[] a = new int[n];
            tokens = ReadArray(' ');
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(tokens[i]);

            int[] sum = new int[m + 1];
            int[] last = new int[n];
            StringBuilder ans = new StringBuilder();
            for (int i = 1; i <= m; i++)
            {
                sum[i] = sum[i - 1];
                tokens = ReadArray(' ');
                int t = int.Parse(tokens[0]);
                if (t == 1)
                {
                    int v = int.Parse(tokens[1]);
                    int x = int.Parse(tokens[2]);
                    a[v - 1] = x;
                    last[v - 1] = i;
                }
                if (t == 2)
                {
                    int y = int.Parse(tokens[1]);
                    sum[i] += y;
                }
                if (t == 3)
                {
                    int q = int.Parse(tokens[1]);
                    int val = a[q - 1] + (sum[i] - sum[last[q - 1]]);
                    ans.AppendLine(val.ToString());
                }
            }
            Console.Write(ans);
        }

        static void C()
        {
            long n, k;
            string[] tokens = ReadArray(' ');
            n = long.Parse(tokens[0]);
            k = long.Parse(tokens[1]);
            long[] a = new long[n + 1];
            tokens = ReadArray(' ');
            for (int i = 1; i <= n; i++)
            {
                a[i] = long.Parse(tokens[i - 1]);
            }
            StringBuilder ans = new StringBuilder();
            long cnt = 0;
            long cur = 0;
            long _d = 0;
            for (int i = 1; i <= n; i++)
            {
                _d = 0;
                _d -= (i - 1 - cnt) * ((n-cnt) - (i-cnt)) * a[i];
                _d += cur;
                if (_d < k)
                {
                    ans.AppendLine(i.ToString());
                    cnt++;
                }
                else
                {
                    cur += (i - cnt - 1) * a[i];
                }
            }
            Console.Write(ans);
        }

        static int FirstIndex(string a, string c, int i,int z, int j)
        {
            for (int k = 0; k < a.Length; k++, z++)
            {
                if (a[(i + z) % a.Length].Equals(c[j])) return (z + 1);
            }
            return -1;
        }

        static void D()
        {
            int b, d;
            string[] tokens = ReadArray(' ');
            b = int.Parse(tokens[0]);
            d = int.Parse(tokens[1]);
            string a = ReadLine();
            string c = ReadLine();

            int[] _cnt = new int[a.Length];
            for (int i = 0; i < a.Length; i++)
            {
                int z = 0;
                for (int j = 0; j < c.Length; j++)
                {
                    int m = FirstIndex(a, c, i, z, j);
                    if (m == -1)
                    {
                        Console.WriteLine(0);
                        return;
                    }
                    z = m;
                }
                _cnt[i] = z;
            }

            int[] r = new int[a.Length];
            int[] __cnt = new int[a.Length];
            for (int i = 0; i < a.Length; i++)
            {
                int j = 0;
                for (int k = 0; k < d; j += _cnt[(i + j) % a.Length], k++)
                {
                    if (r[(i + j) % a.Length] > 0)
                    {
                        int dif = j - r[(i + j) % a.Length];
                        j += (d - k) * dif;
                        break;
                    }
                    r[(i + j) % a.Length] = j;
                    r = new int[a.Length];
                }
                __cnt[i] = j;
            }
            r = new int[a.Length];
            int[] _r = new int[a.Length];
            int p = 0;
            for (int j = 0; j < a.Length * b; )
            {
                if (r[j % a.Length] > 0)
                {
                    int dif = j - r[j % a.Length];
                    int _dif = p - _r[j % a.Length];
                    p += ((a.Length * b - j) / dif) * (_dif);
                    j += ((a.Length * b - j) / dif) * dif;
                    while (j + __cnt[j % a.Length] < a.Length * b)
                    {
                        p++;
                        j += __cnt[j % a.Length];
                    }
                    break;
                }
                r[j % a.Length] = j;
                _r[j % a.Length] = p;
                j += __cnt[j % a.Length];
                if (j < a.Length * b) p++;
            }
            Console.WriteLine(p);

        }

        static void E()
        {

        }

        static void TestGen()
        {

        }

        static string[] ReadArray(char sep)
        {
            return Console.ReadLine().Split(sep);
        }

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

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

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

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

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }

    class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;
        public Stack<int> ans = new Stack<int>();
        public Graph(int n)
        {
            g = new List<int>[n + 1];
            for (int i = 0; i <= n; i++)
                g[i] = new List<int>();
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }

        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public bool DFS(int u, ref int time)
        {
            color[u] = gray;
            time++;
            o[u] = time;
            for (int i = 0; i < g[u].Count; i++)
            {
                int v = g[u][i];
                if (color[v] == gray)
                {
                    return true;
                }
                if (color[v] == white)
                {
                    p[v] = u;
                    if (DFS(v, ref time)) return true;
                }
            }
            color[u] = black;
            ans.Push(u);
            c[u] = time;
            time++;
            return false;
        }
    }

    static class GraphUtils
    {
        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public static void BFS(int s, Graph g)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(s);
            while (q.Count != 0)
            {
                int u = q.Dequeue();
                for (int i = 0; i < g.g[u].Count; i++)
                {
                    int v = g.g[u][i];
                    if (g.color[v] == white)
                    {
                        g.color[v] = gray;
                        g.d[v] = g.d[u] + 1;
                        g.p[v] = u;
                        q.Enqueue(v);
                    }
                }
                g.color[u] = black;
            }
        }

        public static bool DFS(int u, ref int time, Graph g, Stack<int> st)
        {
            g.color[u] = gray;
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == gray)
                {
                    return true;
                }
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    if (DFS(v, ref time, g, st)) return true;
                }
            }
            g.color[u] = black;
            st.Push(u);
            g.c[u] = time;
            time++;
            return false;
        }

        public static void FordBellman(int u, Graph g)
        {
            int n = g.g.Length;
            for (int i = 0; i <= n; i++)
            {
                g.d[i] = int.MaxValue;
                g.p[i] = 0;
            }

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }

    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (comp(L[i], R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R, comp);
            Merge_Sort(A, q + 1, r, L, R, comp);
            Merge(A, p, q, r, L, R, comp);
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) >= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}


#define Online

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

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            D();

#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static void A()
        {
            int n = ReadInt();
            int[] a = new int[n];
            int[] b = new int[n];
            for (int i = 0; i < n; i++)
            {
                string[] tokens = ReadArray(' ');
                a[i] = int.Parse(tokens[0]);
                b[i] = int.Parse(tokens[1]);
            }
            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                bool isHere = false;
                for (int j = 0; j < n; j++)
                {
                    if (i == j) continue;
                    if (b[j] == a[i])
                        isHere = true;
                }
                if (!isHere)
                    ans++;
            }
            Console.WriteLine(ans);
        }

        static void B()
        {
            int n, m;
            string[] tokens = ReadArray(' ');
            n = int.Parse(tokens[0]);
            m = int.Parse(tokens[1]);
            int[] a = new int[n];
            tokens = ReadArray(' ');
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(tokens[i]);

            int[] sum = new int[m + 1];
            int[] last = new int[n];
            StringBuilder ans = new StringBuilder();
            for (int i = 1; i <= m; i++)
            {
                sum[i] = sum[i - 1];
                tokens = ReadArray(' ');
                int t = int.Parse(tokens[0]);
                if (t == 1)
                {
                    int v = int.Parse(tokens[1]);
                    int x = int.Parse(tokens[2]);
                    a[v - 1] = x;
                    last[v - 1] = i;
                }
                if (t == 2)
                {
                    int y = int.Parse(tokens[1]);
                    sum[i] += y;
                }
                if (t == 3)
                {
                    int q = int.Parse(tokens[1]);
                    int val = a[q - 1] + (sum[i] - sum[last[q - 1]]);
                    ans.AppendLine(val.ToString());
                }
            }
            Console.Write(ans);
        }

        static void C()
        {
            long n, k;
            string[] tokens = ReadArray(' ');
            n = long.Parse(tokens[0]);
            k = long.Parse(tokens[1]);
            long[] a = new long[n + 1];
            tokens = ReadArray(' ');
            for (int i = 1; i <= n; i++)
            {
                a[i] = long.Parse(tokens[i - 1]);
            }
            StringBuilder ans = new StringBuilder();
            long cnt = 0;
            long cur = 0;
            long _d = 0;
            for (int i = 1; i <= n; i++)
            {
                _d = 0;
                _d -= (i - 1 - cnt) * ((n-cnt) - (i-cnt)) * a[i];
                _d += cur;
                if (_d < k)
                {
                    ans.AppendLine(i.ToString());
                    cnt++;
                }
                else
                {
                    cur += (i - cnt - 1) * a[i];
                }
            }
            Console.Write(ans);
        }

        static int FirstIndex(string a, string c, int i,int z, int j)
        {
            for (int k = 0; k < a.Length; k++, z++)
            {
                if (a[(i + z) % a.Length].Equals(c[j])) return (z + 1);
            }
            return -1;
        }

        static void D()
        {
            int b, d;
            string[] tokens = ReadArray(' ');
            b = int.Parse(tokens[0]);
            d = int.Parse(tokens[1]);
            string a = ReadLine();
            string c = ReadLine();

            int[] _cnt = new int[a.Length];
            for (int i = 0; i < a.Length; i++)
            {
                int z = 0;
                for (int j = 0; j < c.Length; j++)
                {
                    int m = FirstIndex(a, c, i, z, j);
                    if (m == -1)
                    {
                        Console.WriteLine(0);
                        return;
                    }
                    z = m;
                }
                _cnt[i] = z;
            }

            int[] r = new int[a.Length];
            int[] __cnt = new int[a.Length];
            for (int i = 0; i < a.Length; i++)
            {
                int j = 0;
                for (int k = 0; k < d; j += _cnt[(i + j) % a.Length], k++)
                {
                    if (r[(i + j) % a.Length] > 0)
                    {
                        int dif = j - r[(i + j) % a.Length];
                        j += (d - k) * dif;
                        break;
                    }
                    r[(i + j) % a.Length] = j;
                    r = new int[a.Length];
                }
                __cnt[i] = j;
            }
            r = new int[a.Length];
            int[] _r = new int[a.Length];
            int p = 0;
            for (int j = 0; j < a.Length * b; )
            {
                if (r[j % a.Length] > 0)
                {
                    int dif = j - r[j % a.Length];
                    int _dif = p - _r[j % a.Length];
                    p += ((a.Length * b - j) / dif) * (_dif);
                    j += ((a.Length * b - j) / dif) * dif;
                    while (j + __cnt[j % a.Length] <= a.Length * b)
                    {
                        p++;
                        j += __cnt[j % a.Length];
                    }
                    break;
                }
                r[j % a.Length] = j;
                _r[j % a.Length] = p;
                j += __cnt[j % a.Length];
                if (j <= a.Length * b) p++;
            }
            Console.WriteLine(p);

        }

        static void E()
        {

        }

        static void TestGen()
        {

        }

        static string[] ReadArray(char sep)
        {
            return Console.ReadLine().Split(sep);
        }

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

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

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

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

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }

    class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;
        public Stack<int> ans = new Stack<int>();
        public Graph(int n)
        {
            g = new List<int>[n + 1];
            for (int i = 0; i <= n; i++)
                g[i] = new List<int>();
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }

        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public bool DFS(int u, ref int time)
        {
            color[u] = gray;
            time++;
            o[u] = time;
            for (int i = 0; i < g[u].Count; i++)
            {
                int v = g[u][i];
                if (color[v] == gray)
                {
                    return true;
                }
                if (color[v] == white)
                {
                    p[v] = u;
                    if (DFS(v, ref time)) return true;
                }
            }
            color[u] = black;
            ans.Push(u);
            c[u] = time;
            time++;
            return false;
        }
    }

    static class GraphUtils
    {
        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public static void BFS(int s, Graph g)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(s);
            while (q.Count != 0)
            {
                int u = q.Dequeue();
                for (int i = 0; i < g.g[u].Count; i++)
                {
                    int v = g.g[u][i];
                    if (g.color[v] == white)
                    {
                        g.color[v] = gray;
                        g.d[v] = g.d[u] + 1;
                        g.p[v] = u;
                        q.Enqueue(v);
                    }
                }
                g.color[u] = black;
            }
        }

        public static bool DFS(int u, ref int time, Graph g, Stack<int> st)
        {
            g.color[u] = gray;
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == gray)
                {
                    return true;
                }
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    if (DFS(v, ref time, g, st)) return true;
                }
            }
            g.color[u] = black;
            st.Push(u);
            g.c[u] = time;
            time++;
            return false;
        }

        public static void FordBellman(int u, Graph g)
        {
            int n = g.g.Length;
            for (int i = 0; i <= n; i++)
            {
                g.d[i] = int.MaxValue;
                g.p[i] = 0;
            }

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }

    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (comp(L[i], R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R, comp);
            Merge_Sort(A, q + 1, r, L, R, comp);
            Merge(A, p, q, r, L, R, comp);
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) >= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}


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

namespace CodeForces
{
    public class CodeForces
    {
        static void Main(string[] args)
        {
            var arr = GetArray();
            var n = arr[0];
            var a = arr[1];
            var b = arr[2];
            Console.WriteLine(Solve(n,a,b));
        }

        public static void Tests()
        {
            //\
        }

        public static long Solve(int n, int a, int b)
        {

            var i = 1;
            var k = n - i;
            var max = 0;
            while ( i <= k)
            {
                var m = Math.Min(a / i, b / k);
                var t = Math.Min(a / k, b / i);
                max = Math.Max(max, m);
                max = Math.Max(max, t);
                i++;
                k = n - i;

            }
            return max;

        }

    }
}


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

namespace _224A.Parallelepiped
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] arz = Console.ReadLine().Split().Select(double.Parse).ToArray();
            Console.WriteLine(coun(arz));

        }
        static int coun(double[]ars)
        {

            double x= ars[0] * ars[2] / ars[1];
            double y= ars[0] * ars[1] / ars[2];
            double z= ars[1] * ars[2] / ars[0];
            int a=0, b=0, c=0;
            int[] roots = new int[10001];
            for (int i = 0; i < roots.Length; i++)
            {
                roots[i] = (i) * (i);
            }
            int j = 1;
            while(x>=roots[j]|| y >= roots[j]|| z >= roots[j])
            {
                if (x <= roots[j] && x > roots[j - 1])
                {
                    x = roots[j];
                    a = j;
                }
                if (y <= roots[j] && y > roots[j - 1])
                {
                    y = roots[j];
                    b = j;
                }
                if (z <= roots[j] && z > roots[j - 1])
                {
                    z = roots[j];
                    c = j;
                }
                j++;
            }
            return (4*(a + b + c));
        }
    }
}


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

namespace CodeForces
{
	internal class Template
	{
		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
			//Console.SetIn(new StreamReader(@"C:\CodeForces\input.txt"));
			new Template().Solve();
		}

		private void Solve()
		{
			var p = cin.NextInt();
			var primes = new List<int>();
			primes.Add(2);
			primes.Add(3);
			for (var i = 5; i < 4010; i += 2)
			{
				if (!primes.Any(x => i % x == 0))
				{
					primes.Add(i);
				}
			}
			for (var i = 0; i < primes.Count; i++)
			{
				if (primes[i] == p)
				{
					Console.WriteLine(i);
					return;
				}
			}
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = new[] { ' ' };

		public string Next()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

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

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

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


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

namespace CodeForces174DIV2A
{
    class CowsAndPrimitiveRoots
    {
        static void Main(string[] args)
        {
            int p = int.Parse(Console.ReadLine());
            int counter = 0; bool isgood = true; BigInteger cur = 1;
            for (int x = 2; x < p; x++)
            {
                for (int i = 1; i <= p - 2; i++)
                {
                    cur = cur * x;
                    if (cur % p == 1) { isgood = false; break; }
                }
                if (isgood && ((cur*x) % p == 1)) counter++;
                isgood = true; cur = 1;
            }
            Console.WriteLine(counter);
            Console.Read();
        }
    }
}


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

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

class Sol{
	long gcd(long a, long b){ return a == 0 ? b : gcd(b % a, a);}
	public void Solve(){
try{
checked{

		long mo = N * K;
		List<long> X = new List<long>(){
			A, (mo - A) % mo
		};
		long ma = -1, mi = (long) 1e18;
		foreach(var s in X){
			for(int i=0;i<N;i++){
				long bb = i * K;
				for(int j=-1;j<=1;j+=2){
					long b = (bb + j * B) % mo;
					long l = b - s;
					if(l < 0){
						l %= mo;
						l += mo;
					}
					if(l == 0){
						l = mo;
					}
//Console.WriteLine("s:{0}, l:{1}",s, l);
					var lcm = mo / gcd(mo, l) * l;
//Console.WriteLine("lcm:{0}, l:{1}",lcm, l);
					var rr = lcm / l;
					ma = Math.Max(ma, rr);
					mi = Math.Min(mi, rr);
				}
			}
		}
		Console.WriteLine("{0} {1}",mi, ma);
}
} catch (Exception e){
	Console.WriteLine(e);
	return;
}

	}
	long N,K;
	long A,B;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		d = ria();
		A = d[0]; B = d[1];
	}

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


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{2297ECA0-C062-46E8-B61B-A63120803B57}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Tram</RootNamespace>
    <AssemblyName>Tram</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


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

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

            //Console.SetIn(new StreamReader("file.in"));
            /*
            FileStream filestream = new FileStream("out.txt", FileMode.Create);
            var streamwriter = new StreamWriter(filestream);
            streamwriter.AutoFlush = true;
            Console.SetOut(streamwriter);
            */

            string[] s = Console.ReadLine().Split(':');
            int h = int.Parse(s[0]), m = int.Parse(s[1]);
            int a = int.Parse(Console.ReadLine());
            int m1 = a % 60;
            a /= 60;
            int h1 = a % 24;
            int m2 = (m1 + m) % 60;
            int h2 = ((m1 + m) / 60 + h1 + h) % 24;
            char[] a1 = new char[2];
            char[] a2 = new char[2];
            a1[1] = (char)(h2 % 10 + '0');
            h2 /= 10;
            a1[0] = (char)(h2 % 10 + '0');
            a2[1] = (char)(m2 % 10 + '0');
            m2 /= 10;
            a2[0] = (char)(m2 % 10 + '0');
            Console.Write("{0}:{1}", a1, a2);

            //Console.ReadKey();
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{70ADB980-9528-4E57-BA4F-42243ED6D468}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nm[0];
        ModInt.MOD = nm[1];
        ModInt res = 0;
        for (int frameSize = 1; frameSize <= n; frameSize++)
            res += (n - frameSize + 1) * Factorial(frameSize) * Factorial(n - frameSize + 1);
        Console.WriteLine(res);
    }

    static List<ModInt> factorialMemo = new List<ModInt>() { 1 };
    static ModInt Factorial(int x)
    {
        for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i);
        return factorialMemo[x];
    }
}

struct ModInt
{
    public static int MOD;
    long Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public ModInt(long data) { if ((Data = data % MOD) < 0) Data += MOD; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator long(ModInt modInt) => modInt.Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator ModInt(long val) => new ModInt(val);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, int b) => new ModInt() { Data = (a.Data + b) % MOD };
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, long b) => new ModInt(a.Data + b);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, ModInt b) { long res = a.Data + b.Data; return new ModInt() { Data = res >= MOD ? res - MOD : res }; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, int b) => new ModInt() { Data = (a.Data - b) % MOD };
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, long b) => new ModInt(a.Data - b);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, ModInt b) { long res = a.Data - b.Data; return new ModInt() { Data = res < 0 ? res + MOD : res }; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator *(ModInt a, int b) => new ModInt(a.Data * b);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator *(ModInt a, long b) => a * new ModInt(b);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % MOD };
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator /(ModInt a, ModInt b) => new ModInt() { Data = a.Data * GetInverse(b) % MOD };
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public override string ToString() => Data.ToString();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static long GetInverse(long a)
    {
        long div, p = MOD, x1 = 1, y1 = 0, x2 = 0, y2 = 1;
        while (true)
        {
            if (p == 1) return x2 + MOD; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p;
            if (a == 1) return x1 + MOD; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a;
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class CODEFORCES1
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var n = NN;
            var m = NN;
            LIB_Mod._mod = m;
            LIB_Mod ans = 0L;
            for (var i = 1; i <= n; i++)
            {
                LIB_Mod tmp = (n - i + 1);
                tmp.Mul(n - i + 1);
                tmp.Mul(LIB_Mod.Perm(i, i));
                tmp.Mul(LIB_Mod.Perm(n - i, n - i));
                ans += tmp;
            }
            Console.WriteLine(ans);
        }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static public void Main(string[] args) { if (args.Length == 0) { Console.SetOut(new Printer(Console.OpenStandardOutput())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
    }
}
namespace Library {
    struct LIB_Mod : IEquatable<LIB_Mod>, IEquatable<long>
    {
        static public long _mod = 1000000007; long v;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_Mod(long x)
        {
            if (x < _mod && x >= 0) v = x;
            else if ((v = x % _mod) < 0) v += _mod;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public implicit operator LIB_Mod(long x) => new LIB_Mod(x);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public implicit operator long(LIB_Mod x) => x.v;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Add(LIB_Mod x) { if ((v += x.v) >= _mod) v -= _mod; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Sub(LIB_Mod x) { if ((v -= x.v) < 0) v += _mod; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Mul(LIB_Mod x) => v = (v * x.v) % _mod;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Div(LIB_Mod x) => v = (v * Inverse(x.v)) % _mod;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public LIB_Mod operator +(LIB_Mod x, LIB_Mod y) { var t = x.v + y.v; return t >= _mod ? new LIB_Mod { v = t - _mod } : new LIB_Mod { v = t }; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public LIB_Mod operator -(LIB_Mod x, LIB_Mod y) { var t = x.v - y.v; return t < 0 ? new LIB_Mod { v = t + _mod } : new LIB_Mod { v = t }; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public LIB_Mod operator *(LIB_Mod x, LIB_Mod y) => x.v * y.v;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public LIB_Mod operator /(LIB_Mod x, LIB_Mod y) => x.v * Inverse(y.v);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public bool operator ==(LIB_Mod x, LIB_Mod y) => x.v == y.v;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public bool operator !=(LIB_Mod x, LIB_Mod y) => x.v != y.v;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public long Inverse(long x)
        {
            long b = _mod, r = 1, u = 0, t = 0;
            while (b > 0)
            {
                var q = x / b;
                t = u;
                u = r - q * u;
                r = t;
                t = b;
                b = x - q * b;
                x = t;
            }
            return r < 0 ? r + _mod : r;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public bool Equals(LIB_Mod x) => v == x.v;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public bool Equals(long x) => v == x;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override bool Equals(object x) => x == null ? false : Equals((LIB_Mod)x);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override int GetHashCode() => v.GetHashCode();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override string ToString() => v.ToString();
        static List<LIB_Mod> _fact = new List<LIB_Mod>() { 1 };
        static long _factm = _mod;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void B(long n)
        {
            if (_factm != _mod) _fact = new List<LIB_Mod>() { 1 };
            if (n >= _fact.Count)
                for (int i = _fact.Count; i <= n; ++i)
                    _fact.Add(_fact[i - 1] * i);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public LIB_Mod Comb(long n, long k)
        {
            B(n);
            if (n == 0 && k == 0) return 1;
            if (n < k || n < 0) return 0;
            return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public LIB_Mod Perm(long n, long k)
        {
            B(n);
            if (n == 0 && k == 0) return 1;
            if (n < k || n < 0) return 0;
            return _fact[(int)n] / _fact[(int)(n - k)];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public LIB_Mod Pow(LIB_Mod x, long y)
        {
            LIB_Mod a = 1;
            while (y != 0)
            {
                if ((y & 1) == 1) a.Mul(x);
                x.Mul(x);
                y >>= 1;
            }
            return a;
        }
    }
}


using System;
using System.Collections.Generic;

namespace edabit
{
    public class BoringApartments
    {

        static Dictionary<int, int> Pairs = new Dictionary<int, int>();

        static BoringApartments() {
            Pairs[1]=1;
            Pairs[11]=3;
            Pairs[111]=6;
            Pairs[1111]=10;
            Pairs[2]=11;
            Pairs[22]=13;
            Pairs[222]=16;
            Pairs[2222]=20;
            Pairs[3]=21;
            Pairs[33]=23;
            Pairs[333]=26;
            Pairs[3333]=30;
            Pairs[4]=31;
            Pairs[44]=33;
            Pairs[444]=36;
            Pairs[4444]=40;
            Pairs[5]=41;
            Pairs[55]=43;
            Pairs[555]=46;
            Pairs[5555]=50;
            Pairs[6]=51;
            Pairs[66]=53;
            Pairs[666]=56;
            Pairs[6666]=60;
            Pairs[7]=61;
            Pairs[77]=63;
            Pairs[777]=66;
            Pairs[7777]=70;
            Pairs[8]=71;
            Pairs[88]=73;
            Pairs[888]=76;
            Pairs[8888]=80;
            Pairs[9]=81;
            Pairs[99]=83;
            Pairs[999]=86;
            Pairs[9999]=90;
        }

        static void Main(string[] args)
        {
            var line="";
            var numTests = -1;
            int count = 0;
            int[] nums= null;
            do
            {
                line = Console.ReadLine();
                if (numTests == -1) {
                    numTests = Int32.Parse(line);
                    nums = new int[numTests];

                } else {
                    if (count < numTests) {
                        nums[count]=Int32.Parse(line);
                        count++;
                    }
                    else  if (count == numTests) {
                        process(numTests, nums);
                    }
                }
            } while (line != null);
            System.Environment.Exit(1);
        }

        static void process(int numTests, int[] input)
        {
            foreach (var item in input)
            {
                Console.WriteLine(Pairs[item]);
            }
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30611.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boring Apartments", "Boring Apartments\Boring Apartments.csproj", "{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {510506D6-1FE9-4D61-8675-322580D41B76}
	EndGlobalSection
EndGlobal


using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;

namespace Olimp
{
    class Program
    {

        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int c;
            int b = 0;
            int help = 1;
            int help2 = 0;
            int answer = 0;
            //int[] arr;

            for (int i = 0; i < a; i++)
            {
                //arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);
               c = int.Parse(Console.ReadLine());

                while (true)
                {

                    b = b * 10 + help;

                    help2++;
                    answer += help2;
                    if (b == c) break;
                    if (help2 == 4)
                    {

                        help++;
                        b = help;
                        answer++;
                        help2 = 1;
                    }

                }

                Console.WriteLine(answer);
                 b = 0;
                 help = 1;
                 help2 = 0;
                  answer = 0;

            }

        }
    }
}


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

namespace CodeforcesTemplate
{
    public static class Permutation
    {
        private static bool Next(ref int[] arr)
        {
            int k, j, l;
            for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }
            if (j == -1)
            {
                arr = arr.OrderBy(c => c).ToArray();
                return false;
            }
            for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }
            var tmp = arr[j];
            arr[j] = arr[l];
            arr[l] = tmp;
            for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)
            {
                tmp = arr[k];
                arr[k] = arr[l];
                arr[l] = tmp;
            }
            return true;
        }
        public static IEnumerable<int[]> AllPermutations(int[] arr)
        {
            do yield return arr;
            while (Next(ref arr));
        }
    }

    class Program
    {
        private const string FILENAME = "distance4";

        private const string INPUT = FILENAME + ".in";

        private const string OUTPUT = FILENAME + ".out";

        private static Stopwatch _stopwatch = new Stopwatch();

        private static StreamReader _reader = null;
        private static StreamWriter _writer = null;

        private static string[] _curLine;
        private static int _curTokenIdx;

        private static char[] _whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        private static string ReadNextToken()
        {
            if (_curTokenIdx >= _curLine.Length)
            {
                //Read next line
                string line = _reader.ReadLine();
                if (line != null)
                    _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    _curLine = new string[] { };
                _curTokenIdx = 0;
            }

            if (_curTokenIdx >= _curLine.Length)
                return null;

            return _curLine[_curTokenIdx++];
        }

        private static int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        private static void RunTimer()
        {
#if (DEBUG)

            _stopwatch.Start();

#endif
        }

        private static void Main(string[] args)
        {

#if (DEBUG)
            double before = GC.GetTotalMemory(false);
#endif

            int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

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

            for (int i = 1; i <= k; i++)
            {
                if ((n + 1) % i != 0)
                {
                    Console.WriteLine("No");
                    return;
                }
                else if (i == k)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

#if (DEBUG)
            _stopwatch.Stop();

            double after = GC.GetTotalMemory(false);

            double consumedInMegabytes = (after - before) / (1024 * 1024);

            Console.WriteLine($"Time elapsed: {_stopwatch.Elapsed}");

            Console.WriteLine($"Consumed memory (MB): {consumedInMegabytes}");

            Console.ReadKey();
#endif

        }

        private static int CountLeadZeros(string source)
        {
            int countZero = 0;

            for (int i = source.Length - 1; i >= 0; i--)
            {
                if (source[i] == '0')
                {
                    countZero++;
                }

                else
                {
                    break;
                }

            }

            return countZero;
        }

        private static string ReverseString(string source)
        {
            char[] reverseArray = source.ToCharArray();

            Array.Reverse(reverseArray);

            string reversedString = new string(reverseArray);

            return reversedString;
        }

        private static int[] CopyOfRange(int[] src, int start, int end)
        {
            int len = end - start;
            int[] dest = new int[len];
            Array.Copy(src, start, dest, 0, len);
            return dest;
        }

        private static string StreamReader()
        {

            if (_reader == null)
                _reader = new StreamReader(INPUT);
            string response = _reader.ReadLine();
            if (_reader.EndOfStream)
                _reader.Close();
            return response;

        }

        private static void StreamWriter(string text)
        {

            if (_writer == null)
                _writer = new StreamWriter(OUTPUT);
            _writer.WriteLine(text);

        }

        private static int BFS(int start, int end, int[,] arr)
        {
            Queue<KeyValuePair<int, int>> queue = new Queue<KeyValuePair<int, int>>();
            List<bool> visited = new List<bool>();
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                visited.Add(false);
            }

            queue.Enqueue(new KeyValuePair<int, int>(start, 0));
            KeyValuePair<int, int> node;
            int level = 0;
            bool flag = false;

            while (queue.Count != 0)
            {
                node = queue.Dequeue();
                if (node.Key == end)
                {
                    return node.Value;
                }
                flag = false;
                for (int i = 0; i < arr.GetLength(0); i++)
                {

                    if (arr[node.Key, i] == 1)
                    {
                        if (visited[i] == false)
                        {
                            if (!flag)
                            {
                                level = node.Value + 1;
                                flag = true;
                            }
                            queue.Enqueue(new KeyValuePair<int, int>(i, level));
                            visited[i] = true;
                        }
                    }
                }

            }
            return 0;

        }

        private static void Write(string source)
        {
            File.WriteAllText(OUTPUT, source);
        }

        private static string ReadString()
        {
            return File.ReadAllText(INPUT);
        }

        private static void WriteStringArray(string[] source)
        {
            File.WriteAllLines(OUTPUT, source);
        }

        private static string[] ReadStringArray()
        {
            return File.ReadAllLines(INPUT);
        }

        private static int[] GetIntArray()
        {
            return ReadString().Split(' ').Select(int.Parse).ToArray();
        }

        private static double[] GetDoubleArray()
        {
            return ReadString().Split(' ').Select(double.Parse).ToArray();
        }

        private static int[,] ReadINT2XArray(List<string> lines)
        {
            int[,] arr = new int[lines.Count, lines.Count];

            for (int i = 0; i < lines.Count; i++)
            {
                int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

                for (int j = 0; j < lines.Count; j++)
                {
                    arr[i, j] = row[j];
                }
            }

            return arr;
        }
    }
}


    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            var n = int.Parse(input[0]);
            var k = int.Parse(input[1]);

            if(k >= 43)
            {
                Console.WriteLine("No");
                return;
            }

            for (var i = 1; i <= k; i++)
            {
                if (n % i != i - 1)
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }
    }


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

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

             string[]y=Console.ReadLine().Split(' ');

             Console.WriteLine(Math.Pow(2,int.Parse(y[0])+int.Parse(y[1]))%998244353);

        }

    }
}


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

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            var wh = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            int w = wh[0], h = wh[1];
            int t = Math.Max(w, h) + 2;
            Console.WriteLine(kq(t));
        }

        private static int kq(int t)
        {
            int mod = 998244353;
            int res = 1;
            while (t-- > 0)
                res = res * 2 % mod;
            return res;
        }
    }
}


using System;
class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int j = 0;
        bool ans = false;
        while (++j < n)
        {
            int x = j * (j + 1) / 2;
            if (x == n)
                ans = true;
        }
        Console.WriteLine(ans ? "YES" : "NO");
    }
}


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

namespace CodeForce
{
    class Program
    {
        static void Main(string[] args)
        {
            string InPut = Console.ReadLine();
            long Out = 0;
            long Value = long.Parse(InPut);
            Out = ((InPut.Length - 1) * 9);
            string Big_num = new string('9', (int)(InPut.Length - 1));
            string new_value = (Value - long.Parse(Big_num)).ToString();
            foreach (var i in new_value) Out += long.Parse(i.ToString());
            Console.WriteLine(Out);
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve());
            writer.Flush();
        }

        private static int Solve()
        {
            string s = reader.ReadLine();

            int ans = s[0] - '0';
            bool fn9 = false;
            for (int i = s.Length - 1; i > 0; i++)
            {
                if (fn9 || s[i] != '9')
                {
                    ans += 9;
                    ans += s[i] - '0';
                    fn9 = true;
                }
                else
                {
                    ans += 9;
                }
            }

            return ans;
        }
    }
}


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

namespace ProblemSolving
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] num = new int[3];
            while ((num[0] = Convert.ToInt16(Console.ReadLine()))!=null)
            {
                for (int i = 1; i < 3; i++)
                {
                    num[i] = Convert.ToInt16(Console.ReadLine());
                }

                int a = Math.Max(num[0] + num[1] + num[2], Math.Max(num[0] * num[1] * num[2],
                    Math.Max(num[0] + num[1] * num[2],Math.Max((num[0] + num[1]) * num[2], num[0] * (num[1] + num[2])))));
                Console.WriteLine(a.ToString());
            }
        }
    }
}


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

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

            int spin = 0;
            int bicz = 0;
            int grud = 0;

            string fd = Console.ReadLine();

            int[] arrayiNT = new int[n];

            for (int i = 1; i < n + 1; i++)
            {
                arrayiNT[i-1] = Int32.Parse(fd.Split(' ')[i-1]);
                if (i % 3 == 0)
                {
                    spin += arrayiNT[i-1];
                }
                if (i % 3 == 1)
                {
                    grud += arrayiNT[i-1];
                }
                if (i % 3 == 2)
                {
                    bicz += arrayiNT[i-1];
                }
             }

            Dictionary<int, string> slovar = new Dictionary<int, string>() { { spin, "back" }, { bicz, "biceps" }, { grud, "chest" } };
            List<int> upra = new List<int>();

            upra.Add(spin);
            upra.Add(grud);
            upra.Add(bicz);

            Console.WriteLine(slovar[upra.Max()]);
                   }
    }
}


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

namespace checkForSplit
{

    class Program
    {

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
           // List<int>[]lst = new List<int>[1000];
            List<int> lst = new List<int>();
            int k = 0;
            int beg = n / 2;
            lst.Add(n);
            while (beg != 1)
            {
                if (lst[lst.Count - 1] % beg == 0)
                {
                    lst.Add(beg);
                    beg /= 2;
                }
                else beg--;
            }
            lst.Add(1);
            foreach (var i in lst)
            {
                Console.Write(i+" ");
            }
            Console.WriteLine();
        }
    }

}


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

namespace CF_058B {
  class Program {
    static void Main(string[] args) {
      int[] p=new int[1000]; p[0]=2;
      int t=1,u=1,j;while(t<=1000){t+=2;p[u]=t;
        j=1;while(t%p[j]!=0)j++;
        if(j==u)u++;
      }
      int n=int.Parse(Console.ReadLine());
      p[u]=n;
      int mlu=0; int[] m=new int[10],l=new int[10];
      for(j=0;p[u]!=1;j++) {
        if(p[u]%p[j]!=0) continue;
        m[mlu]=p[j];
        while(p[u]%p[j]==0) { l[mlu]++; p[u]/=p[j]; };
        mlu++;
      }
      for(j=0;j<mlu;j++)
       while(l[j]>0){
         Console.Write("{0} ",n);
           n/=m[j];l[j]--;
       }
      Console.WriteLine(1);

    }
  }
}


using System;

public class Coins
{
    private static void Main()
    {

            const int max = 1000;
            int n = Convert.ToInt32(Console.ReadLine());
            int[] primes = new int[max + 1];
            primes[1] = 2;
            primes[2] = 3;
            int curr_prime = 3;
            int sqrt = 1;
            for (int i = 4; (curr_prime <= max && i < Int32.MaxValue); i++)
            {
                if ((sqrt + 1) * (sqrt + 1) == i)
                    sqrt++;

                bool f = true;
                for (int j = 1; primes[j] <= sqrt; j++)
                {
                    if (i % primes[j] == 0)
                    {
                        f = false;
                        break;
                    }
                }

                if (f)
                {
                    primes[curr_prime] = i;
                    curr_prime++;
                }
            }

            bool f = true;
            while (n > 1 && f)
            {
                sqrt = (int)Math.Sqrt(n);
                f = false;
                for (int i = 1; primes[i] <= n; i++)
                {
                    if (n % primes[i] == 0)
                    {
                      Console.WriteLine(primes[i].ToString());
                      n /= primes[i];
                      f = true;
                      break;
                    }
                }
            }
                                  Console.WriteLine(primes[0].ToString());

    }
}


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

namespace CR_111_A
{
    class Program
    {

        static void Main()
        {
            //int k = int.Parse(Console.ReadLine());
            //string[] tmp = Console.ReadLine().Split(' ');
            int k = int.Parse(Console.ReadLine());
            int[] ans = new int[k];
            int j = k - 1 ;
            while (k % j != 0)
                j--;
            if (j != 1)
            {
                for (int i = k, p = 0; i >= j; i -= j, p++)
                    Console.Write("{0} ", k - p * j);
                Console.Write(1);

            }
            else
                Console.Write("{0} {1}", k, 1);

        }

    }
}