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

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

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

            if (n == 0)
            {
                writer.Write("YES\n1\n1\n3\n3");
                writer.Flush();
                return;
            }

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }

            Array.Sort(nn);

            if (n == 1)
            {
                writer.WriteLine("YES");
                writer.WriteLine(nn[0]);
                writer.WriteLine(nn[0]*3);
                writer.WriteLine(nn[0]*3);
            }
            else if (n == 2)
            {
                if (nn[0]*3 == nn[1])
                {
                    writer.WriteLine("YES");
                    writer.WriteLine(nn[0]);
                    writer.WriteLine(nn[0]*3);
                }
                else if (nn[0]*3 > nn[1])
                {
                    writer.WriteLine("YES");
                    writer.WriteLine(nn[0]*4 - nn[1]);
                    writer.WriteLine(nn[0]*3);
                }
                else
                {
                    writer.WriteLine("NO");
                }
            }
            else if (n == 3)
            {
                if (nn[0]*3 == nn[2])
                {
                    writer.WriteLine("YES");
                    writer.WriteLine(nn[0]*4 - nn[1]);
                }
                else if (nn[0]*3 > nn[2])
                {
                    if (4*nn[0] == nn[1] + nn[2])
                    {
                        writer.WriteLine("YES");
                        writer.WriteLine(nn[0]*3);
                    }
                    else if (nn[2]%3 == 0 && 4*nn[2]/3 == nn[0] + nn[1])
                    {
                        writer.WriteLine("YES");
                        writer.WriteLine(nn[2]/3);
                    }
                    else
                    {
                        writer.WriteLine("NO");
                    }
                }
                else
                {
                    writer.WriteLine("NO");
                }
            }
            else
            {
                writer.WriteLine(nn[0]*3 == nn[3] && (nn[0] + nn[3] == nn[1] + nn[2]) ? "YES" : "NO");
            }

            writer.Flush();
        }

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


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

namespace c1cs
{
    class Program
    {
        static void Main()
        {
            int ans = 0;
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            int m = int.Parse(ss[1]);
            if (n > m)
            {
                int a = n;
                n = m;
                m = a;
            }
            if (n == 1) ans = ((m - 1) / 3 + 1);
            if (n == 2) ans = m / 2 + 1;
            if (n == 3)
            {
                if (m < 5) ans = m;
                else
                {
                    int mo = (m - 5) / 4 + 1;
                    ans = m - mo;
                }
            }
            if (n == 4)
            {
                   if (m % 2 == 0) ans = m;
                   else ans = m + 1;
                   if (m == 6) ans = 7;
                   if (m == 7) ans = 7;
            }
            if (n == 5)
            {
                if (m == 5) ans = 7;
                if (m == 6) ans = 8;
                if (m == 7) ans = 9;
                if (m == 8) ans = 11;
            }
            if (n == 6) ans = (10);
            Console.WriteLine(n * m - ans);
        }
    }
}


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

namespace CodeForces
{
	class A
	{
		Scanner In = new Scanner();
		TextWriter Out = Console.Out;

		private void Solve()
		{
			var n = In.NextInt();
			if ( n == 1 )
			{
				Out.WriteLine( 0 );
				return;
			}
			var lst = new List<int>();
			var res = int.MaxValue;
			for ( var i = 1; i < n; ++i )
			{
				lst.Add( i );
				var x = i;
				var cur = 0;
				var y = n;
				while ( x > 0 && y > 0 )
				{
					if ( x > y )
					{
						cur += x / y;
						x %= y;
					}
					else
					{
						cur += y / x;
						y %= x;
					}
				}
				if ( x + y == 1 )
					res = Math.Min( res, cur );
			}

			Out.WriteLine( res - 1 );
		}

		#region Local wireup

		void Start()
		{
#if !ONLINE_JUDGE
			Stopwatch timer = new Stopwatch();
			timer.Start();
#endif
			Thread t = new Thread( Solve, 20000000 );
			t.Start();
			t.Join();
#if !ONLINE_JUDGE
			timer.Stop();
			Console.WriteLine( string.Format( "Done in {0} seconds.\nPress <Enter> to exit.", timer.ElapsedMilliseconds / 1000.0 ) );
			Console.ReadLine();
#endif
		}

		static void Main( string[] args )
		{
			new A().Start();
		}

		class Scanner : IDisposable
		{
			#region Fields

			TextReader _reader;
			int _bufferSize;
			bool _closeReader;
			char[] _buffer;
			int _length, _pos;

			#endregion

			#region .ctors

			public Scanner( TextReader reader, int bufferSize, bool closeReader )
			{
				_reader = reader;
				_bufferSize = bufferSize;
				_closeReader = closeReader;
				_buffer = new char[_bufferSize];
				FillBuffer( false );
			}

			public Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }

			public Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }

#if ONLINE_JUDGE
			public Scanner() : this( Console.In, false ) { }
#else
			public Scanner() : this( "input.txt" ) { }
#endif

			#endregion

			#region IDisposable Members

			public void Dispose()
			{
				if ( _closeReader )
				{
					_reader.Close();
				}
			}

			#endregion

			#region Properties

			public bool Eof
			{
				get
				{
					if ( _pos < _length ) return false;
					FillBuffer( false );
					return _pos >= _length;
				}
			}

			#endregion

			#region Methods

			private char NextChar()
			{
				if ( _pos < _length ) return _buffer[_pos++];
				FillBuffer( true );
				return _buffer[_pos++];
			}

			private char PeekNextChar()
			{
				if ( _pos < _length ) return _buffer[_pos];
				FillBuffer( true );
				return _buffer[_pos];
			}

			private void FillBuffer( bool throwOnEof )
			{
				_length = _reader.Read( _buffer, 0, _bufferSize );
				if ( throwOnEof && Eof )
				{
					throw new IOException( "Can't read beyond the end of file" );
				}
				_pos = 0;
			}

			public int NextInt()
			{
				var neg = false;
				int res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public long NextLong()
			{
				var neg = false;
				long res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public string NextLine()
			{
				SkipUntilNextLine();
				if ( Eof ) return "";
				var builder = new StringBuilder();
				while ( !Eof && !IsEndOfLine( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return builder.ToString();
			}

			public double NextDouble()
			{
				SkipWhitespaces();
				var builder = new StringBuilder();
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return double.Parse( builder.ToString(), CultureInfo.InvariantCulture );
			}

			private void SkipWhitespaces()
			{
				while ( !Eof && IsWhitespace( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private void SkipUntilNextLine()
			{
				while ( !Eof && IsEndOfLine( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private static bool IsWhitespace( char c )
			{
				return c == ' ' || c == '\t' || c == '\n' || c == '\r';
			}

			private static bool IsEndOfLine( char c )
			{
				return c == '\n' || c == '\r';
			}

			#endregion
		}

		#endregion
	}
}


using System;

namespace Test
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            string wall = Console.ReadLine ();
            int k = 0, i = 0;
            while (i < wall.Length) {
                char curr = wall[i];
                int j = i;
                while(j < wall.Length && wall[j] == curr && j - i < 5)
                    j++;
                i = j;
                k++;
            }
            Console.Write (k);
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());
            var n = 0;
            while (x > 0)
            {
                var log = (int) Math.Log(x, 2);
                var newX = (int) Math.Pow(2, log);
                x = x - newX;
                n++;
            }
            Console.WriteLine(n);
            //Console.ReadLine();
        }
    }
}


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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = new string[3];
            for (int i = 0; i < 3;i++)
            {
                s[i] = Console.ReadLine();
            }
            SolveProblem(s);
            Console.ReadLine();

        }

        static void SolveProblem(string [] s)
        {
            Dictionary<char, int> coins = new Dictionary<char, int>();
            coins.Add('A',0);
            coins.Add('B', 0);
            coins.Add('C', 0);

            for (int i = 0; i < s.Length;i++)
            {
                switch (s [i] [1])
                {
                    case '>':
                        coins[s[i][0]] += 1;
                        break;
                    case '<':
                        coins[s[i][2]] += 1;
                        break;

                }
            }

            if (coins ['A'] == coins ['B'] && coins['B'] == coins['C'])
            {
                Console.WriteLine("Impossible");

            } else
            {
                var items = from pair in coins
                            orderby pair.Value ascending
                            select pair;
                foreach (KeyValuePair <char, int> pair in items)
                {
                    Console.Write(pair.Key);
                }
            }
        }

    }

}


using System;
using System.Linq;
using CompLib.Util;
using System.Threading;
using CompLib.Mathematics;
using CompLib.String;

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

