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

        public static string Check(string s)
        {
            string letters = "aeiouy";

            while (true)
            {
                bool used = false;

                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))
                    {
                        s = s.Remove(i + 1, 1);

                        used = true;
                    }
                }

                if (!used)
                {
                    return s;
                }
            }
        }

        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

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

            long a = arr[0];
            long b = arr[1];

            while (a != 0 && b != 0)
            {
                if (a >= 2 * b)
                {
                    a %= 2 * b;
                }

                else
                {
                    if (b >= 2 * a)
                    {
                        b %= 2 * a;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Console.WriteLine(a + " " + b);

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


using System;
using System.Linq;

namespace CodeForcesTest
{
    class Program
    {

        static void Main(string[] args)
        {
            bool valid = false;

            char[] card = Console.ReadLine().ToCharArray();

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

            char[,] myCardsSeparate = new char[5, 2];

            for (int i = 0; i < myCardsSeparate.GetLength(0); i++)
            {
                char[] c = myCards[i].ToCharArray();

                myCardsSeparate[i, 0] = c[0];
                myCardsSeparate[i, 1] = c[1];
            }

            for(int i = 0; i < myCardsSeparate.GetLength(0); i++)
            {
                if(myCardsSeparate[i, 0] == card[0] || myCardsSeparate[i, 1] == card[1])
                {
                    valid = true;
                    break;
                }
            }

            Console.WriteLine(valid ? "YES" : "NO");
        }
    }
}


using System;
class Test{
    static void Main(){
        string [] line;
        for(int i = 0; i < 5; i++){
            line = Console.ReadLine().Split();
            for(int j = 0; j < 5; j++){
                if(line[j] != "0"){
                    Console.WriteLine(Math.Abs(i - 2) + Math.Abs(j - 2));
                    return;
                }
            }
        }
    }
}


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

namespace CF746A {
    class Program {
        static void Main(string[] args) {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());

            b /= 2;
            c /= 4;

            int limit = Math.Min(Math.Min(a, b), c);
            int total = limit + (2 * limit) + (4 * limit);

            Console.WriteLine(total);
        }
    }
}


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

    class Program
    {
        static void Main(string[] args)
        {
            int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (mas[0] == 1 && mas[1] == 1)
            {
                Console.WriteLine(2 );
            }
            else
            {
                int t = 0;
                int q = (mas[0] > mas[1]) ? mas[0] : mas[1];
                for (int i = 0; i < q; i++)
                {
                    for (int x = 0; x < q; x++)
                    {
                        if (i * i + x == mas[0] && i + x * x == mas[1]) { t++; }
                    }
                }

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


using System;
using System.Linq;

namespace codeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            repeat:

            int[] input = new int[4];

            input [0] = int.Parse(Console.ReadLine()); //k
            input [1] = int.Parse(Console.ReadLine()); //l
            input [2] = int.Parse(Console.ReadLine()); //m
            input [3] = int.Parse(Console.ReadLine()); //n

            int d = int.Parse(Console.ReadLine());

            if (input.Contains(1))
            {
                Console.WriteLine(d);
                return;
            }

            Array.Sort(input);

            bool[] bResult = new bool[d + 1];
            bResult[0] = true;

            for (int i = 1; i < d + 1; i++)
            {

                if (i % input[0] == 0)
                    continue;

                if (i % input[1] == 0)
                    continue;

                if (i % input[2] == 0)
                    continue;

                if (i % input[3] == 0)
                    continue;

                bResult[i] = true;
            }

            int count = bResult.Count(x => x == false);

            Console.WriteLine(count);

        }
    }
}


/*
 Project Euler, Problem 49 Solution
 C#
 */
using System;
using System.Diagnostics;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            //var sw = new Stopwatch();
            //sw.Start();
            //bool[] prime = new bool[10001];
            //for (int i = 2; i < 10001; i++) prime[i] = true;
            ////SEAVE OF ERAT
            //for (int i = 2; i < 10001; i++)
            //{
            //    if (prime[i] == true)
            //    {
            //        for (int j = i + i; j < 10001; j=j+i)
            //        {
            //            prime[j] = false;
            //        }
            //    }
            //}
            //List<int> pList = new List<int>();
            //for (int i = 2; i < 10001; i++)
            //{
            //    if (prime[i] == true) {
            //       // Console.WriteLine(i);
            //        pList.Add(i);
            //    }
            //}

            //Console.WriteLine("Size of List "+pList.Count);
            ///*for (int i = 1; i < pList.Count - 1; i++)
            //{
            //    if (pList[i] > 1000)
            //    {
            //        if (pList[i] - pList[i - 1] == pList[i + 1] - pList[i])
            //        {
            //            Console.WriteLine(pList[i - 1] + "" + pList[i] + "" + pList[i + 1]);
            //        }
            //    }

            //}*/
            //for (int i = 30; i < pList.Count; i++) {
            //    if (pList[i] > 1000) {
            //        int mx = 10000;
            //        for (int j = 1; j < mx; j++) {
            //            int a = pList[i] + j;
            //            int b = a + j;
            //            if (a < mx && b < mx) {
            //                if (prime[a] == true && prime[b] == true)
            //                {
            //                    if (hasSameChar(pList[i], a) == true && hasSameChar(a, b) == true)
            //                    {
            //                        Console.WriteLine(pList[i] + "" + a + "" + b);
            //                    }
            //                }
            //            }
            //        }
            //    }
            //}
            //Console.WriteLine(sw.Elapsed.TotalMilliseconds);
            //Console.ReadKey(true);
            string s = Console.ReadLine();
            long x = Convert.ToInt64(s);
            int ans=1;
            if (x % 4 == 3 || x % 4 == 0) ans = 0;
            Console.WriteLine(ans);
        //    Console.ReadKey();
        }

        static bool hasSameChar(int x, int y) {
          //  bool ret = false;
            char[] t1 = new char[4];
            char[] t2 = new char[4];
            for (int i = 0; i < 4; i++) {
                int xx = x % 10;
                x = x / 10;
                int yy = y % 10;
                y = y / 10;
                t1[i] = Convert.ToChar(xx);
                t2[i] = Convert.ToChar(yy);
            }
            Array.Sort(t1);
            Array.Sort(t2);
            for(int i = 0; i < 4; i++)
            {
                if (t1[i] != t2[i]) return false;
            }

            return true;
        }

    }
}