        int cnt = 0;
        int min = 0;
        foreach (var c in S)
        {
            if (c == '(') cnt++;
            else cnt--;
            min = Math.Min(min, cnt);
        }
        /*
         * Sを部分文字列に含むカッコ列の個数
         */

        // iで間違えたときどこに飛ぶか?
        int[] next = new int[S.Length];
        for (int i = 0; i < S.Length; i++)
        {
            if (i == 0)
            {
                next[i] = 0;
                continue;
            }

            bool f2 = false;
            for (int len = i; len >= 1; len--)
            {
                bool f = true;
                for (int j = 0; f && j < len - 1; j++)
                {
                    f &= S[j] == S[i - len + 1 + j];
                }
                if (!f) continue;
                if (S[len - 1] != S[i])
                {
                    next[i] = len;
                    f2 = true;
                    break;
                }
            }

        }

        // i文字目まで作る、カウンタ、Sより前、Sより後, Sの何文字までできたか?
        var dp = new ModInt[2 * N + 1, N + 1, S.Length, 2];
        dp[0, 0, 0, 0] = 1;
        for (int i = 0; i < 2 * N; i++)
        {
            for (int j = 0; j <= N; j++)
            {
                for (int k = 0; k < S.Length; k++)
                {
                    // (
                    if (j + 1 <= N)
                    {
                        if (S[k] == '(')
                        {
                            if (k + 1 == S.Length)
                            {
                                dp[i + 1, j + 1, 0, 1] += dp[i, j, k, 0];
                            }
                            else
                            {
                                dp[i + 1, j + 1, k + 1, 0] += dp[i, j, k, 0];
                            }
                        }
                        else
                        {
                            // どこに飛ぶ
                            dp[i + 1, j + 1, next[k], 0] += dp[i, j, k, 0];
                        }

                    }

                    if (j - 1 >= 0)
                    {
                        if (S[k] == ')')
                        {
                            if (k + 1 == S.Length)
                            {
                                dp[i + 1, j - 1, 0, 1] += dp[i, j, k, 0];
                            }
                            else
                            {
                                dp[i + 1, j - 1, k + 1, 0] += dp[i, j, k, 0];
                            }
                        }
                        else
                        {
                            dp[i + 1, j - 1, next[k], 0] += dp[i, j, k, 0];
                        }

                    }
                }

                if (j + 1 <= N)
                {
                    dp[i + 1, j + 1, 0, 1] += dp[i, j, 0, 1];
                }
                if (j - 1 >= 0)
                {
                    dp[i + 1, j - 1, 0, 1] += dp[i, j, 0, 1];
                }
            }
        }

        Console.WriteLine(dp[2 * N, 0, 0, 1]);
    }

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

namespace CompLib.String
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    public static partial class StringACL
    {
        private const int ThresholdNative = 10;
        private const int ThresholdDoubling = 40;

        #region SuffixArray
        public static int[] SuffixArray(int[] s, int upper)
        {
            Debug.Assert(0 <= upper);

            // C++みたいに内部で何もしないループをスキップするのか?
            // してくれるなら #ifいらない
#if DEBUG
            foreach (var d in s)
            {
                Debug.Assert(0 <= d && d <= upper);
            }
#endif
            return SAIS(s, upper);
        }

        public static int[] SuffixArray<T>(T[] s, Comparison<T> cmp)
        {
            int n = s.Length;
            int[] idx = new int[n];
            for (int i = 0; i < n; i++)
            {
                idx[i] = i;
            }

            Array.Sort(idx, (l, r) => cmp(s[l], s[r]));

            int[] s2 = new int[n];
            int now = 0;
            for (int i = 0; i < n; i++)
            {
                if (0 < i && cmp(s[idx[i - 1]], s[idx[i]]) != 0) now++;
                s2[idx[i]] = now;
            }

            return SAIS(s2, now);
        }
        public static int[] SuffixArray<T>(T[] s)
        {
            return SuffixArray(s, Comparer<T>.Default.Compare);
        }

        /// <summary>
        /// 長さnの文字列のsuffixArrayを返す
        /// </summary>
        /// <remarks>
        /// <para>{0,1,2,...,n-1}の順列、s[sa[i],n) < s[sa[i+1],n)</para>
        /// <para>suffixArrayの辞書順</para>
        /// </remarks>
        /// <param name="s"></param>
        /// <returns></returns>
        public static int[] SuffixArray(string s)
        {
            int n = s.Length;
            int[] s2 = new int[n];
            for (int i = 0; i < n; i++)
            {
                s2[i] = s[i];
            }
            return SAIS(s2, 255);
        }

        // O(n^2)
        private static int[] SANative(int[] s)
        {
            int n = s.Length;
            int[] sa = new int[n];
            for (int i = 0; i < n; i++)
            {
                sa[i] = i;
            }
            Array.Sort(sa, (l, r) =>
             {
                 // 同じなら0
                 if (l == r) return 0;
                 // 順番に見る
                 while (l < n && r < n)
                 {

                     if (s[l] != s[r]) return s[l].CompareTo(s[r]);
                     l++;
                     r++;
                 }

                 // indexが大きい方が辞書順で小さい
                 return r.CompareTo(l);
             });
            return sa;
        }
        private static int[] SADoubling(int[] s)
        {
            int n = s.Length;
            int[] sa = new int[n];
            int[] rnk = new int[n];
            int[] tmp = new int[n];
            Array.Copy(s, rnk, n);
            for (int i = 0; i < n; i++)
            {
                sa[i] = i;
            }

            for (int k = 1; k < n; k *= 2)
            {
                Comparison<int> cmp = (int x, int y) =>
                {
                    if (rnk[x] != rnk[y]) return rnk[x].CompareTo(rnk[y]);
                    int rx = x + k < n ? rnk[x + k] : -1;
                    int ry = y + k < n ? rnk[y + k] : -1;
                    return rx.CompareTo(ry);
                };

                Array.Sort(sa, cmp);
                tmp[sa[0]] = 0;
                for (int i = 1; i < n; i++)
                {
                    tmp[sa[i]] = tmp[sa[i - 1]] + (cmp(sa[i - 1], sa[i]) < 0 ? 1 : 0);
                }

                var t = tmp;
                tmp = rnk;
                rnk = t;
            }

            return sa;
        }

        private static int[] SAIS(int[] s, int upper)
        {
            int n = s.Length;
            if (n == 0) return new int[0];
            if (n == 1) return new int[1];
            if (n == 2)
            {
                if (s[0] < s[1])
                {
                    return new int[] { 0, 1 };
                }
                else
                {
                    return new int[] { 1, 0 };
                }
            }

            if (n < ThresholdNative)
            {
                return SANative(s);
            }

            if (n < ThresholdDoubling)
            {
                return SADoubling(s);
            }

            int[] sa = new int[n];
            bool[] ls = new bool[n];

            for (int i = n - 2; i >= 0; i--)
            {
                ls[i] = (s[i] == s[i + 1]) ? ls[i + 1] : (s[i] < s[i + 1]);
            }

            int[] sumL = new int[upper + 1];
            int[] sumS = new int[upper + 1];

            for (int i = 0; i < n; i++)
            {
                if (!ls[i])
                {
                    sumS[s[i]]++;
                }
                else
                {
                    sumL[s[i] + 1]++;
                }
            }

            for (int i = 0; i <= upper; i++)
            {
                sumS[i] += sumL[i];
                if (i < upper) sumL[i + 1] += sumS[i];
            }

            Action<List<int>> induce = (List<int> lms) =>
          {
              for (int i = 0; i < n; i++)
              {
                  sa[i] = -1;
              }

              int[] buf = new int[upper + 1];
              Array.Copy(sumS, buf, upper + 1);

              foreach (var d in lms)
              {
                  if (d == n) continue;
                  sa[buf[s[d]]++] = d;
              }

              Array.Copy(sumL, buf, upper + 1);
              sa[buf[s[n - 1]]++] = n - 1;
              for (int i = 0; i < n; i++)
              {
                  int v = sa[i];
                  if (v >= 1 && !ls[v - 1])
                  {
                      sa[buf[s[v - 1]]++] = v - 1;
                  }
              }

              Array.Copy(sumL, buf, upper + 1);

              for (int i = n - 1; i >= 0; i--)
              {
                  int v = sa[i];
                  if (v >= 1 && ls[v - 1])
                  {
                      sa[--buf[s[v - 1] + 1]] = v - 1;
                  }
              }
          };

            int[] lmsMap = new int[n + 1];
            for (int i = 0; i <= n; i++)
            {
                lmsMap[i] = -1;
            }

            int m = 0;
            for (int i = 1; i < n; i++)
            {
                if (!ls[i - 1] && ls[i])
                {
                    lmsMap[i] = m++;
                }
            }

            List<int> lmsL = new List<int>(m);
            for (int i = 1; i < n; i++)
            {
                if (!ls[i - 1] && ls[i])
                {
                    lmsL.Add(i);
                }
            }

            induce(lmsL);

            if (m != 0)
            {
                List<int> sortedLms = new List<int>(m);
                foreach (var v in sa)
                {
                    if (lmsMap[v] != -1) sortedLms.Add(v);
                }

                int[] recS = new int[m];

                int recUpper = 0;
                recS[lmsMap[sortedLms[0]]] = 0;
                for (int i = 1; i < m; i++)
                {
                    int l = sortedLms[i - 1], r = sortedLms[i];
                    int endL = (lmsMap[l] + 1 < m) ? lmsL[lmsMap[l] + 1] : n;
                    int endR = (lmsMap[r] + 1 < m) ? lmsL[lmsMap[r] + 1] : n;

                    bool same = true;

                    if (endL - l != endR - r)
                    {
                        same = false;
                    }
                    else
                    {
                        while (l < endL)
                        {
                            if (s[l] != s[r])
                            {
                                break;
                            }
                            l++;
                            r++;
                        }

                        if (l == n || s[l] != s[r]) same = false;
                    }

                    if (!same) recUpper++;
                    recS[lmsMap[sortedLms[i]]] = recUpper;
                }

                var recSa = SAIS(recS, recUpper);

                for (int i = 0; i < m; i++)
                {
                    sortedLms[i] = lmsL[recSa[i]];
                }

                induce(sortedLms);
            }
            return sa;
        }
        #endregion // SuffixArray

        #region LCPArray
        /// <summary>
        /// sのLCPArrayとして長さ n-1の配列を返す
        /// </summary>
        /// <remarks>
        /// <para>res[i]はs[sa[i],n), s[sa[i+1],n)のLongest Common Prefixの長さ</para>
        /// <para>O(n)</para>
        /// </remarks>
        /// <typeparam name="T"></typeparam>
        /// <param name="s"></param>
        /// <param name="sa"></param>
        /// <param name="cmp"></param>
        /// <returns></returns>
        public static int[] LCPArray<T>(T[] s, int[] sa, Comparison<T> cmp)
        {
            int n = s.Length;
            Debug.Assert(n >= 1);
            int[] rnk = new int[n];
            for (int i = 0; i < n; i++)
            {
                rnk[sa[i]] = i;
            }

            int[] lcp = new int[n - 1];
            int h = 0;
            for (int i = 0; i < n; i++)
            {
                if (h > 0) h--;
                if (rnk[i] == 0) continue;
                int j = sa[rnk[i] - 1];
                for (; j + h < n && i + h < n; h++)
                {
                    if (cmp(s[j + h], s[i + h]) != 0) break;
                }
                lcp[rnk[i] - 1] = h;
            }

            return lcp;
        }

        /// <summary>
        /// sのLCPArrayとして長さ n-1の配列を返す
        /// </summary>
        /// <remarks>
        /// <para>res[i]はs[sa[i],n), s[sa[i+1],n)のLongest Common Prefixの長さ</para>
        /// <para>O(n)</para>
        /// </remarks>
        /// <typeparam name="T"></typeparam>
        /// <param name="s"></param>
        /// <param name="sa"></param>
        /// <returns></returns>
        public static int[] LCPArray<T>(T[] s, int[] sa)
        {
            return LCPArray(s, sa, Comparer<T>.Default.Compare);
        }
        /// <summary>
        /// sのLCPArrayとして長さ n-1の配列を返す
        /// </summary>
        /// <remarks>
        /// <para>res[i]はs[sa[i],n), s[sa[i+1],n)のLongest Common Prefixの長さ</para>
        /// <para>O(n)</para>
        /// </remarks>
        /// <typeparam name="T"></typeparam>
        /// <param name="s"></param>
        /// <param name="sa"></param>
        /// <returns></returns>
        public static int[] LCPArray(string s, int[] sa)
        {
            //int n = s.Length;
            //int[] s2 = new int[n];
            //for (int i = 0; i < n; i++)
            //{
            //    s2[i] = s[i];
            //}
            return LCPArray(s.ToCharArray(), sa);
        }

        #endregion // LCPArray

        #region ZAlgorithm

        /// <summary>
        /// 長さnの配列sについて sと s[i,n)のLCPの長さを返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="s"></param>
        /// <param name="eq"></param>
        /// <returns></returns>
        public static int[] ZAlgorithm<T>(T[] s, EqualityComparer<T> eq)
        {
            int n = s.Length;
            if (n == 0) return new int[0];
            int[] z = new int[n];
            z[0] = 0;
            for (int i = 1, j = 0; i < n; i++)
            {
                ref int k = ref z[i];
                k = (j + z[j] <= i) ? 0 : Math.Min(j + z[j] - i, z[i - j]);
                while (i + k < n && eq.Equals(s[k], s[i + k])) k++;
                if (j + z[j] < i + z[i]) j = i;
            }
            z[0] = n;
            return z;
        }

        /// <summary>
        /// 長さnの配列sについて sと s[i,n)のLCPの長さを返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="s"></param>
        /// <returns></returns>
        public static int[] ZAlgorithm<T>(T[] s)
        {
            return ZAlgorithm(s, EqualityComparer<T>.Default);
        }

        /// <summary>
        /// 長さnの文字列sについて sと s[i,n)のLCPの長さを返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="s"></param>
        /// <returns></returns>
        public static int[] ZAlgorithm(string s)
        {
            return ZAlgorithm(s.ToCharArray());
        }

        #endregion
    }
}

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

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

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

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

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

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

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

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

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

            return _line[_index++];
        }

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

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

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

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


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

namespace Contest
{

    class Program
    {

        static void Main(string[] args)
        {
            var inp = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var x = inp[0];
            var y = inp[1];
            var sum = 100 * x + 10 * y;
            var fox = false;
            while (sum >= 220)
            {

                var xs = 0; var ys = 0;
                if (y < 2) break;
                if (!fox)
                {
                    xs = x > 1 ? 2 : x;
                    ys = (220 - 100 * xs) / 10;
                    x -= xs;
                    y -= ys;
                }
                else
                {
                    ys = y >= 22 ? 22 : y >= 12 ? 12 : y >= 2 ? 2 : y;
                    xs = (220 - 10 * ys)/100;
                    x -= xs;
                    y -= ys;
                }
                fox = !fox;
                sum = 100 * x + 10 * y;
            }
            Console.WriteLine(fox ? "Ciel" : "Hanako");

        }
    }
}


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

namespace ConsoleApplication1
{
    class IndiaHacks2
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader(@"D:\Sergey\Code\2.txt"));

            string[] strParams = Console.ReadLine().Split(new char[] { ' ' });
            int n = int.Parse(strParams[0]);
            int q = int.Parse(strParams[1]);

            var a = new List<string>();
            var d = new Dictionary<string, char>(q);
            var g = new Dictionary<char, List<string>>();

            //var ba = new List<string>();

            int k = n;
            long r = 0;

            for (int i = 0; i < q; i++)
            {
                strParams = Console.ReadLine().Split(new char[] { ' ' });
                d[strParams[0]] = strParams[1][0];

                List<string> f;
                if (!g.TryGetValue(strParams[1][0], out f))
                {
                    f = new List<string>();
                    g[strParams[1][0]] = f;
                }
                f.Add(strParams[0]);
            }

            //HashSet<string> h = new HashSet<string>();

            var s = new LinkedList<char[]>();
            var c = new char[n];
            c[n - 1] = 'a';
            s.AddLast(c);
            LinkedListNode<char[]> sp = s.First;
            for (int i = n - 1; i >= 1; i--)
            {
                for (int j = 0, count = s.Count; j < count && sp != null; j++)
                {
                    List<string> f;
                    if (g.TryGetValue(sp.Value[i], out f))
                    {
                        for (k = 1; k < f.Count; k++)
                        {
                            char[] cc = sp.Value.ToArray();
                            cc[i] = f[k][1];
                            cc[i - 1] = f[k][0];
                            s.AddLast(cc);
                        }
                        sp.Value[i] = f[0][1];
                        sp.Value[i - 1] = f[0][0];
                        s.AddLast(sp.Value);
                    }
                    sp = sp.Next;
                    s.RemoveFirst();
                }
            }

            Console.WriteLine(s.Count);
        }//main

    }
}


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

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

            int k = int.Parse(Console.ReadLine());
            Dictionary<int, int> dic = new Dictionary<int, int>();
            int m = k;
            int i = 1;
            dic.Add(k,k);
            while (true)
            {
                int a = getDigit(k);
                if (!dic.ContainsKey(a))
                {
                    dic.Add(a, a);
                    i++;
                    //Console.WriteLine(a);
                }
                else break;
                k = a;

                m--;
            }
            Console.WriteLine(i);

        }
        static int getDigit(int k)
        {
            int digit = k + 1;
            while (digit % 10 == 0)
                digit /= 10;
            return digit;
        }

    }
}


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