// PROJECT EULER SOLUTION 49


using System;

public class Repeating_Cipher{
  public static void Main(){
    String n = Console.ReadLine();
   	String s = Console.ReadLine();
	  int t = 0;
	  for (int i = 0; i < int.Parse(n); i += t)
        {
                Console.Write((char)s[i]);
				  t++;
        }
  }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(input[0]);
            int k = Convert.ToInt32(input[1]);
            string[] numbers = Console.ReadLine().Split(' ');
            int count = 0;
            int score_kth = Convert.ToInt32(numbers[k - 1]);
            for (int i = 0; i < n; i++)
            {
                int value = Convert.ToInt32(numbers[i]);
                if (value < score_kth)
                    break;

                if (value >= score_kth && value != 0)
                    count++;

            }

            Console.WriteLine(count);

        }
    }
}


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

namespace ConsoleApp5
{
    class Program
    {
        private static Stack<bool> GetBin(ulong number)
        {
            Stack<bool> NumInBinNot = new Stack<bool>();

            while (number != 0)
            {
                NumInBinNot.Push(number % 2 == 1);
                number /= 2;
            }
            return NumInBinNot;
        }
        public static ulong IntNumberToIntDegree(ulong IntNumber, ulong Pow)
        {
            ulong result = 1;
            Stack<bool> NumInBinNot = GetBin(Pow);
            while (NumInBinNot.Count != 0)
            {
                result *= result;
                result %= (int)(1e9 + 7);
                if (NumInBinNot.Pop())
                {
                    result *= IntNumber;
                    result %= (int)(1e9 + 7);
                }
            }
            return result;
        }
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            ulong x = ulong.Parse(str[0]);
            ulong n = ulong.Parse(str[1]);
            HashSet<ulong> SimpleDividers = new HashSet<ulong>();
            ulong m = x;
            for (ulong i = 2; i<=Math.Sqrt(x); i++)
            {
                if (m % i == 0)
                {
                    SimpleDividers.Add(i);
                    while (m % i == 0)
                    {
                        m /= i;
                    }
                }
            }
            if (m > 1)
                SimpleDividers.Add(m);
            ulong result = 1;
            foreach(ulong dev in SimpleDividers)
            {
                ulong Degree = dev;
                ulong count = 0;
                for(; Degree<=n && Degree>0; Degree*=dev)
                {
                    count += n / Degree;
                    if (Degree > n/dev)
                        break;
                }
                ulong res = IntNumberToIntDegree(dev, 1044032052841069); ;
                result *= IntNumberToIntDegree(dev, count);
                result %= (int)(1e9 + 7);
            }
            Console.WriteLine(result);
        }
    }
}


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

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

            int i = -1;
            while (number > 0)
            {
                i++;
                number -= + 5 * (int)Math.Pow(2, i);

            }

            int guy = 0;

            while (number <= 0)
            {
                guy++;
                number += (int)Math.Pow(2, i);
            }

            switch (guy)
            {
                case 1: Console.WriteLine("Howard"); break;
                case 2: Console.WriteLine("Rajesh"); break;
                case 3: Console.WriteLine("Penny"); break;
                case 4: Console.WriteLine("Leonard"); break;
                case 5: Console.WriteLine("Sheldon"); break;
            }

            Console.ReadLine();
        }
    }
}


using System;

public class Solution
{
    static void Main(String[] args)
    {
        string cipher = Console.ReadLine();
        string original = "";
        int length = cipher.Length;
        int index;
        if (length % 2 == 0)
        {
            index = length - 1;
        }
        else
        {
            index = 0;
        }
        int originalLength = 0;
        while (originalLength < length)
        {
            original = cipher[index] + original;
            originalLength += 1;
            if (originalLength == length)
            {
                break;
            }
            original = cipher[length - index - 1] + original;
            originalLength += 1;
            if (length % 2 == 0)
            {
                index -= 1;
            }
            else
            {
                index += 1;
            }
        }
        Console.WriteLine(original);
    }
}


using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] nm = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
            long r = nm[0] % nm[1];
            Console.WriteLine(r==0?0:Math.Min(r*nm[3],(nm[1]-r)*nm[2]));
        }
    }
}


using System;

namespace _a
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            string Input = Console.ReadLine();

            int Max = -1;
            string Res = "";
            for (int i = 1; i < N; i++)
            {
                int Result = 0;
                for (int j = i; j < N; j++)
                {
                    if (Input[i - 1] == Input[j - 1] && Input[j] == Input[i])
                    {
                        Result++;
                    }
                }

                if (Result > Max)
                {
                    Max = Result;
                    Res = Input[i - 1].ToString() + Input[i];
                }
            }

            Console.WriteLine(Res);
        }
    }
}


using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int[] b = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int[] c = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            if (b.Min() < c.Max())
            {
                int ac = a[2] / b.Min();
                a[2] -= ac * b.Min();
                a[2] += ac * c.Max();
            }
            Console.WriteLine(a[2]);
        }
    }
}


// Problem: 1148A - Another One Bites The Dust
// Author: Gusztav Szmolik

using System;

class AnotherOneBitesTheDust
    {
    public static int Main ()
        {
        string line = Console.ReadLine ();
        if (line == null)
            return -1;
        char[] delims = new char[] {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 3)
            return -1;
        uint a;
        if (!UInt32.TryParse (words[0], out a))
            return -1;
        if (a < 1 || a > 1000000000)
            return -1;
        uint b;
        if (!UInt32.TryParse (words[1], out b))
            return -1;
        if (b < 1 || b > 1000000000)
            return -1;
        uint c;
        if (!UInt32.TryParse (words[2], out c))
            return -1;
        if (c < 1 || c > 1000000000)
            return -1;
        uint countAB = c + Math.Min (a,b);
        uint ans = 2*countAB;
        if (a != b)
            ans++;
        Console.WriteLine (ans);
        return 0;
        }
    }


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

class c
{
	public static int[] dp;
	public static void df( int r, int i )
	{
		var id = i-2;
		while( id >= 0 )
		{
			if ( id <= 100 && ( dp[id] < 0 || dp[id] > r ) )
				dp[id] = r;
			id -=4 ;
		}
		while( i >= 0 )
		{
			if( i <= 100 && ( dp[i] < 0 || dp[i] > r ) )
				dp[i] = r;
			i -=4 ;
		}
	}
	public static int Main()
	{
		var x = int.Parse( Console.ReadLine() );
		dp = new int[101];
		for( int i=0; i<101; ++i )
			dp[i] = -1;
		for( int i=1; i<100; i+=2 )
		{
			df( i, i*i/2 );
			df( i, i*i/2+1 );
		}
		dp[0] = 0;
		dp[1] = 1;
		dp[2] = 3;
		dp[3] = 5;
		dp[4] = 3;
		dp[5] = 3;
		Console.WriteLine( dp[x] );
		Console.WriteLine();
		return 0;
	}
}


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

namespace ConsoleApplication1
{
    class Program
    {
        const long mod = 1000000007;
        static long phi(long n)
        {
            if (n == 1)
                return 1;
            long result = n;
            for (long i = 2; i * i <= n; ++i)
                if (n % i == 0)
                {
                    while (n % i == 0)
                        n /= i;
                    result -= result / i;
                }
            if (n > 1)
                result -= result / n;
            return result;
        }

        static void Main()
        {
            string[] token = Console.ReadLine().Split(' ');
            long n = long.Parse(token[0]);
            long k = long.Parse(token[1]);
            long t = 1;
            long ans = n;
            if (k >= n)
            {
                Console.WriteLine(1);
                return;
            }
            else
            {
                if (k >= 71)
                {
                    Console.WriteLine("1");
                    return;
                }
                else
                {
                    while (t <= k)
                    {
                        if (t % 2 == 1)
                        {
                            ans = phi(ans);
                            t++;
                        }
                        else
                        {
                            t++;
                            continue;
                        }
                    }
                }
            }
            Console.WriteLine(ans % mod);
            Console.Read();
        }
    }
}


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

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

namespace _247c
{
	class Program
	{
		static string _inputFilename = "input.txt";
		static string _outputFilename = "output.txt";
#if DEBUG
        static bool _useFileInput = false;
#else
		static bool _useFileInput = false;
#endif

		static void Main(string[] args)
		{
			StreamWriter file = null;
			if (_useFileInput)
			{
				Console.SetIn(File.OpenText(_inputFilename));
				file = new StreamWriter(_outputFilename);
				Console.SetOut(file);
			}

#if DEBUG
			if (!_useFileInput)
			{
				Console.SetIn(getInput());
			}
#endif

			try
			{
				solution();
			}
			finally
			{
				if (_useFileInput)
				{
					file.Close();
				}
			}
		}

		static void solution()
		{
			#region SOLUTION
			var t = readIntArray();
			var n = t[0];
			var k = t[1];
			var d = t[2];

			var maxK = Math.Max(k, n);
			var dp = new long[n + 1, n + 1, 2];
			for (int i = 1; i < n + 1; i++)
			{
				if (k >= i)
				{
					if (i < d)
					{
						dp[1, i, 0] = 1;
						dp[1, i, 1] = 0;
					}
					else
					{
						dp[1, i, 0] = 0;
						dp[1, i, 1] = 1;
					}
				}

				dp[0, i, 0] = 0;
				dp[0, i, 1] = 0;
			}

			for (int i = 1; i < n + 1; i++)
			{
				dp[i, 0, 0] = 0;
				dp[i, 0, 1] = 0;
			}

			dp[0, 0, 0] = 1;
			dp[0, 0, 1] = 0;

			//Console.WriteLine("-- 0 ---");
			//for (int i = 0; i < n + 1; i++)
			//{
			//	for (int j = 0; j < n + 1; j++)
			//	{
			//		Console.Write("{0} ", dp[i, j, 0]);
			//	}
			//	Console.WriteLine();
			//}

			//Console.WriteLine("-- 1 ---");
			//for (int i = 0; i < n + 1; i++)
			//{
			//	for (int j = 0; j < n + 1; j++)
			//	{
			//		Console.Write("{0} ", dp[i, j, 1]);
			//	}
			//	Console.WriteLine();
			//}

			var mod = 1000000007;
			for (int i = 2; i < n + 1; i++)
			{
				for (int j = 1; j < n + 1; j++)
				{
					var mk = Math.Min(j, k);
					dp[i, j, 0] = 0;
					dp[i, j, 1] = 0;
					for (int z = 1; z < mk + 1; z++)
					{
						var rem = j - z;
						if (z < d)
						{
							dp[i, j, 0] += dp[i - 1, rem, 0];
							dp[i, j, 0] %= mod;
							dp[i, j, 1] += dp[i - 1, rem, 1];
							dp[i, j, 1] %= mod;
						}
						else
						{
							dp[i, j, 0] += 0;
							dp[i, j, 1] += (dp[i - 1, rem, 0] + dp[i - 1, rem, 1]);
							dp[i, j, 1] %= mod;
						}
					}
				}
			}

			//Console.WriteLine("-- 0 ---");
			//for (int i = 0; i < n + 1; i++)
			//{
			//	for (int j = 0; j < n + 1; j++)
			//	{
			//		Console.Write("{0} ", dp[i, j, 0]);
			//	}
			//	Console.WriteLine();
			//}

			//Console.WriteLine("-- 1 ---");
			//for (int i = 0; i < n + 1; i++)
			//{
			//	for (int j = 0; j < n + 1; j++)
			//	{
			//		Console.Write("{0} ", dp[i, j, 1]);
			//	}
			//	Console.WriteLine();
			//}

			var res = 0L;
			for (int i = 1; i < n + 1; i++)
			{
				res += dp[i, n, 1];
				res %= mod;
			}

			Console.WriteLine(res);

			//var n = readInt();
			//var m = readInt();

			//var a = readIntArray();
			//var b = readIntArray();
			#endregion
		}

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

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