class GFG
{

    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        Console.Write(n + " ");
        for (int i = n / 2; i >= 1; i--)
        {
            if (n % i == 0)
            {
                Console.Write(i + " ");
                n = i;
            }
        }
    }

}


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

public class Program
{
	public static void Main()
	{
	    var arr=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int k=arr[0];
		int n=arr[1];
		int w=arr[2];
		int sum=0;

		for(int i=0; i<w; i++)
		{
			sum+=(i+1)*k;
		}
		Console.WriteLine(n>=sum ? 0 : sum-n);
	}
}


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

namespace CodeForces
{
    class Program
    {
        static bool can(int a, int b)
        {
            if(b==3)
            {
                return (a==1||a==2||a==4||a==5);
            }
            if (b % 2 == 0)
            {
                int mod = a % 4;
                if (mod > 0) return false;
                int div = a / 4;
                int can = (((b - 1) / 2) * ((b - 1) / 2) + 1) / 2;
                return div <= can;
            }
            else
            {
                if (a % 2 == 1)
                {
                    a--;
                }
                int can4 = (((b - 1) / 2) * ((b - 1) / 2) + 1) / 2;
                int can2 = b / 2 / 2 * 2;
                if (a % 4 == 2)
                {
                    if (can2 > 0)
                    {
                        can2--;
                        a -= 2;
                    }
                    else return false;
                }
                can4 += can2 / 2;
                return a  <= can4*4;
            }
        }
        static void Main(string[] args)
        {
            int x;
            x = int.Parse(Console.ReadLine());
            for (int i = 1; i <= 100; i++)
            {
                if (can(x, i))
                {
                    Console.WriteLine(i.ToString());
                    break;
                }
            }

        }
    }
}


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

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

        private static long[] fact;
        private static long[] fact1;

        private static void Main(string[] args)
        {
            int n = int.Parse(reader.ReadLine());

            long count = n;
            n--;

            InitFact(2*n + 2);
            long c = GetCFact(2*n + 1, n + 1);
            count = (count + 2 * (c - count + mod)) % mod;
            writer.WriteLine(count);
            writer.Flush();
        }

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

            fact[0] = 1;

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

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

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


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

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

            string[] t_A = Console.ReadLine().Split(' ');
            string[] t_B = Console.ReadLine().Split(' ');
            string[] HHH = Console.ReadLine().Split(':');
            int hour = 0;
            if (HHH[0][0] == '0') hour = int.Parse(HHH[0][1].ToString());
            else
                hour = int.Parse(HHH[0][0].ToString()) * 10 + int.Parse(HHH[0][1].ToString());
            int minute = 0;
            if (HHH[1][0] == '0') minute = int.Parse(HHH[1][1].ToString());
            else
                minute = int.Parse(HHH[1][0].ToString()) * 10 + int.Parse(HHH[1][1].ToString());
            int starttime = hour * 60 + minute;
            int endtime = starttime + int.Parse(t_A[1].ToString());
            int ans = 0;
            int start = 300;
            int chastota = int.Parse(t_B[0].ToString());
            int time = int.Parse(t_B[1].ToString());
            while (true)
            {
                if (start >= endtime || start > 1439) break;
                if (start + time > starttime)
                {
                    ans++;
                }
                start += chastota;
            }

            Console.WriteLine(ans);

        }
    }
}


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