		static int[] readIntArray()
		{
			return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
		}

		static long[] readLongArray()
		{
			return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
		}

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
	}
}


using System;
using System.Linq;

namespace CSharp
{
    public class _938A
    {
        public static void Main()
        {
            char[] vowels = new char[] { 'a', 'e', 'i', 'o', 'u', 'y' };

            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            Console.WriteLine(new string(Enumerable.Range(0, n).Where(i => i == 0 || !vowels.Contains(s[i]) || !vowels.Contains(s[i - 1])).Select(i => s[i]).ToArray()));
        }
    }
}


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

namespace Archive
{
    public class Test
    {
        public static int A;
        public static int B;
        public static int K;
        public static int M;
        public static int N;
        public static int T;
        public static int S;
        public static int R;
        public static int C;
        public static int H;
        public static int W;
        public static int I;
        public static int J;

        public static void Main(string[] args)
        {
                First();
        }

        private static void First()
        {
            string s = Console.ReadLine();

            int res = 0;
            int now = 0;
            for(int i=1;i<s.Length;i++)
                if (s[i] == s[i - 1])
                    now++;
                else
                {
                    if (now%2 == 1)
                        res++;
                    now = 0;
                }
            if (now % 2 == 1)
                res++;

            Console.WriteLine(res);
        }
    }
}


using System;
class Program
{
    static void Main()
    {
        int[] array = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Array.Sort(array);
        if (array[0] < array[1] + array[2] && array[1] < array[0] + array[2] && array[2] < array[0] + array[1])
            Console.WriteLine(0);
        else Console.WriteLine(array[2]-(array[1]+array[0])+1);
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int length = int.Parse(input[0]);
        int time = int.Parse(input[1]);
        string sequence = Console.ReadLine();

        for (int i = 0; i < time; i++)
        {
            sequence = sequence.Replace("BG", "GB");
        }

        Console.WriteLine(sequence);
    }
}


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

namespace ConsoleApplication10
{
    class Program
    {

       static long go(long n)
        {
            long kk;
            for (kk = n/2; true; kk--)
            {
                long temp = n % kk;
                if (temp == 0)
                    break;
            }
            return kk;
        }
        static void Main(string[] args)
        {
            long n = int.Parse(Console.ReadLine());
            long sum = n;
            while (n > 1)
            {
                long temp;
                temp = go(n);
               n=temp;
               sum += temp;
            }
            Console.WriteLine(sum);

        }
    }
}


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

namespace CodeForces_579A_Raising_Bacteria
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            int y = x;
            int tag = 1;
            while(y/2!=0)
            {
                if (y % 2 == 1)
                    tag++;
                y = y / 2;
            }
            Console.WriteLine(tag);
        }
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        int n = Int32.Parse(Console.ReadLine());
        string stones = Console.ReadLine();
        int baseCount = 0, count=0;
        for (int i = 1; i < n; i++)
        {
            if (stones[i] == stones[baseCount])
                count++;
            else
                baseCount = i;
        }
        Console.WriteLine(count);
    }
}


using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace С_Generation
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            long sum = 0;
            long p = 1;
            while(n>0)
            {
                p *= 2;
                sum += p;
                n--;
            }
            Console.WriteLine(sum);
        }
    }
}


using System;
using System.Linq;

namespace Task_1080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = temp[0], k = temp[1];
            int red = n * 2 % k == 0 ? n * 2 / k : n * 2 / k + 1;
            int green = n * 5 % k == 0 ? n * 5 / k : n * 5 / k + 1;
            int blue = n * 8 % k == 0 ? n * 8 / k : n * 8 / k + 1;
            Console.WriteLine(red + green + blue);

        }
    }
}


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

namespace Q1
{
	class Program
	{
		static void Main ( string[] args )
		{
			// 8, 4, 2, 6
			ulong n = ulong.Parse( Console.ReadLine() );

//			n = (ulong) Math.Pow( 10, 9 );

			double d = Math.Floor( n / 4.0 );
			if ( d > 1 )
				n = 4 + ( n - ( (ulong)d * 4 ) );

			double p = Math.Pow( 8, n );
			string s = p.ToString();
			Console.WriteLine( s[ s.Length - 1 ] );

//			Console.ReadKey();
		}
	}
}


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

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

            var temp = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int a = temp[0];
            int b = temp[1];

            if ((a > 0 || b > 0) &&  Math.Abs(b - a) < 2)
                Console.WriteLine("YES");
            else
	{
                Console.WriteLine("NO");
	}
            Console.ReadLine();

    }

    }
}


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

namespace Magic_Numbers
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            if (s[0] == '4')
            {
                Console.WriteLine("NO");
                return;
            }
            int br4 = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == '4')
                {
                    br4++;
                    if (br4 > 2)
                    {
                        Console.WriteLine("NO");
                        return;
                    }
                }
                else if (s[i] == '1') br4 = 0;
                else
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");
        }
    }
}


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

class cf1
{
    static void Main()
    {
        string strInfo01 = Console.ReadLine();

        long lngNumber = long.Parse(strInfo01.Split()[0]);
        long lngPosition = long.Parse(strInfo01.Split()[1]);
        long lngSquare = (long)Math.Sqrt(lngNumber);

        List<long> lstResults = new List<long>();

        for (long i = 1; i <= lngSquare; i++)
        {
            if (lngNumber % i == 0)
            {
                lstResults.Add(i);
                if (i != lngNumber/i)
                {
                    lstResults.Add(lngNumber / i);
                }
            }
        }

        lstResults.Sort();

        if (lstResults.Count< lngPosition)
        {
            Console.WriteLine(-1);
        }
        else
        {
            Console.WriteLine(lstResults [(int)lngPosition-1]);
        }
    }
}


using System;