namespace AlgoTest
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int sum = 0;
            int max = int.MinValue;

            for (int i = 0; i < a.Length; i++)
            {
                sum += a[i];
                max = Math.Max(max, a[i]);
            }

            int k = max;
            int sum2 = 0;

            while(true)
            {
                sum2 = 0;

                for (int i = 0; i < a.Length; i++)
                {
                    sum2 += k - a[i];
                }

                if (sum2 > sum) break;

                k++;

            }

            Console.WriteLine(k);
         //   Console.ReadKey();
        }

        private static string [] customizeEmails(string [] emails)
        {
            for (int i = 0; i < emails.Length; i++)
            {
                emails[i] = customizeTheString(emails[i]);
            }

            return emails.Distinct().ToArray();
        }

        private static string customizeTheString(string email)
        {
            int indexOfAt = email.IndexOf('@');
            string name = email.Substring(0, indexOfAt);

            StringBuilder newMail = new StringBuilder();

            for (int i = 0; i < name.Length; i++)
            {
                if (name[i] == '+') break;
                if (name[i] == '.') continue;

                newMail.Append(name[i]);
            }

            return newMail.Append(email.Substring(indexOfAt)).ToString();
        }
        public static string ReverseVowels(string s)
        {
            StringBuilder sb = new StringBuilder();

            List<int> vowels = new List<int>();

            for (int i = 0; i < s.Length; i++)
            {
                if (isVowel(s[i]))
                {
                    vowels.Add(i);
                }
            }

            int[] c = vowels.ToArray();

            char[] answer = new char[s.Length];

            int j = 0;

            for (int i = 0; i < s.Length; i++)
            {
                if (isVowel(s[i]))
                {
                    answer[i] = s[c[c.Length - 1 - j]];
                    answer[c[c.Length - 1 - j]] = s[i];
                    j++;
                }
                else
                {
                   answer[i] = s[i];
                }
            }

            return new string(answer);
        }

        public static bool isVowel(char c)
        {
            c = char.ToLowerInvariant(c);
            return c == 'a' || c == 'o' || c == 'e' || c == 'u' || c == 'i';
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//неправильный ответ на тесте 15
namespace F
{
    class Program
    {
        static Tree[] wt;
        class Tree
        {
            public long ves;
            public long ves_;
            public int nn;//индек первого элемента
            public int nk;//индек последнего элемента
            public Tree l;
            public Tree r;
            public Tree p;
            public Tree(int[] m, int[] a, int i1, int ik, Tree p1)
            {
                nn = i1;
                nk = ik;
                if (i1 == ik)
                {
                    l = null;
                    r = null;
                    ves = m[i1];
                    ves_ = ((long)(a[i1] - i1) * (long)m[i1]) % (long)(1000000007);
                    //ves_ = ((long)(a[i1] - i1) * (long)m[i1]) ;
                    wt[i1] = this;
                }
                else
                {
                    int s = (ik + i1 + 1) / 2;
                    l = new Tree(m, a, i1, s - 1, this);
                    r = new Tree(m, a, s, ik, this);
                    ves = l.ves + r.ves;
                    ves_ = (l.ves_ + r.ves_) % (long)(1000000007);
                }
                p = p1;
                if (ves < 0) Console.WriteLine("ОЙ");
                if (ves_ < 0) Console.WriteLine("ОЙ");
                //if (ves >= 1000000007) Console.WriteLine("ОЙ");
                if (ves_ >= 1000000007) Console.WriteLine("ОЙ");
            }
        }

        static long FindVes(Tree t1, Tree tn, bool t)//t=true ves;t=false ves_;
        {
            long ves = 0;
            int x1 = t1.nn;
            int y1 = tn.nk;
            if (y1 < x1) return 0;
            Tree ti = wt[x1];
            while (ti.nk < y1) ti = ti.p;
            if (t) ves = (long)ti.ves;
            else ves = (long)ti.ves_;
            Tree tiv = ti;
            while (ti.nn < x1)
            {
                if (ti.r.nn <= x1)
                {
                    if (t) ves = ves - (long)ti.l.ves;
                    else ves = (ves - (long)ti.l.ves_ + (long)(1000000007)) % (long)(1000000007);
                    ti = ti.r;
                }
                else
                {
                    ti = ti.l;
                }
            }
            ti = tiv;
            while (ti.nk > y1)
            {
                if (ti.l.nk >= y1)
                {
                    if (t) ves = ves - (long)ti.r.ves;
                    else ves = (ves - (long)ti.r.ves_ + (long)(1000000007)) % (long)(1000000007);
                    ti = ti.l;
                }
                else
                {
                    ti = ti.r;
                }
            }
            return ves;
        }

        static void Main(string[] args)
        {
            TextReader sr = Console.In;
            //StreamReader sr = new StreamReader("in115.txt");
            string[] s = sr.ReadLine().Split();
            int n = Convert.ToInt32(s[0]);
            int q = Convert.ToInt32(s[1]);
            s = sr.ReadLine().Split();
            string[] s1 = sr.ReadLine().Split();
            int[] a = new int[n];
            int[] w = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
                w[i] = Convert.ToInt32(s1[i]);
            }
            //решение
            wt = new Tree[n];
            Tree t1 = new Tree(w, a, 0, n - 1, null);

            int ll;
            int rr;
            int id, nw;
            bool zapros1;
            Tree ti;
            List<int> res = new List<int>();
            for (int i = 0; i < q; i++)
            {
                s = sr.ReadLine().Split();
                ll = Convert.ToInt32(s[0]);
                if (ll < 0) zapros1 = true; else zapros1 = false;
                id = -1 - ll;
                ll--;
                nw = Convert.ToInt32(s[1]);
                rr = nw - 1;
                if (zapros1)
                {
                    ti = wt[id];
                    long delta = (long)nw - ti.ves;
                    long delta_ = (((long)(a[id] - id) * (long)nw)) % (long)(1000000007) - ti.ves_;
                    w[id] = nw;
                    while (ti != null)
                    {
                        ti.ves = ti.ves + delta;
                        ti.ves_ = (ti.ves_ + delta_ + (long)(1000000007)) % (long)(1000000007);
                        ti = ti.p;
                    }
                }
                else
                {
                    if (ll == rr)
                    {
                        res.Add(0);
                    }
                    else if ((rr - ll) == (a[rr] - a[ll]))
                    {
                        res.Add(0);
                    }
                    else if ((rr - ll) == 1)
                    {
                        if (w[ll] > w[rr])
                        {
                            res.Add((int)(((long)(a[rr] - a[ll] - 1) * (long)w[rr]) % (long)(1000000007)));
                        }
                        else
                        {
                            res.Add((int)(((long)(a[rr] - a[ll] - 1) * (long)w[ll]) % (long)(1000000007)));
                        }
                    }
                    else
                    {
                        //найти вес отрезка
                        //int x1 = x - 1;
                        //int y1 = y - 1;
                        long ves = FindVes(wt[ll], wt[rr], true);
                        long vl, vr, vv;
                        int iis, iiss;
                        int iisll = ll, iislr = rr;
                        iis = (ll + rr + 1) / 2;
                        vl = FindVes(wt[ll], wt[iis - 1], true);
                        vr = FindVes(wt[iis + 1], wt[rr], true);
                        while (true)
                        {
                            if ((vl + w[iis] > vr) && (vr + w[iis] > vl)) break;
                            if (vl + w[iis] == vr)
                            {
                                if (w[iis] >= w[iis + 1]) break;
                                else
                                {
                                    iis++;
                                    break;
                                }
                            }
                            if (vr + w[iis] == vl)
                            {
                                if (w[iis] >= w[iis - 1]) break;
                                else
                                {
                                    iis--;
                                    break;
                                }
                            }
                            if ((vl + w[iis]) > (vr + w[iis]))
                            {
                                iiss = (iisll + iis) / 2;
                                vv = FindVes(wt[iiss + 1], wt[iis - 1], true);
                                vl = vl - vv - w[iiss];
                                vr = vr + vv + w[iis];
                                iislr = iis;
                                iis = iiss;
                            }
                            else
                            {
                                iiss = (iislr + iis + 1) / 2;
                                vv = FindVes(wt[iis + 1], wt[iiss - 1], true);
                                vl = vl + vv + w[iis];
                                vr = vr - vv - w[iiss];
                                iisll = iis;
                                iis = iiss;
                            }
                        }
                        //long r1 = 0;
                        //for (int j = ll; j < iis; j++)
                        //{
                        //    r1 = (r1 + ((long)w[j] * (long)(a[iis] - a[j] - (iis - j)))) % 1000000007;
                        //}
                        //for (int j = iis + 1; j <= rr; j++)
                        //{
                        //    r1 = (r1 + ((long)w[j] * (long)(a[j] - a[iis] - (j - iis)))) % 1000000007;
                        //}
                        long r = 0;
                        if (iis > ll)
                        {
                            r = (r - (FindVes(wt[ll], wt[iis - 1], false) % (long)(1000000007)) + (long)(1000000007)) % (long)(1000000007);
                            r = (r + ((long)(a[iis] - iis)) * (FindVes(wt[ll], wt[iis - 1], true) % (long)(1000000007))) % (long)(1000000007);

                        }
                        if (iis < rr)
                        {
                            r = (r + (FindVes(wt[iis + 1], wt[rr], false)) % (long)(1000000007)) % (long)(1000000007);
                            r = (r - ((long)(a[iis] - iis) * (FindVes(wt[iis + 1], wt[rr], true) % (long)(1000000007))) % (long)(1000000007) + (long)(1000000007)) % (long)(1000000007);
                        }
                        res.Add((int)r);
                    }
                }
            }
            Console.WriteLine(string.Join("\n", res));
        }
    }
}


using System;

namespace Problem51Nod
{
    class Program
    {
        public static void Main(String[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(input[0]);
            long sum = Convert.ToInt64(input[1]);
            input = Console.ReadLine().Split(' ');
            long[] nums = new long[n];
            for (int i = 0; i < n; i++)
                nums[i] = Convert.ToInt64(input[i]);

            Console.WriteLine(Cal(sum, nums));
        }

        static long Mod = 1000000007;
        static long[] Nums, InvFacts;

        static void Init(long[] nums)
        {
            long[] invs = new long[30];
            InvFacts = new long[30];
            invs[1] = InvFacts[1] = 1;

            for (int i = 2; i < invs.Length; i++)
            {
                invs[i] = (Mod - Mod / i * invs[Mod % i] % Mod) % Mod;
                InvFacts[i] = InvFacts[i - 1] * invs[i] % Mod;
            }

            Nums = new long[nums.Length];

            for (int i = 0; i < nums.Length; i++)
                Nums[i] = nums[i] + 1;

            Array.Sort(Nums, (a, b) => b.CompareTo(a));
        }

        static long Cal(long sum, long[] nums)
        {
            if (nums.Length == 1) return nums[0] < sum ? 0 : 1;
            Init(nums);
            return (Cal(Nums.Length - 1, sum) + Mod) % Mod;
        }

        static long Cal(int index, long sum)
        {
            int k = Nums.Length - 1;
            long result = Cmn(sum + k, k);

            for(int i = index; i >= 0 && Nums[i] <= sum; i--)
                result -= Cal(i - 1, sum - Nums[i]);

            return result % Mod;
        }

        static long Cmn(long m, long n)
        {
            long result = 1;

            for(long i = m - n + 1; i <= m; i++)
                result = i % Mod * result % Mod;

            result = result * InvFacts[n] % Mod;
            return result;
        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static int divisor(int n)
        {
            for (int i = 2; i <= Math.Sqrt(n); i++)
            {
                if ((n % i) == 0) return i;
            }
            return 1;
        }

        static void Main(string[] args)
        {
            int n;
            string s;
            s = Console.ReadLine();
            n = int.Parse(s);
            int sum = 0;
            while (n>1)
            {
                sum += n;
                int div = divisor(n);
                n = n / div;
                if (div == 1) n = 1;
            }
            sum += 1;
            Console.Write(sum);
        }
    }
}


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

namespace InnaAndPony
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nmijab = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(nmijab[0]);
            int m = Convert.ToInt32(nmijab[1]);
            int i = Convert.ToInt32(nmijab[2]);
            int j = Convert.ToInt32(nmijab[3]);
            int a = Convert.ToInt32(nmijab[4]);
            int b = Convert.ToInt32(nmijab[5]);
            int k1 = 0;
            int k2 = 0;
            int k3 = 0;
            int k4 = 0;
            int k = 0;

            if (((i == 1) && (j == 1)) || ((i == n) && (j == 1)) || ((i == n) && (j == m)) || ((i == 1) && (j == m)))
            {
                Console.WriteLine(0);
            }
            else
            {
                if (((i - 1 >= a) || (n - i >= a)) && ((j - 1 >= b) || (m - j >= b)))
                {
                    if ((Math.Abs(i - 1) % a == 0) && (Math.Abs(j - 1) % b == 0) && ((Math.Abs(i - 1) / a + Math.Abs(j - 1) / b) % 2 == 0))
                    {
                        k1 = Math.Max(Math.Abs(i - 1) / a, Math.Abs(j - 1) / b);
                        //       Console.WriteLine(k1);
                    }
                    else
                    {
                        k1 = 1000000000;
                        //       Console.WriteLine(k1);
                    }

                    if ((Math.Abs(i - n) % a == 0) && (Math.Abs(j - 1) % b == 0) && ((Math.Abs(i - n) / a + Math.Abs(j - 1) / b) % 2 == 0))
                    {
                        k2 = Math.Max(Math.Abs(i - n) / a, Math.Abs(j - 1) / b);
                        //        Console.WriteLine(k2);
                    }
                    else
                    {
                        k2 = 1000000000;
                        //     Console.WriteLine(k2);
                    }

                    if ((Math.Abs(i - n) % a == 0) && (Math.Abs(j - m) % b == 0) && ((Math.Abs(i - n) / a + Math.Abs(j - m) / b) % 2 == 0))
                    {
                        k3 = Math.Max(Math.Abs(i - n) / a, Math.Abs(j - m) / b);
                        //   Console.WriteLine(k3);
                    }
                    else
                    {
                        k3 = 1000000000;
                        //       Console.WriteLine(k3);
                    }

                    if ((Math.Abs(i - 1) % a == 0) && (Math.Abs(j - m) % b == 0) && ((Math.Abs(i - 1) / a + Math.Abs(j - m) / b) % 2 == 0))
                    {
                        k4 = Math.Max(Math.Abs(i - 1) / a, Math.Abs(j - m) / b);
                        //          Console.WriteLine(k4);
                    }
                    else
                    {
                        k4 = 1000000000;
                        //                Console.WriteLine(k4);
                    }

                    k = Math.Min(Math.Min(k1, k2), Math.Min(k3, k4));

                    if (k < 1000000000)
                    {
                        Console.WriteLine(k);
                    }
                    else
                    {
                        Console.WriteLine("Poor Inna and pony!");
                    }
                }
                else
                {
                    Console.WriteLine("Poor Inna and pony!");
                }
            }

 //           Console.ReadKey();
        }
    }
}


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

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

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

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

            var nn = new int[n + 2];
            for (int i = 1; i <= n; i++)
            {
                nn[i] = Next();
            }
            nn[0] = 0;
            nn[n + 1] = 1001;

            int ans = 0;
            int cnt = 1;

            for (int i = 1; i < nn.Length; i++)
            {
                if (nn[i] == nn[i - 1] + 1)
                {
                    cnt++;
                }
                else
                {
                    if (cnt >= 3)
                        ans = Math.Max(ans, cnt - 2);
                    cnt = 1;
                }
            }
            if (cnt >= 3)
                ans = Math.Max(ans, cnt - 2);
            return ans;
        }

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


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

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

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

            string v = "aeiouy";
            start:
            for (int i = 0; i < s.Length-1; ++i)
            {
                if(v.Contains(s[i]) && v.Contains(s[i+1]) )
                {
                    s = s.Remove(i+1, 1);
                    goto start;
                }
            }

            Console.WriteLine(s);

        }
    }
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long LA = long.Parse(str[0]);
		long RA = long.Parse(str[1]);
		long TA = long.Parse(str[2]);
		string[] str2 = Console.ReadLine().Split();
		long LB = long.Parse(str2[0]);
		long RB = long.Parse(str2[1]);
		long TB = long.Parse(str2[2]);
		if(LA>LB){
			long tL = LB;
			long tR = RB;
			long tT = TB;
			LB = LA;
			RB = RA;
			TB = TA;
			LA = tL;
			RA = tR;
			TA = tT;
		}
		long LA1 = LA + (LB - LA) / Gcd(TA,TB) * Gcd(TA,TB);
		long ans1 = Math.Max(0,Math.Min(LA1+(RA-LA),RB)-LB+1);
		long LA2 = LA1 + Gcd(TA,TB);
		long ans2 = Math.Max(0,(Math.Min(RB,LA2-LA+RA)-LA2)+1);
		Console.WriteLine(Math.Max(ans1,ans2));
	}

	public static long Gcd(long a, long b) {
		if (a < b)
			return Gcd(b, a);
		while (b != 0) {
			var r = a % b;
			a = b;
			b = r;
		}
		return a;
	}
}


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

namespace _1426E
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            int[] alice = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] Bob = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            //most wins
            int mostWins = 0;
            mostWins += Math.Min(alice[0], Bob[1]);
            mostWins += Math.Min(alice[1], Bob[2]);
            mostWins += Math.Min(alice[2], Bob[0]);

            //least wins
            List<int[]> aliceDistribution = new List<int[]>()
            { new int[3] { 0, 0, 0 }, new int[3] { 0, 0, 0 }, new int[3] { 0, 0, 0 } };

            for (int a = 0; a < alice.Length; a++)
            {
                for (int b = 0; b < Bob.Length; b++)
                {
                    if ((a + b) % alice.Length == (a + 1) % alice.Length)
                        continue;
                    int c = Math.Min(Bob[(a + b) % alice.Length], alice[a]);
                    alice[a] -= c;
                    Bob[(a + b) % alice.Length] -= c;
                    aliceDistribution[a][(a + b) % alice.Length] += c;
                }

                if (alice[a] > 0)
                {
                    for (int a2 = 0; a2 < alice.Length; a2++)
                    {
                        if (a2 == a)
                            continue;
                        for (int ad = 0; ad < aliceDistribution.Count; ad++)
                        {
                            if (ad == (a + 1) % alice.Length)
                                continue;

                            int c = Math.Min(alice[a], aliceDistribution[a2][ad]);
                            alice[a] -= c;
                            aliceDistribution[a2][ad] -= c;
                            aliceDistribution[a2][(a + 1) % alice.Length] += c;
                        }
                    }
                }
            }

            int leastWins = 0;
            foreach (var item in alice)
                leastWins += item;

            Console.WriteLine(leastWins + " " + mostWins);
        }
    }
}


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

namespace cfgr8
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            Stopwatch sw = new Stopwatch();
            //sw.Start();
            solve_cfgr8B();
            //sw.Stop();
            //Console.WriteLine(sw.ElapsedMilliseconds / 1000);
            Console.Out.Flush();
        }

        public static void solve_cfgr8B()
        {
            long k = Convert.ToInt64(Console.ReadLine());
            long cnt = 1;
            long[] codeforces = new long[10];
            for (int i = 0; i < codeforces.Length; i++)
            {
                codeforces[i] = 1;
            }
            long idx = 0;
            while (cnt < k)
            {
                codeforces[idx % 10]++;
                cnt = 1;
                for (int i = 0; i < codeforces.Length; i++)
                {
                    if (codeforces[i] > 1)
                    {
                        cnt *= codeforces[i];
                    }
                }
                idx++;
            }
            StringBuilder res = new StringBuilder();
            string code = "codeforces";
            for (int i = 0; i < codeforces.Length; i++)
            {
                res.Append(new string(code[i], (int)codeforces[i]));
            }
            Console.WriteLine(res.ToString());
        }

        public static void solve_cfgr8A()
        {
            //int[] test = new int [7] {2, 3, 3, 3, 5, 6, 8};
            int t = Convert.ToInt32(Console.ReadLine());
            while (t-- > 0)
            {

                int[] abn = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                int a = abn[0];
                int b = abn[1];
                int min = Math.Min(a, b);
                int max = Math.Max(a, b);
                int n = abn[2];
                int cnt = 0;
                int parity = 1;
                while (Math.Max(min, max) <= n)
                {
                    if (parity % 2 != 0)
                    {
                        min += max;
                    }
                    else
                    {
                        max += min;
                    }
                    parity++;
                    cnt++;
                }
                Console.WriteLine(cnt);
            }
        }

        public static int binSearchLeft(int[] a, int x)
        {
            int l = 0;
            int r = a.Length;
            while (l < r)
            {
                int mid = (l + r) / 2;
                if (a[mid] == x)
                {
                    r = mid;
                }
                else if (a[mid] > x)
                {
                    r = mid;
                }
                else
                {
                    l = mid + 1;
                }
            }
            return l;
        }
    }
}