// Codeforces problem 599A "Патрик и поход в магазин"
// http://codeforces.com/problemset/problem/599/A
namespace _599_A
{
	class Program
	{
		static void Main(string[] args)
		{
			#region Read data
			string[] tmp = Console.ReadLine().Split();
			int d1 = Convert.ToInt32(tmp[0]);
			int d2 = Convert.ToInt32(tmp[1]);
			int d3 = Convert.ToInt32(tmp[2]);
			#endregion
			#region Process data
			int result = Math.Min(d1 + d2 + d3, Math.Min((d1 + d2) * 2, Math.Min((d1 + d3) * 2, (d2 + d3) * 2)));
			#endregion
			#region Write results
			Console.WriteLine(result);
			Console.ReadLine();
			#endregion
		}
	}
}


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

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {
      var n = input.ReadInt();
      var a = input.ReadIntArray(n);
      var b = input.ReadIntArray(n);
      var ca = new int[5];
      var cb = new int[5];
      for (int i = 0; i < n; i++)
      {
        ca[a[i] - 1]++;
        cb[b[i] - 1]++;
      }
      var cp = 0;
      var cn = 0;
      for (int i = 0; i < 5; i++)
      {
        if ((ca[i] + cb[i]) % 2 != 0)
        {
          Console.Write(-1);
          return;
        }
        var m = ca[i] - Math.Abs(ca[i] + cb[i]) / 2;
        if (m < 0)
        {
          cn += m;
        }
        else
        {
          cp += m;
        }
      }
      if (cp + cn != 0)
      {
        Console.Write(-1);
        return;
      }
      Console.Write(cp);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      bool isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      int result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

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

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

    public int[] ReadIntArray(int n)
    {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public long[] ReadLongArray(int n)
    {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      double[] a = new double[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      int c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}


using System;

class Program{
	static void Main(){
		string[] input = Console.ReadLine().Split();
		int al = int.Parse(input[0]);
		int ar = int.Parse(input[1]);
		input = Console.ReadLine().Split();
		int bl = int.Parse(input[0]);
		int br = int.Parse(input[1]);

		if((br >= al - 1 && br <= (al + 1) * 2) || (bl >= ar - 1 && bl <= (ar + 1) * 2))
			Console.WriteLine("YES");
		else
			Console.WriteLine("NO");
	}
}


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

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

    public void Solve()
    {
        for (int tt = ReadInt(); tt > 0; tt--)
        {
            int n = ReadInt();
            int m = ReadInt();

            long ans = 1;
            for (int i = 0; i < m; i++)
                ans = ans * n % MOD;

            Write(ans);
        }
    }

    #region Main

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

    #endregion

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


using System;
class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, counter = 0;
            {
                string[] input = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                b = int.Parse(input[0]);
                c = a = int.Parse(input[1]);
            }
            {
                int temp = c;
                int strt = a;
                while (a < b)
                {
                    temp = a;
                    a += c;
                    c = temp;
                    counter++;
                }
                a -= a / strt - 1;
                if (a < b) counter++;
            }
            Console.WriteLine(counter + 2);
        }
    }


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

namespace JabberID
{
    class Program
    {
        static void Main(string[] args)
        {
            string id = Console.ReadLine();
            string username = "";
            string hostname = "";
            string resource = " ";
            if (id.Contains("@"))
            {
                username = id.Substring(0, id.IndexOf("@"));
                if (id.IndexOf('/') > id.IndexOf('@'))
                {
                    hostname = id.Substring(id.IndexOf("@") + 1, id.IndexOf("/") - id.IndexOf("@") - 1);
                    resource = id.Substring(id.IndexOf("/") + 1);
                }
                else
                {
                    hostname = id.Substring(id.IndexOf("@") + 1);
                }
            }
            JabberID jabberID = new JabberID()
            {
                Username = username,
                Hostname = hostname,
                Resource = resource

            };
            jabberID.IsJabberID();
        }

    }
    class JabberID
    {
        public string Username
        {
            set; get;
        }
        public string Hostname
        {
            set; get;
        }
        public string Resource
        {
            set; get;
        }
        private bool IsUsername(string username)
        {
            if (username.Length >= 1 && username.Length <= 16)
            {
                for (int i = 0; i < username.Length; i++)
                {
                    char letter = username[i];
                    if (!((letter >= 'a' && letter <= 'z') || (letter >= 'A' && letter <= 'Z') || (letter == '_') || (letter >= '0' && letter <= '9')))
                        return false;
                }
                return true;
            }
            return false;
        }
        private bool IsHostname(string hostname)
        {
            if (hostname.Length < 1 && hostname.Length > 32)
                return false;
            string[] words = hostname.Split('.');
            for (int i = 0; i < words.Length; i++)
            {
                if ((words[i].Length < 1 && words[i].Length > 16) || words[i].Length == 0)
                    return false;
                for (int j = 0; j < words[i].Length; j++)
                {
                    if (!((words[i][j] >= 'a' && words[i][j] <= 'z') || (words[i][j] >= 'A' && words[i][j] <= 'Z') || (words[i][j] == '_') || (words[i][j] >= '0' && words[i][j] <= '9')))
                        return false;
                }

            }
            return true;
        }
        private bool IsResource(string resource)
        {
            if (resource.Length >= 1 && resource.Length <= 16)
            {
                for (int i = 0; i < resource.Length; i++)
                {
                    char letter = resource[i];
                    if (!((letter >= 'a' && letter <= 'z') || (letter >= 'A' && letter <= 'Z') || (letter == '_') || (letter == ' ') || (letter >= '0' && letter <= '9')))
                        return false;
                }
                return true;
            }
            return false;
        }
        public void IsJabberID()
        {
            if (IsUsername(Username) && IsHostname(Hostname) && IsResource(Resource))
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}


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

namespace Examples
{
    class Program
    {

        static void Main(String[] args)
        {

            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            IEnumerable<char> s1Rev = s1.Reverse();
            string c = string.Concat(s1Rev);

            if (c == s2) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }

    }

}


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

namespace Testonly
{
    class Program
    {
        static void Main(string[] args)
        {
            int len = Convert.ToInt32(Console.ReadLine());
            string[] strarr;
            long[] nums = new long[len];

            strarr = Console.ReadLine().Split(' ');
            for (int i = 0; i < len; i++)
                nums[i] = Convert.ToInt64(strarr[i]);
            nums = nums.Distinct().ToArray();
            Array.Sort(nums);
            if (nums.Length > 3)
                Console.WriteLine("-1");
            else if (nums.Length == 2)
            {
                if ((nums[0] + nums[1]) % 2 == 0)
                    Console.WriteLine((nums[1] - nums[0]) / 2);
                else
                    Console.WriteLine(nums[1] - nums[0]);
            }
            else if (nums.Length == 1)
                Console.WriteLine("0");
            else
            {
                for (int i = 0; i < nums[2] - nums[0]; i++)
                {
                    if (nums[0] + i == nums[1] && nums[2] - i == nums[1])
                    {
                        Console.WriteLine(i);
                        //Console.ReadLine();
                        return;
                    }
                }
                Console.WriteLine("-1");
            }
            //Console.ReadLine();
        }
    }
}


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

namespace csharp_project
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split();
            var n = Convert.ToInt32(input[0]);
            var m = Convert.ToInt32(input[1]);
            var ct = 0;
            while (n<=m)
            {

                n *= 3;
                m *= 2;
                ct++;
            }
            Console.WriteLine(ct);
        }
    }
}


using System;
using System.Linq;

namespace _900____A1008___Romanji
{
    class Program
    {
        private static bool IsVowel(char ch)
        {
            if (ch =='a' || ch == 'o' || ch == 'u' || ch == 'i' || ch == 'e')
            {
                return true;
            }
            return false;
        }
        static void Main(string[] args)
        {

            var word = Console.ReadLine();
            //var vowels = new char[] { 'a', 'o', 'u', 'i', 'e' };
            bool answer = true;

            for (int i = 0; i < word.Length; i++)
            {
                var currentChar = word[i];

                bool isCurConsonant = !IsVowel(currentChar);

                if (currentChar == 'n' || !isCurConsonant)
                {
                    continue;
                }

                if (i + 1 >= word.Length || !IsVowel(word[i + 1]))
                {
                    answer = false;
                    break;
                }

            }

            Console.WriteLine(answer == true ? "YES" : "NO");
        }
    }
}


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

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

        private static void Solve(string[] args)
        {
            int n = Next();
            int k = Next();

            var l = new int[k];
            var r = new int[k];
            for (int i = 0; i < k; i++)
            {
                l[i] = Next();
                r[i] = Next();
            }

            List<Interval>[] dp;
            dp = new List<Interval>[2*k + 1];

            for (int i = 0; i < dp.Length; i++)
            {
                dp[i] = new List<Interval>();
            }
            dp[0].Add(new Interval(0, 0));

            int prev = 0;
            for (int i = 0; i < k; i++)
            {
                var next = new List<Interval>[dp.Length];
                for (int ii = 0; ii < dp.Length; ii++)
                {
                    next[ii] = new List<Interval>();
                }

                int delta = l[i] - prev;
                for (int index = 0; index < dp.Length; index++)
                {
                    if (index%2 == 0)
                    {
                        List<Interval> t = dp[index];
                        foreach (Interval interval in t)
                        {
                            interval.l += delta;
                            interval.r += delta;
                        }
                    }
                }
                delta = r[i] - l[i];
                for (int ii = 0; ii < dp.Length; ii++)
                {
                    if (ii%2 == 0)
                    {
                        foreach (Interval interval in dp[ii])
                        {
                            next[ii].Add(new Interval(interval.l + delta, interval.r + delta));
                            next[ii + 1].Add(new Interval(interval.l, interval.r + delta));
                            next[ii + 2].Add(new Interval(interval.l, interval.r + delta));
                        }
                    }
                    else
                    {
                        foreach (Interval interval in dp[ii])
                        {
                            next[ii].Add(new Interval(interval.l, interval.r));
                            next[ii + 1].Add(new Interval(interval.l, interval.r + delta));
                            next[ii + 2].Add(new Interval(interval.l, interval.r + delta));
                        }
                    }
                }

                prev = r[i];
                for (int index = 0; index < dp.Length; index++)
                {
                    dp[index].Clear();

                    Interval pr = null;
                    foreach (Interval interval in next[index].OrderBy(t => t.l))
                    {
                        if (interval.l > n)
                            break;
                        if (pr != null && pr.r >= interval.l)
                        {
                            pr.r = Math.Max(pr.r, interval.r);
                        }
                        else
                        {
                            if (pr != null && !Find(dp, pr, index))
                                dp[index].Add(pr);
                            pr = interval;
                        }
                    }
                    if (pr != null && !Find(dp, pr, index))
                        dp[index].Add(pr);
                }
            }

            {
                int delta = 2*n - prev;
                for (int index = 0; index < dp.Length; index++)
                {
                    if (index%2 == 0)
                    {
                        List<Interval> t = dp[index];
                        foreach (Interval interval in t)
                        {
                            interval.l += delta;
                            interval.r += delta;
                        }
                    }
                }
            }

            for (int i = 0; i < dp.Length; i++)
            {
                foreach (Interval interval in dp[i])
                {
                    if (interval.l <= n && interval.r >= n)
                    {
                        writer.WriteLine("Full");
                        writer.WriteLine(i);
                        return;
                    }
                }
            }

            writer.WriteLine("Hungry");
        }

        private static bool Find(List<Interval>[] dp, Interval value, int index)
        {
            for (int i = index - 2; i >= 0; i--)
            {
                int ind = dp[i].BinarySearch(value, value);
                if (ind < 0)
                {
                    ind = (~ind) - 1;
                    if (ind > 0 && dp[i][ind].r >= value.r)
                    {
                        return true;
                    }
                }
                else
                {
                    if (dp[i][ind].r >= value.r)
                        return true;
                }
            }

            return false;
        }

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

        #region Nested type: Interval

        private class Interval : IComparer<Interval>
        {
            public int l, r;

            public Interval(int l, int r)
            {
                this.l = l;
                this.r = r;
            }

            #region IComparer<Interval> Members

            public int Compare(Interval x, Interval y)
            {
                return x.l.CompareTo(y.l);
            }

            #endregion
        }

        #endregion
    }
}


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