using System;
using System.Text;

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

            //int num = int.Parse(Console.ReadLine());
            //for (int i = 0; i < num; i++)
            //{
            //    Console.WriteLine(AWayTooLongSolver(Console.ReadLine()));
            //}

            //Console.WriteLine(BeautifulYear(int.Parse(Console.ReadLine())));
            //Console.ReadLine();
            string input = Console.ReadLine();
            string [] op = input.Split(' ');
            int n = int.Parse(op[0]);
            int m = int.Parse(op[1]);
            Console.WriteLine(SystemofEquations(n, m));

        }

        public static string Solver(string input1 , string input2) {

            if (input1.Length == input2.Length) {
                for (int i = 0; i < input1.Length; i++)
                {
                    if (input1[i] != input2[(input1.Length - 1) - i])
                        return "NO";
                }

            return "YES";
        }
        else return "NO";

        }

        public static string AWayTooLongSolver(string s) {

            if (s.Length > 10)
            {

                return s[0] + (s.Length - 2).ToString() + s[s.Length- 1] + "";
            }
            return s;
        }

        public static int StonesontheTableSolver(string input) {

            int res = 0;
            int index = 1;
            while (index < input.Length) {

                if (input[index] == input[index - 1])
                    res++;
                index++;
            }
            return res;

        }

        public static int BeautifulYear(int year) {
            bool breakflag = false;
            while (true) {

                year++;
                breakflag = false;
                string yearstring = year.ToString();

                for (int j = 0; j < yearstring.Length; j++)
                {
                    for (int i = j+1; i < yearstring.Length; i++)
                    {
                        if (yearstring[j] == yearstring[i])
                            breakflag = true;
                    }
                    if (breakflag)
                        break;

                }
                if (!breakflag)
                    return year;
            }
        }

        public static int SystemofEquations(int n, int m) {
            int a=0 , b=0;
            int count = 0;
            while (a < 1000)
            {
                while (b < 1000)
                {
                    if (a * a + b == n && a + b * b == m)
                        count++;
                    b++;
                }
                b = 0;
                a++;
            }
            return count;

        }

    }
}


using System;

namespace DataRecovery
{
    partial class DataRecovery
    {
        static void Main(string[] args)
        {
            int n, m, min, max;
            int[] recorded;

            n = NextInt();
            m = NextInt();
            min = NextInt();
            max = NextInt();

            recorded = new int[m];

            for (int i = 0; i < m; i++)
                recorded[i] = NextInt();

            Array.Sort(recorded);

            if (m > n)
                Console.WriteLine("Incorrect");
            else if (m == n)
            {
                if (recorded[0] == min && recorded[m - 1] == max)
                    Console.WriteLine("Correct");
                else
                    Console.WriteLine("Incorrect");
            }
            else
            {
                if (n - m == 1)
                {
                    if ((recorded[0] == min && recorded[m - 1] <= max) || (recorded[m - 1] == max && recorded[0] >= min))
                        Console.WriteLine("Correct");
                    else
                        Console.WriteLine("Incorrect");
                }
                else
                {
                    if (recorded[0] >= min && recorded[m - 1] <= max)
                        Console.WriteLine("Correct");
                    else
                        Console.WriteLine("Incorrect");
                }
            }
        }
    }

    partial class DataRecovery
    {
        static string[] tokens = new string[0];
        static int cur_token = 0;

        static void ReadArray(char sep)
        {
            cur_token = 0;
            tokens = Console.ReadLine().Split(sep);
        }

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

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

        static int NextInt()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return int.Parse(tokens[cur_token++]);
        }

        static long NextLong()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return long.Parse(tokens[cur_token++]);
        }

        static double NextDouble()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return double.Parse(tokens[cur_token++]);
        }

        static decimal NextDecimal()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return decimal.Parse(tokens[cur_token++]);
        }

        static string NextToken()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return tokens[cur_token++];
        }

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


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

namespace Codeforces
{
    class Program
    {
        static void Main()
        {
            Problem2A();
        }

        static void Problem2A()
        {

            var first = Console.ReadLine().Split(' ');
            var second = Console.ReadLine().Split(' ');

            var numProblems = Int64.Parse(first[0]);
            var skillLevel  = Int64.Parse(first[1]);

            var difficulties = new List<long>();

            for(var i=0; i<numProblems; i++)
            {
                difficulties.Add(Int64.Parse(second[i]));
            }

            while(difficulties.Count > 0 && difficulties.First() <= skillLevel)
            {
                difficulties.RemoveAt(0);
            }
            while(difficulties.Count > 0 && difficulties.Last() <= skillLevel)
            {
                difficulties.RemoveAt(difficulties.Count - 1);
            }

            Console.WriteLine(numProblems - difficulties.Count);
            Console.ReadLine();
        }

        static void ProblemC()
        {
            var n = Int32.Parse(Console.ReadLine());
            var inputs = new List<string>();

            for (int i = 0; i < n; i++)
            {
                inputs.Add(Console.ReadLine());
            }
            //Console.WriteLine("Read complete");

            var parities = new List<int>();
            var solns = 0;

            for (var i = 0; i < n; i++)
                parities.Add(GetBracketParity(inputs[i]));

            for (var i = 0; i < n; i++)
                for (var j = 0; j < n; j++)
                {
                    if (parities[i] + parities[j] == 0 && IsValid(inputs[i], inputs[j]))
                        solns++;
                }

            Console.WriteLine(solns);
        }
        static bool IsValid(string A, string B)
        {
            var arr = (A + B).ToCharArray();
            var parity = 0;

            foreach (var c in arr)
            {
                if (c == '(')
                    parity++;
                else if (c == ')')
                    parity--;
                else
                    throw new ArgumentException();

                if (parity < 0)
                    return false;
            }
            return true;
        }

        static int GetBracketParity(string input)
        {
            var inputArr = input.ToCharArray();
            var parity = 0;

            foreach (var c in inputArr)
            {
                if (c == '(')
                    parity++;
                else if (c == ')')
                    parity--;
                else
                    throw new ArgumentException();
            }

            return parity;
        }

        static void ProblemB(string A, string B)
        {
            var first = A.Split(' ').Select(x => Int32.Parse(x)).ToList<int>();
            var sizes = B.Split(' ').Select(x => Int32.Parse(x)).ToList<int>();

            var n = first[0]; //bacteria
            var K = first[1];

            sizes.Sort();
            var bacteriaLeft = new List<int>();

            var thisBatch = 1; //count identical sizes

            for (var i = 0; i < n - 1; i++)
            {
                if (sizes[i] == sizes[i + 1])
                {
                    thisBatch++;
                    continue;
                }
                else
                {
                    if (sizes[i] + K < sizes[i + 1])
                        bacteriaLeft.AddRange(Enumerable.Repeat<int>(sizes[i], thisBatch));

                    thisBatch = 1;
                }
            }
            bacteriaLeft.AddRange(Enumerable.Repeat(sizes[n - 1], thisBatch));
            Console.WriteLine(bacteriaLeft.Count);

        }

        static void ProblemA()
        {
            var first = Console.ReadLine().Split(' ');
            //var second = Console.ReadLine();

            var numBoxes = Int64.Parse(first[0]);
            var numDeleg = Int64.Parse(first[1]);

            var buildFee = Int32.Parse(first[2]);
            var demolFee = Int32.Parse(first[3]);

            //need numBoxes to be divisible by numDeleg
            var r = numBoxes % numDeleg;
            var q = numBoxes / numDeleg;
            //Console.WriteLine(r + " " + q);

            //first calculate the cost of demolishing.
            var demolCost = r * demolFee;
            //Console.WriteLine("Demolish for " + demolCost);

            //and building
            var buildCost = (numDeleg - r) * buildFee;
            //Console.WriteLine("Build for " + buildCost

            if (buildCost < demolCost)
                Console.WriteLine(buildCost);
            else
                Console.WriteLine(demolCost);
        }
    }
}