#region ioh

class Scanner
{
    private readonly TextReader reader;
    private string[] buffer;
    private int bufferPos;

    public Scanner()
        : this(null)
    { }

    public Scanner(TextReader reader)
    {
        this.reader = reader ?? Console.In;
        buffer = new string[0];
    }

    public string NextTerm()
    {
        if (bufferPos >= buffer.Length)
        {
            buffer = reader.ReadLine().Split(' ');
            bufferPos = 0;
        }

        return buffer[bufferPos++];
    }

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

    public int[] NextIntArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    }

    public int[][] NextIntMatrix(int rowCount)
    {
        var matrix = new int[rowCount][];

        for (int i = 0; i < matrix.Length; i++)
        {
            matrix[i] = NextIntArray();
        }

        return matrix;
    }
}

#endregion

class Program
{
    private static readonly Scanner s = new Scanner();

    static void Main(string[] args)
    {
        var s = Console.ReadLine();

        var fc = 0;
        var sc = 0;

        foreach (var c in s)
        {
            if (c == '4') fc++;
            else if (c == '7') sc++;
        }

        if (fc == 0 && sc == 0)
        {
            Console.WriteLine(-1);
        }
        else if (fc >= sc)
        {
            Console.WriteLine("4");
        }
        else
        {
            Console.WriteLine("7");
        }
    }
}


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.txt"));
            char[][] inp = new char[4][];
            for (int i = 0; i < 4; i++) {
                inp[i] = Console.ReadLine().ToCharArray();
            }
            int[,] m = new int[3, 3];
            bool sol = false;
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    if (inp[i][j] == '#') {
                        m[i, j]++;
                    }
                    if (inp[i + 1][j] == '#') {
                        m[i, j]++;
                    }
                    if (inp[i][j + 1] == '#') {
                        m[i, j]++;
                    }
                    if (inp[i + 1][j + 1] == '#') {
                        m[i, j]++;
                    }
                    if (m[i, j] != 2) {
                        sol = true;
                    }
                }
            }
            if (sol) {
                Console.Write("YES");
            } else {
                Console.Write("NO");
            }
            //Console.ReadKey();
        }
    }
}


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

namespace codeforces
{
    class C
    {
        static CodeforcesUtils CF = new CodeforcesUtils(
@"
5000
");

        static void Main(string[] args)
        {
            int A = int.Parse(CF.ReadLine());

            int sum = 0;
            for (int a = 2; a <= A - 1; a++)
            {
                List<int> ds = _b(A, a);
                foreach (int d in ds)
                    sum += d;
            }

            int x = sum;
            int y = A - 2;
            for (int i = y; i>=2; i--)
            {
                if ((x % i) == 0 && (y % i) == 0)
                {
                    x /= i;
                    y /= i;
                }
            }

            CF.WriteLine(x+"/"+y);
        }

        static List<int> _b(int a, int b)
        {
            List<int> ds = new List<int>();
            for (; ; )
            {
                int d = a % b;
                ds.Add(d);
                a /= b;
                if (a == 0)
                    break;
            }
            return ds;
        }

        #region test

        class CodeforcesUtils
        {
            public string ReadLine()
            {
#if DEBUG
                if (_lines == null)
                {
                    _lines = new List<string>();
                    string[] ss = _test_input.Replace("\n", "").Split('\r');
                    for (int i = 0; i < ss.Length; i++)
                    {
                        if (
                            (i == 0 || i == ss.Length - 1) &&
                            ss[i].Length == 0
                            )
                            continue;

                        _lines.Add(ss[i]);
                    }
                }

                string s = null;
                if (_lines.Count > 0)
                {
                    s = _lines[0];
                    _lines.RemoveAt(0);
                }
                return s;
#else
            return Console.In.ReadLine();
#endif
            }

            public void WriteLine(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.WriteLine(o);
#else
            Console.WriteLine(o);
#endif
            }

            public void Write(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.Write(o);
#else
            Console.Write(o);
#endif
            }

            public CodeforcesUtils(string test_input)
            {
                _test_input = test_input;
            }

            string _test_input;

            List<string> _lines;
        }

        #endregion
    }
}


using System;
using System.Linq;

namespace _1114
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] xyz = Console.ReadLine().Trim().Split(' ').Select(Int32.Parse).ToArray();
            int[] abc = Console.ReadLine().Trim().Split(' ').Select(Int32.Parse).ToArray();

            abc[0] -= xyz[0];
            if (abc[0] >= 0) {
                int ab = abc[0] + abc[1];
                ab -= xyz[1];
                if (ab >= 0){
                    int left = ab + abc[2];
                    left -= xyz[2];
                    if (left >= 0){
                        Console.WriteLine("YES");
                        return;
                    }
                }
            }
            Console.WriteLine("NO");
        }
    }
}


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var a = sc.Integer();
            var b = sc.Integer();
            var c = sc.Integer();
            var d = sc.Integer();
            var p = Math.Max(3 * a / 10, a - a * c / 250);
            var q = Math.Max(3 * b / 10, b - b * d / 250);
            if (p > q)
                IO.Printer.Out.WriteLine("Misha");
            else if (p == q)
                IO.Printer.Out.WriteLine("Tie");
            else IO.Printer.Out.WriteLine("Vasya");
        }

        internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
    }
}

#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Linq;
    public class Printer : StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
            Error = new Printer(System.IO.Stream.Null);
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
        public void Flush() { str.Flush(); }

    }
}
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion


using System;

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

            for (var i = 0; i < n; i++)
            {
                if (Test2(Int32.Parse(Console.ReadLine())))
                {
                    Console.WriteLine("YES");
                }
                else Console.WriteLine("NO");
            }

            //for (int i = 1; i <= 100; i++)
            //{
            //    if (Test2(i))
            //    {
            //        Console.WriteLine($"{i} --- YES");
            //    }
            //    else Console.WriteLine($"{i} --- NO");
            //}

        }

        private static bool Test2(int x)
        {
            for (int i = 0; i <= x/7; i++)
            {
                int ipart = i * 7;
                if (ipart > x) break;

                for (var j = 0; j <= x/3; j++)
                {
                    var n = ipart + j * 3;
                    if (n == x) return true;
                    if (n > x) break;
                }
            }

            return false;
        }
    }
}


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

namespace GoogleCodeJam
{
    class codeForces4
    {
        public static void Main(string[] args)
        {
            long ip;
            long ans = 1;

            ip = long.Parse(Console.ReadLine());

            long i = 0;
            long temp = 0;
            while (temp < ip)
            {
                i++;
                temp = temp + i;

            }

            ans = ip - (temp - i);

            Console.WriteLine(ans);

        }
    }
}


using System;
class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long result = n;
            result += (((n * n - n) / 2L) * n);
            result -= ((n * n - n) * (2 * n - 1L) / 6L);
            Console.WriteLine(result);
        }
    }


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

class Tree
{
    public int Index;

    public Tree Left;
    public Tree Right;

    public int Price;

    public void RecalcPrice()
    {
        if(Left != null && Right != null)
        {
            var min = Math.Min(Left.Price, Right.Price);
            Left.Price -= min;
            Right.Price -= min;

            Price += min;
        }
    }

    public long CalcPrice()
    {
        long res = 0;

        if (Left != null && Right != null)
        {
            res += Left.CalcPrice();
            res += Right.CalcPrice();

            RecalcPrice();
            res += Math.Max(Left.Price, Right.Price);
            Price += Math.Max(Left.Price, Right.Price);

            Left.Price = Right.Price = 0;
        }

        return res;
    }
    public void Build(int h)
    {
        if (h == 0) return;

        Left = new Tree();
        Right = new Tree();

        Left.Build(h - 1);
        Right.Build(h - 1);
    }
    public void CalcIndex(Tree[] output)
    {
        var index = 0;

        Queue<Tree> q = new Queue<Tree>();
        q.Enqueue(this);

        while(q.Count > 0)
        {
            var t = q.Dequeue();
            t.Index = index++;
            output[t.Index] = t;

            if (t.Left != null) q.Enqueue(t.Left);
            if (t.Right != null) q.Enqueue(t.Right);
        }
    }
}
static class Program
{
    #region IO
    public delegate ReadDelegate<T> ReadDelegate<T>(out T value);
    public delegate bool ParserDelegate<T>(string word, out T item);

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

        public TextReader TextReader { get; private set; }

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

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

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

        static EventHandler emptyHandler;

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

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

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

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

            CanRead = true;
        }

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

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

            Clear();

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

            line = s;
            return true;
        }

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

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

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

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

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

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

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

            string s = ReadWord(false);

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

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

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

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

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

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

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

            return res;
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    static long Calc(long a, long b)
    {
        if (a < b)
        {
            return Calc(b, a);
        }
        if (a == 0 || b == 0) return 0;

        var res = a / b;
        return res + Calc(b, a % b);
    }
    static void Main()
    {
        var a = cin.ReadInt64();
        var b = cin.ReadInt64();

        var res = Calc(a, b);

        cout.WriteLine(res);
    }
}


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

namespace Codeforces
{
    class Program
    {
        static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static void ReadIntArray(out int[] array, char separator = ' ')
        {
            var input = Console.ReadLine().Split(separator);
            array = new int[input.Length];
            for (int i = 0; i < input.Length; i++)
            {
                array[i] = Int32.Parse(input[i]);
            }

        }
        static int ReadNextInt(string input, int index)
        {
            var ints = input.Split(' ');
            return Int32.Parse(ints[index]);
        }
        static List<long> lucks = new List<long>();
        static void Main()
        {
            var input = Console.ReadLine();
            var l = ReadNextInt(input, 0);
            var r = ReadNextInt(input, 1);

            long res = 0;

            NextLucks(0, r);

            lucks.Sort();
            int indexLuck = 0;
            for (int i = 0; i < lucks.Count; i++)
            {
                if(lucks[i] >= l)
                {
                    indexLuck = i;
                    break;
                }
            }

            for (long i = l; i <= r; i++)
            {
                var last = Math.Min(lucks[indexLuck], r);
                res += (long)lucks[indexLuck++] * (last - i + 1);
                i = last;
            }

            Console.WriteLine(res);
        }

        private static void NextLucks(long luck, int max)
        {
            if(luck >= max)
                return;
            lucks.Add(luck * 10 + 4);
            NextLucks(luck * 10 + 4, max);
            lucks.Add(luck*10 + 7);
            NextLucks(luck*10 + 7, max);
        }
    }
}


using System;
using System.Linq;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] nxy = Console.ReadLine().Split().Select(x => Convert.ToDouble(x)).ToArray();
            double People = (nxy[0] * (nxy[2] / 100));
            People = People - nxy[1];
            Console.WriteLine(People > 0 ? Math.Ceiling(People):0);
        }
    }
}


using System;

namespace homes
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int count = Int32.Parse(str.Split(' ')[0]);
            int number = Int32.Parse(str.Split(' ')[1]);
            int sec = 1;
            if(number % 2 == 0)
            {
                for(int i = count; i != number; i-=2)
                {
                    sec++;
                }
            }
            else
            {
                for (int i = 1; i != number; i+=2)
                {
                    sec++;
                }
            }
            Console.WriteLine(sec);

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		long M = GetLong();

		long[] f = new long[N + 1];
		f[0] = 1;
		f[1] = 1;
		for(long i = 2; i <= N; i++)
			f[i] = (f[i - 1] * i) % M;

		long ans = 0;
		for(long len = 1; len <= N; len++)
		{
			long cut = N - len + 1;
			ans = (ans + (((cut * f[len]) % M) * f[cut]) % M) % M;
		}

		WriteLine(ans);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}


namespace o
{
    using System;

    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            long kol = long.Parse(str[0]);
            long pos = long.Parse(str[1]) - 1;
            long counter = 0;
            if (pos > (kol - 1) / 2)
            {
                pos -= (kol - 1) / 2;
                counter = 2 * pos;
            }
            else
            {
                counter = 1 + 2 * pos;
            }
            Console.WriteLine(counter);
        }
    }
}