/*
 * Маленький полярный медвежонок Лимак строит башни из блоков. Каждый блок является кубиком с целочисленной длиной стороны.
 * У Лимака есть неограниченное количество любых блоков.
 * Блок со стороной a имеет объём a^3. Объём башни, составленной из блоков со сторонами a1, a2, ..., ak, равен суммарному объёму всех этих блоков a1^3 + a2^3 + ... + ak^3.
 * Лимак собирается построить башню. Сначала он просит вас назвать целое положительное число X — требуемый объём башни. Затем Лимак строит башню жадно,
 * каждый раз выбирая самый большой блок, который можно добавить к текущей башне так, чтобы её объём не превысил X.
 * Лимак просит вас выбрать некоторое X, не превосходящее m, таким образом, чтобы количество блоков, использованных для постройки башни (по жадному алгоритму),
 * было максимально возможным. Из всех таких X он просит вас выбрать максимальное.
 * Можете ли вы помочь Лимаку? Найдите максимальное количество блоков, которое может быть использовано при постройке башни объёма X ≤ m, и максимальное подходящее число X,
 * для которого достигается этот результат.
 *
 * Входные данные
 * В единственной строке входных данных записано целое число m (1 ≤ m ≤ 10^15), означающее, что вы должны выбрать число X в диапазоне от 1 до m включительно.
 *
 * Выходные данные
 * Выведите два целых числа — максимально возможное количество блоков в башне и максимальное значение X, на котором это количество блоков достигается.
 *
 * Примеры
 * Входные данные
 * 48
 * Выходные данные
 * 9 42
 *
 *
 * Входные данные
 * 6
 * Выходные данные
 * 6 6
 *
 * Решение
 * Let's find the maximum a that a3 ≤ m. Then, it's optimal to choose X that the first block will have side a or a - 1. Let's see why.

    If the first block has side a then we are left with m2 = m - first_block = m - a^3.

    If the first block has side a - 1 then the initial X must be at most a^3 - 1
    (because otherwise we would take a block with side a), so we are left with m2 = a^3 - 1 - first_block = a^3 - 1 - (a - 1)^3

    If the first blocks has side a - 2 then the initial X must be at most (a - 1)^3 - 1, so we are left with m2 = (a - 1)^3 - 1 - first_block = (a - 1)^3 - 1 - (a - 2)^3.

 * We want to first maximize the number of blocks we can get with new limit m2. Secondarily, we want to have the biggest initial X.
 * You can analyze the described above cases and see that the first block with side (a - 2)3 must be a worse choice than (a - 1)3.
 * It's because we start with smaller X and we are left with smaller m2. The situation for even smaller side of the first block would be even worse.
 * Now, you can notice that the answer will be small. From m of magnitude a3 after one block we get m2 of magnitude a2. So,
 * from m we go to m2 / 3, which means that the answer is O(loglog(m)). The exact maximum answer turns out to be 18.
 * The intended solution is to use the recursion and brutally check both cases: taking a3 and taking (a - 1)3 where a is maximum that a3 ≤ m.
 * It's so fast that you can even find a in O(m1 / 3), increasing a by one.
*/
using System;
using System.Globalization;
using System.Text;
using System.Collections.Generic;

namespace D
{
	class MainClass
	{
		public static ulong FindCubicRoot(ulong x)
		{
			ulong h = x;
			ulong l = 1;
			while (h > l) {
				ulong m = (h + l) >> 1;
				if (l + 1 == h) {
					if (h * h * h > x)
						return l;
					return h;
				}
				if (x / m > m * m) {
					// m * m < x div m <= x / m
					l = m;
				} else {
					h = m;
				}
			}
			return h;
		}
		public static bool IsCubic(ulong x)
		{
			ulong root = FindCubicRoot(x);
			return root * root * root == x;
		}

		public static void Solve(ulong x, out ulong a, out ulong b)
		{
			if (x == 0) {
				a = 0;
				b = 0;
				return;
			}
			if (IsCubic(x + 1)) {
				ulong root = FindCubicRoot(x);
				ulong aa, bb;
				Solve(x - root * root * root, out aa, out bb);
				a = aa + 1;
				b = bb + root * root * root;
				// Console.WriteLine ("x={0} root={1} aa={2} bb={3}", x, root, aa, bb);
			} else {
				ulong root = FindCubicRoot(x);
				ulong aa, bb;
				Solve(x - root * root * root, out aa, out bb);
				a = aa + 1;
				b = bb + root * root * root;
				// Console.WriteLine ("x={0} root={1} aa={2} bb={3}", x, root, aa, bb);
				Solve(root * root * root - 1, out aa, out bb);
				if (aa > a) {
					a = aa;
					b = bb;
				}
				// Console.WriteLine ("x={0} root={1} aa={2} bb={3}", x, root, aa, bb);
			}
		}

		public static void Main (string[] args)
		{
			ulong a , x ;
			ulong m;
			bool err;

			err = ulong.TryParse (Console.ReadLine (), out m);
			if (err == false) {
				Console.Error.WriteLine ("Ошибка в чтении данных");
				return;
			}

			Solve(m, out a, out x);

			// Вывод
			Console.Write ("{0} {1}", a, x);
		}
	}
}


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"));
            bool ans = true;
            for (int i = 0; i < 8; i++) {
                char[] s = Console.ReadLine().ToCharArray();
                for (int j = 1; j < 8; j++) {
                    if (s[j] == s[j - 1]) {
                        ans = false;
                        break;
                    }
                }
                if (!ans) {
                    break;
                }
            }
            string ds = (ans) ? "YES" : "NO";
            Console.Write(ds);
            //Console.ReadKey();
        }
    }
}


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

public class Program
{
    private string S, T;
    private int N, M;

    public void Solve()
    {
        var sc = new Scanner();
        S = sc.Next();
        T = sc.Next();
        N = S.Length;
        M = T.Length;

        int[] front = new int[N + 1];
        for (int i = 0; i < N; i++)
        {
            front[i + 1] = front[i];
            if (front[i] < M && T[front[i]] == S[i]) front[i + 1]++;
        }

        int[] back = new int[N + 1];
        for (int i = N; i >= 1; i--)
        {
            back[i - 1] = back[i];
            if (back[i] < M && T[M - 1 - back[i]] == S[i - 1]) back[i - 1]++;
        }

        int ans = 0;
        for (int i = 0; i <= N; i++)
        {
            int ok = i;
            int ng = N + 1;
            while (ng - ok > 1)
            {
                int mid = (ok + ng) / 2;
                if (front[i] + back[mid] >= M) ok = mid;
                else ng = mid;
            }

            // Console.WriteLine($"{i} {front[i]} {ok} {back[ok]}");
            if (ok <= N) ans = Math.Max(ans, ok - i);
        }

        Console.WriteLine(ans);
    }

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

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

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

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

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

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

            return _line[_index++];
        }

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

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

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

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


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

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //int n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = num[0];
            int target = num[1];
            int dif = num[2];

            if (a == target) Console.WriteLine("YES");
            else if (dif == 0) Console.WriteLine("NO");
            else if (target > a && dif < 0) Console.WriteLine("NO");
            else if (target < a && dif > 0) Console.WriteLine("NO");
            else if ((target - a) % dif == 0) Console.WriteLine("YES");
            else Console.WriteLine("NO");

            //Console.WriteLine();

            //Console.Read();

        }

    }

}


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

namespace run
{
    class Program
    {
        private static int Swap(ref int a, ref int b)
        {
            if (a < b)
            {
                int tmp = a;
                a = b;
                b = tmp;
            }

            return 0;
        }

        private static int gcd(int a, int b)
        {
            Swap(ref a, ref b);

            while (a % b != 0)
            {
                a %= b;
                Swap(ref a, ref b);
            }

            return b;

        }

        private const long MOD = 1000000009;

        private static void Main(string[] args)
        {

            var nstr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();
            int n = nstr[0], m = nstr[1], k = nstr[2];
            int l = n - m;
            long result = 0;
            long good = 0;
            long count = (long)k * (long)l;
            if (n - count <= 0)
            {
                Console.WriteLine(m);
                return;

            }

            long num = (n - count) / k;

            //long kjk = BinPow(2, num + 1);

            long SUMM = k * 2 * (BinPow(2, num) - 1) % MOD;
            SUMM %= MOD;
            result += SUMM;

            /*for (int i = k; i <= n - count; i += k)
            {
                result += k;
                good = k;
                if (good == k)
                {
                    result <<= 1;
                    good = 0;
                    if (result >= MOD) result -= MOD;
                }
            }*/

            result += ((n - count) % k);
            result %= MOD;

            result += count - l;
            result %= MOD;

            Console.WriteLine(result);

        }

        private static long BinPow(long a, long degr)
        {
            if (degr == 0) return 1;
            if ((degr & 1) == 1) return a * (BinPow(a, degr - 1) % MOD);
            else
            {
                long value = BinPow(a, degr >> 1) % MOD;
                return value * value % MOD;
            }
        }
    }
}


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

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


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

namespace Testerka
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;
            string input = Console.ReadLine();
            string[] numba = input.Split(' ');
            int k2 = Convert.ToInt32(numba[0]);
            int k3 = Convert.ToInt32(numba[1]);
            int k5 = Convert.ToInt32(numba[2]);
            int k6 = Convert.ToInt32(numba[3]);
            for(; ; )
            {

                if (k2 > 0 && k5 > 0 && k6 > 0)
                {
                    ans = ans + 256;
                    k2--;
                    k5--;
                    k6--;
                }
                else if (k2 > 0 && k3 > 0)
                {
                    ans = ans + 32;
                    k2--;
                    k3--;
                }
                else break;
            }
            Console.WriteLine(ans);
        }
    }
}