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

namespace ConsoleApplication1
{
    class Program
    {
        static bool prime(long p)
        {
            if (p == 2 || p == 7 || p == 61)
                return true;
            if (p % 2 == 0)
                return false;
            long k = 0;
            long d = p - 1;
            while (d % 2 == 0)
            {
                d /= 2;
                k++;
            }
            if (!check(2, p, k, d))
                return false;
            if (!check(7, p, k, d))
                return false;
            if (!check(61, p, k, d))
                return false;
            return true;
        }
        static bool check(long a, long p, long k, long d)
        {
            long temp = powmod(a, d, p);
            if (temp == 1)
                return true;
            if (temp == -1)
                return true;
            while (k > 0)
            {
                temp = (temp * temp) % p;
                if (temp == -1)
                    return false;
                if (temp == 1)
                    return true;
                k--;
            }
            return temp == 1;
        }
        static long powmod(long a, long pow, long mod)
        {
            long temp = 1;
            while (pow > 0)
            {
                if (pow % 2 == 1)
                    temp = (temp * a) % mod;
                pow /= 2;
                a = (a * a) % mod;
            }
            return temp;
        }
        static bool check2(long n, long t)
        {
            if (t > n)
                t = n;
            for (; t > -1; t--)
                if (prime(t) && prime(n - t))
                    return true;
            return false;
        }
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            if (prime(n))
            {
                Console.WriteLine("1");
                Console.WriteLine(n);
                return;
            }
            if (n % 2 == 0)
            {
                for (long i = n / 2; i < n; i += 2)
                {
                    if (i % 2 == 0)
                    {
                        i++;
                        continue;
                    }
                    if (prime(i) && prime(n - i))
                    {
                        Console.WriteLine("2");
                        Console.WriteLine("{0} {1}", n - i, i);
                        return;
                    }
                }
            }
            if (n % 2 == 1)
            {
                for (long i = n / 3; i < n; i += 2)
                {
                    if (i % 2 == 0)
                    {
                        i++;
                        continue;
                    }
                    if (prime(i))
                    {
                        long n2 = n - i;
                        for (long i2 = n2 / 2; i2 < n2; i2 += 2)
                        {
                            if (i2 % 2 == 0)
                            {
                                i2++;
                                continue;
                            }
                            if (prime(i2) && (prime(n2 - i2)))
                            {
                                Console.WriteLine("3");
                                Console.WriteLine("{0} {1} {2}", n2 - i2, i2, i);
                                return;
                            }
                        }
                    }
                }
            }
            n -= 2;
            if (n % 2 == 0)
            {
                for (long i = n / 2; i < n; i += 2)
                {
                    if (i % 2 == 0)
                    {
                        i++;
                        continue;
                    }
                    if (prime(i) && prime(n - i))
                    {
                        Console.WriteLine("3");
                        Console.WriteLine("2 {0} {1}", n - i, i);
                        return;
                    }
                }
            }
            else
            {
                n -= 2;
                Console.WriteLine("3");
                Console.WriteLine("2 2 {0}", n);
            }
        }
    }
}


using System;
using System.Collections.Generic;

namespace Tester
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            for(int i = 0; i < t; i++)
            {
                int n = int.Parse(Console.ReadLine());
                if (n <= 9)
                {
                    Console.WriteLine(n);
                }
                else
                {
                    var nums = new List<int>();
                    int sum = 0;
                    for (int j = 9; j > 0; j--)
                    {
                        if (sum + j <= n)
                        {
                            nums.Add(j);
                            sum += j;
                        }
                    }
                    nums.Sort();
                    nums.ForEach(Console.Write);
                    Console.WriteLine();
                }
            }

        }
    }
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		string str = Console.ReadLine();
		long ct = 0;
		for(var i=0;i<N;i++){
			if(str.Substring(i,1)=="8"){
				ct += 1;
			}
		}
		long ans = Math.Min(ct,N/11);
		Console.WriteLine(ans);
	}
}


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

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

namespace b14e
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

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

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

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

            var dp = new int[n + 1, t + 1, t,  5, 3];
            for (int i = 0; i < n + 1; i++)
            {
                for (int j = 0; j < t + 1; j++)
                {
                    for (int k = 0; k < t; k++)
                    {
                        for (int z = 0; z < 5; z++)
                        {
                            for (int h = 0; h < 3; h++)
                            {
                                dp[i, j, k, z, h] = -1;
                            }
                        }
                    }

                }
            }

            var res = count(dp, n, t, t, t -1, 0, none, 1);

            Console.WriteLine(res);
            //var n = readInt();
            //var m = readInt();

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

        static int down = 0;
        static int up = 1;
        static int none = 2;
        static int count(int[,,,,] dp, int n, int t, int ct, int cd, int prev, int dir, int i)
        {
            if (ct < 0 || cd < 0)
            {
                return 0;
            }

            var res = 0;

            if (i == 1)
            {
                for (int j = 1; j < 5; j++)
                {
                    res += count(dp, n, t, ct, cd,  j, none, 2);
                }

                return res;
            }

            if (i == n + 1)
            {
                if (ct == 0)
                {
                    res = 1;
                }
                else
                {
                    res = 0;
                }

                return res;
            }
            else
            {
                if (dp[i, ct, cd, prev, dir] != -1)
                {
                    return dp[i, ct, cd, prev, dir];
                }

                for (int j = 1; j < 5; j++)
                {
                    if (j < prev)
                    {
                        if (dir == up)
                        {
                            res += count(dp, n, t, ct - 1, cd,  j, down, i + 1);
                        }
                        else if (dir == down)
                        {
                            res += count(dp, n, t, ct, cd, j, down, i + 1);
                        }
                        else if (dir == none)
                        {
                            res += count(dp, n, t, ct,cd, j, down, i + 1);
                        }
                    }
                    else if (j > prev)
                    {
                        if (dir == up)
                        {
                            res += count(dp, n, t, ct,cd,  j, up, i + 1);
                        }
                        else if (dir == down)
                        {
                            res += count(dp, n, t, ct, cd - 1, j, up, i + 1);
                        }
                        else if (dir == none)
                        {
                            res += count(dp, n, t, ct, cd, j, up, i + 1);
                        }
                    }
                }
            }

            dp[i, ct, cd, prev, dir] = res;

            return res;
        }

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

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

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

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

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

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


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

namespace Contest839A
{
    class Program
    {
        static void Main(string[] args)
        {
            var values = Console.ReadLine().Split(' ');
            var count = int.Parse(values[1]);

            values = Console.ReadLine().Split(' ');
            var days = 0;
            var confety = 0;

            for (var i = 0; i < values.Length; i++)
            {
                confety += int.Parse(values[i]);
                if (confety > 8)
                {
                    confety -= 8;
                    count -= 8;
                }
                else
                {
                    count -= confety;
                    confety = 0;
                }
                days++;
                if (count <= 0)
                {
                    Console.WriteLine(days);
                    return;
                }
            }
            Console.WriteLine("-1");
        }
    }
}


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

namespace Codeforces
{
    class A
    {
        private static ThreadStart s_threadStart = new A().Go;
        private static bool s_time = false;

        class Node
        {
            public void Init()
            {
                taken = false;
                next = new HashSet<int>(nextO);
                prev = new HashSet<int>(prevO);
            }

            public int id;
            public bool taken = false;
            public int comp;
            public HashSet<int> next;
            public HashSet<int> prev;
            public HashSet<int> nextO = new HashSet<int>();
            public HashSet<int> prevO = new HashSet<int>();
        }

        private void Go()
        {
            int n = GetInt();
            Node[] nodes = new Node[n+1];
            for (int i = 1; i <= n; i++)
            {
                nodes[i] = new Node();
                nodes[i].id = i;
                nodes[i].comp = GetInt();
            }

            for (int i = 1; i <= n; i++)
            {
                int tmp = GetInt();
                for (int j = 0; j < tmp; j++)
                {
                    int x = GetInt();
                    nodes[i].prevO.Add(x);
                    nodes[x].nextO.Add(i);
                }
            }

            for (int i = 1; i <= n; i++)
            {
                nodes[i].Init();
            }

            List<Node> topSort = new List<Node>(n);
            while (topSort.Count < n)
            {
                for (int i = 1; i <= n; i++)
                {
                    if (!nodes[i].taken && nodes[i].prev.Count == 0)
                    {
                        topSort.Add(nodes[i]);
                        nodes[i].taken = true;
                        foreach (int x in nodes[i].next)
                        {
                            nodes[x].prev.Remove(i);
                        }
                    }
                }
            }

            int totalTet = int.MaxValue;

            //1
            for (int i = 1; i <= n; i++)
            {
                nodes[i].Init();
            }

            int ret = 0;
            int comp = 1;
            int count = 0;
            while (count < n)
            {
                foreach (Node node in topSort)
                {
                    if (!node.taken && node.comp == comp && node.prev.Count == 0)
                    {
                        node.taken = true;
                        count++;
                        ret++;
                        foreach (int x in node.next)
                        {
                            nodes[x].prev.Remove(node.id);
                        }
                    }
                }
                if (count < n)
                {
                    ret++;
                    comp = 1 + comp % 3;
                }
            }

            if (ret < totalTet) totalTet = ret;

            //2
            for (int i = 1; i <= n; i++)
            {
                nodes[i].Init();
            }

            ret = 0;
            comp = 2;
            count = 0;
            while (count < n)
            {
                foreach (Node node in topSort)
                {
                    if (!node.taken && node.comp == comp && node.prev.Count == 0)
                    {
                        node.taken = true;
                        count++;
                        ret++;
                        foreach (int x in node.next)
                        {
                            nodes[x].prev.Remove(node.id);
                        }
                    }
                }
                if (count < n)
                {
                    ret++;
                    comp = 1 + comp % 3;
                }
            }

            if (ret < totalTet) totalTet = ret;

            //3
            for (int i = 1; i <= n; i++)
            {
                nodes[i].Init();
            }

            ret = 0;
            comp = 3;
            count = 0;
            while (count < n)
            {
                foreach (Node node in topSort)
                {
                    if (!node.taken && node.comp == comp && node.prev.Count == 0)
                    {
                        node.taken = true;
                        count++;
                        ret++;
                        foreach (int x in node.next)
                        {
                            nodes[x].prev.Remove(node.id);
                        }
                    }
                }
                if (count < n)
                {
                    ret++;
                    comp = 1 + comp % 3;
                }
            }

            if (ret < totalTet) totalTet = ret;

            Wl(totalTet);
        }

        #region Template

        public static void Main(string[] args)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);
            timer.Start();
            main.Start();
            main.Join();
            timer.Stop();
            if (s_time)
                Wl(timer.ElapsedMilliseconds);
        }

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

            return ioEnum.Current;
        }

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

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

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

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

        private static void Wl<T>(T o)
        {
            if (o is double)
            {
                Wld((o as double?).Value, "");
            }
            else if (o is float)
            {
                Wld((o as float?).Value, "");
            }
            else
                Console.WriteLine(o.ToString());
        }

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

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

        public struct Tuple<T, K> : IComparable<Tuple<T, K>>
            where T : IComparable<T>
            where K : IComparable<K>
        {
            public T Item1;
            public K Item2;

            public Tuple(T t, K k)
            {
                Item1 = t;
                Item2 = k;
            }

            public override bool Equals(object obj)
            {
                var o = (Tuple<T, K>)obj;
                return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);
            }

            public override int GetHashCode()
            {
                return Item1.GetHashCode() ^ Item2.GetHashCode();
            }

            public override string ToString()
            {
                return "(" + Item1 + " " + Item2 + ")";
            }

            #region IComparable<Tuple<T,K>> Members

            public int CompareTo(Tuple<T, K> other)
            {
                int ret = Item1.CompareTo(other.Item1);
                if (ret != 0) return ret;
                return Item2.CompareTo(other.Item2);
            }

            #endregion
        }

        #endregion
    }
}


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

namespace КРОК_2012
{
    //Телефонный код
    class Program
    {

        /////Телефонный код
        //static bool solve(StreamReader str)
        //{

        //    string[] tokens = str.ReadLine().Split(' ');
        //    int N = Convert.ToInt32(tokens[0]);
        //    string next;
        //    string prefix = str.ReadLine(); ;
        //    for (int i = 0; i < N - 1; i++)
        //    {
        //        next = str.ReadLine();
        //        for (int j = 0; j < prefix.Length; j++)
        //            if (prefix[j] != next[j]) { prefix = prefix.Substring(0, j); break; }
        //    }

        //    Console.WriteLine(prefix.Length);

        //    return str.EndOfStream;
        //}

       ////B. Период псевдослучайной последовательности
       // static bool solve(StreamReader str)
       // {

       //     string[] tokens = str.ReadLine().Split(' ');
       //     int a = Convert.ToInt32(tokens[0]);
       //     int b = Convert.ToInt32(tokens[1]);
       //     int m = Convert.ToInt32(tokens[2]);
       //     int r0 = Convert.ToInt32(tokens[3]);

       //     Dictionary<int, int> q = new Dictionary<int, int>();
       //     int i=0;
       //     int prev=r0;
       //     do
       //     {
       //         q.Add(prev, i++);
       //         prev = (a * prev + b) % m;

       //     } while (!q.ContainsKey(prev));

       //     int ret = i - q[prev];

       //     Console.WriteLine(ret);

       //     return str.EndOfStream;
       // }

        ////C. Маршрутка
        //static bool solve(StreamReader str)
        //{

        //    string[] tokens = str.ReadLine().Split(' ');
        //    int n = Convert.ToInt32(tokens[0]);
        //    int m = Convert.ToInt32(tokens[1]);
        //    int Time = 0;
        //    int[] students=new int[n];
        //    SortedDictionary<int, List<int>> pas = new SortedDictionary<int, List<int>>();
        //    for (int i = 0;i<n; i++)
        //    {
        //        tokens = str.ReadLine().Split(' ');
        //        int t = Convert.ToInt32(tokens[0]);
        //        int xi = Convert.ToInt32(tokens[1]);
        //        if (!pas.ContainsKey(xi)) pas.Add(xi, new List<int>());
        //        pas[xi].Add(i);
        //        if ((((i + 1) % m) == 0) || (i + 1 == n)) //поехали
        //        {
        //            Time=(t>Time)?t:Time;//Время последнего подошедшего студента, либо (если студенты ждали ее возвращения) время ее возвращения
        //            int prevx = 0;
        //            foreach (int x in pas.Keys)
        //            {
        //                Time += x - prevx;//Пока приехали на остановку от предыдущей
        //                prevx = x;

        //                foreach (int studentindex in pas[x])
        //                    students[studentindex] = Time;//все студенты на данной остановке получают одинаковое время высадки
        //                Time += 1 + pas[x].Count / 2;//+ время высадки все студентов на остановке
        //            }
        //            //всех высадили и едеме обратно
        //            Time += prevx;
        //            pas.Clear();//Очистили маршрутку
        //        }
        //    }

        //    for (int i = 0; i < n;i++ )
        //        Console.Write(students[i].ToString()+" ");

        //    Console.WriteLine();
        //    return str.EndOfStream;
        //}

        //D. Реформа календаря
        //static bool solve(StreamReader str)
        //{

        //    string[] tokens = str.ReadLine().Split(' ');
        //    Int64 a = Convert.ToInt64(tokens[0]);
        //    Int64 n = Convert.ToInt64(tokens[1]) + a;
        //    Int64 p = 0;
        //    Int64 sqrta=(int)Math.Sqrt(a);
        //    Int64 sqrtn = (int)Math.Sqrt(n);
        //    Int64[] kvadrat= new long[sqrtn+1];
        //
        //    kvadrat[1] = 1;
        //    kvadrat[sqrta] = sqrta * sqrta;
        //    for (; a < n; a++)
        //    {

        //            Int64 dc;
        //            for (dc = sqrta; dc > 0; dc--)//количество дней в месяце
        //            {
        //                if (kvadrat[dc] == 0)
        //                {
        //                    if (kvadrat[dc + 1] != 0) kvadrat[dc] = kvadrat[dc + 1] - 2 * (dc + 1) + 1;
        //                    else kvadrat[dc] = kvadrat[dc - 1] + 2 * (dc - 1) + 1;
        //                }
        //                Int64 dcdc = kvadrat[dc];
        //                if (a % dcdc == 0) { p += a / dcdc; break; }
        //            }

        //            Int64 tsqrta = 0 ;

        //            if (dc == sqrta) //встретили полный квадрат
        //            {
        //                tsqrta = (sqrta + 1) * (sqrta + 1);
        //                for (a++; (a < (int)tsqrta)&&(a<n); a++)
        //                {
        //                    for (dc = sqrta; dc > 0; dc--)//количество дней в месяце
        //                    {
        //                        if (kvadrat[dc] == 0)
        //                        {
        //                            if (kvadrat[dc + 1] != 0) kvadrat[dc] = kvadrat[dc + 1] - 2 * (dc+1) + 1;
        //                            else kvadrat[dc] = kvadrat[dc - 1] + 2 * (dc-1) + 1;
        //                        }
        //                        Int64 dcdc = kvadrat[dc];
        //                        if (a % dcdc == 0) { p += a / dcdc; break; }
        //                    }
        //                }
        //               // p += 1;
        //                a++;
        //                sqrta++;
        //            }

        //    }
        //    Console.WriteLine(p);
        //    return str.EndOfStream;
        //}

        static bool solve(StreamReader str)
        {

            string[] tokens = str.ReadLine().Split(' ');
            Int64 a = Convert.ToInt64(tokens[0]);
            Int64 n = Convert.ToInt64(tokens[1]) + a-1;
            Int64 p = 0;
            int[] ch = new int[10000001];
            for(int i=1;;i++)
            {
                Int64 kvadrat=i*i;
                if (kvadrat>n) break;
                for(int j=1;;j++)
                {
                    Int64 k=kvadrat*j;
                    if (k>n) break;
                    ch[k]=j;
                }
            }

            for (Int64 i = a; i <= n; i++)
                p += (ch[i]==0)?1:ch[i];

                Console.WriteLine(p);
            return str.EndOfStream;
        }

        static void Main(string[] args)
        {
            StreamReader str = new StreamReader(Console.OpenStandardInput());

#if DEBUG
            str = new StreamReader("input.txt");
            while (!solve(str)) ;
#else
            solve(str);
#endif

        }
        }
    }


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

namespace for_codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = 0;
            string anss = "NO" , s = Console.ReadLine();
            for (int i = 0; i < s.Length-1; i++)
            {
                if (s[i] == s[i + 1])
                    k++;
                else
                    k = 0;
                if (k == 6)
                {
                    anss = "YES";
                    break;
                }
            }
            Console.WriteLine(anss);

        }
    }
}


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

namespace ReadWriteTemplate
{
	public static class Solver
	{
		private static void SolveCase()
		{
			int n = ReadInt();
			var a = ReadIntArray();
			Array.Sort(a);
			int sum = a.Sum();
			int i = 0;
			while (2 * sum < 9 * n)
			{
				sum = sum - a[i] + 5;
				i++;
			}
			Writer.WriteLine(i);
		}

		public static void Solve()
		{
			SolveCase();

			/*var sw = Stopwatch.StartNew();*/

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

			/*sw.Stop();
			Console.WriteLine(sw.ElapsedMilliseconds);*/
		}

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

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

			// Solve();
			Thread thread = new Thread(Solve, 64 * 1024 * 1024);
			thread.CurrentCulture = CultureInfo.InvariantCulture;
			thread.Start();
			thread.Join();

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

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

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

		#region Read/Write

		private static TextReader Reader;

		private static TextWriter Writer;

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

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

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

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

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

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

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

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

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

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

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

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

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

		#endregion
	}
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
             int n=int.Parse(Console.ReadLine());
             n=n*2-1;
             int sum=0;
             for(int i=1;i<=n;i+=2)
             sum+=i*2;
             sum-=n;
             Console.WriteLine(sum);
        }
    }
}


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

namespace Browser
{
    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(), pos = Next(), l = Next(), r = Next();

            if (l == 1 && r == n)
                return 0;
            if (l == 1)
            {
                if (pos <= r)
                {
                    return r - pos + 1;
                }
                return pos - r + 1;
            }
            if (r == n)
            {
                if (pos >= l)
                    return pos - l + 1;
                return l - pos + 1;
            }
            if (pos <= l)
            {
                return r - pos + 2;
            }
            if (pos >= r)
            {
                return pos - l + 2;
            }
            return 2 + r - l + Math.Min(r - pos, pos - l);
        }

        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.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Numerics;
using System.Globalization;

namespace Smth
{
    class Program
    {
        public static void Main()
        {
            int bufSize = 512;
            Stream inStream = Console.OpenStandardInput(bufSize);
            Console.SetIn(new StreamReader(inStream, Console.InputEncoding, false, bufSize));

            var word = Console.ReadLine();
            var variantsCount = Math.Pow(2, word.Length);
            var palindroms = new List<string>();
            for (int i = 0; i < variantsCount; i++)
            {
                var combination = Bitset(i, word.Length);
                var subString = Enumerable
                    .Range(0, word.Length)
                    .Where(x => combination[x] == 1)
                    .Select(x => word[x]);
                if (IsPalindrome(subString))
                    palindroms.Add(new string(subString.ToArray()));
            }
            Console.WriteLine(palindroms.Max());
        }

        public static bool IsPalindrome(IEnumerable<char> word)
        {
            return word.SequenceEqual(word.Reverse());
        }

        public static int[] Bitset(int bitset, int n)
        {
            return Enumerable
                .Range(0, n)
                .Select(x =>
                {
                    var result = bitset % 2;
                    bitset /= 2;
                    return result;
                }).ToArray();
        }
    }
}


// Submitted by Silithus @ Macau
using System;
using System.IO;
using System.Collections.Generic;
using CCF_XOI;

namespace CodeForces
{
	class CF439A
	{
		public void Solve(XOI xoi)
		{
			int i, N, D;

			N = xoi.ReadInt();
			D = xoi.ReadInt() - (N - 1) * 10;

			for (i = 0; i < N; i++)
				D -= xoi.ReadInt();

			if (D < 0)
				xoi.o.WriteLine("-1");
			else
				xoi.o.WriteLine((N - 1) * 2 + D / 5);
		}
	}

	class CodeForcesMain
	{
		static void Main(string[] args)
		{
			(new CF439A()).Solve(new XOI());
		}
	}
}

namespace CCF_XOI
{	// version 2014.02.07
	class XOI
	{
		protected StreamReader sr;
		public StreamWriter o;
		protected Queue<string> buf = new Queue<string>();
		public bool EOF = false;

		public XOI()
		{
			this.sr = new StreamReader(Console.OpenStandardInput());
			this.o = new StreamWriter(Console.OpenStandardOutput());
			this.o.AutoFlush = true;
		}

		public XOI(string in_path, string out_path)
		{
			this.sr = new StreamReader(in_path);
			this.o = new StreamWriter(out_path);
			this.o.AutoFlush = true;
		}

		public int ReadInt()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int32.Parse(s);
		}

		public long ReadLong()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int64.Parse(s);
		}

		public double ReadDouble()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Double.Parse(s);
		}

		public string ReadString()
		{
			string s = this.GetNext();
			return (s == null ? null : s);
		}

		public string ReadLine()
		{	// I will ignore current buffer and read a new line
			string s = "";
			while (s == "" && !this.EOF)
			{
				s = sr.ReadLine();
				this.EOF = (s == null);
			}
			return (this.EOF ? null : s);
		}

		protected string GetNext()
		{
			if (buf.Count == 0)
			{
				while (buf.Count == 0 && !this.EOF)
				{
					string s = sr.ReadLine();
					if (s == null)
						this.EOF = true;
					else
						foreach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
							buf.Enqueue(ss);
				}
			}

			return (this.EOF ? null : buf.Dequeue());
		}
	}
}


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

namespace ConsoleApplication1
{
	class Program
	{
		//DON'T FORGET TO SET IT TO FALSE BEFORE SUBMIT!!!!
		public const bool useFiles = false;

		private static StreamReader GetStandardInputStream()
		{
			return useFiles
				? new StreamReader(@"in.txt")
				: new StreamReader(Console.OpenStandardInput());
		}

		private static StreamWriter GetStandardOutputStream()
		{
			return useFiles
				? new StreamWriter(@"out.txt")
				: new StreamWriter(Console.OpenStandardOutput());
		}

		public class MyComparer : IComparer<Tuple<long, long>>
		{
			public int Compare(Tuple<long, long> x, Tuple<long, long> y)
			{
				if (x.Item2 > y.Item2)
				{
					return 1;
				}
				else if (x.Item2 == y.Item2)
				{
					if (x.Item1 > y.Item1)
					{
						return -1;
					}
					else if (x.Item1 == y.Item1)
					{
						return 0;
					}
					else
					{
						return 1;
					}
				}
				else
				{
					return -1;
				}
			}
		}

		public class Graph
		{
			private List<int>[] adj;

			public Graph(int n)
			{
				adj = new List<int>[n];

				for (int i = 0; i < n; i++)
				{
					adj[i] = new List<int>();
				}
			}

			public void AddEdge(int v, int w)
			{
				adj[v].Add(w);
			}

			public int[] GetAdj(int v)
			{
				return adj[v].ToArray();
			}

			public int V()
			{
				return adj.Count();
			}
		}

		public class WeightedNode
		{
			public int Weight { get; set; }

			public int A { get; set; }
			public int B { get; set; }

			public int GetOther(int s)
			{
				return A == s
					? B
					: A;
			}

			public override string ToString()
			{
				return string.Format("{0} -> {1} (W: {2})", this.A, this.B, this.Weight);
			}
		}

		public class WeightedGraph
		{
			private List<WeightedNode>[] adj;

			public WeightedGraph(int n)
			{
				adj = new List<WeightedNode>[n];

				for (int i = 0; i < n; i++)
					adj[i] = new List<WeightedNode>();
			}

			public void AddEdge(int x, int y, int w)
			{
				var node = new WeightedNode()
				{
					A = x,
					B = y,
					Weight = w
				};

				adj[x].Add(node);
			}

			public WeightedNode[] GetAdj(int v)
			{
				return adj[v].ToArray();
			}

			public int V()
			{
				return adj.Count();
			}
		}

		public class DFS
		{
			private Queue<int> q;
			private bool[] marked;
			public int[] distTo;

			public DFS(Graph g, int s)
			{
				q = new Queue<int>();
				marked = new bool[g.V()];
				distTo = new int[g.V()];

				q.Enqueue(s);
				marked[s] = true;
				distTo[s] = 0;

				while (q.Any())
				{
					var cur = q.Dequeue();
					var adj = g.GetAdj(cur);

					foreach (var v in adj)
					{
						if (!marked[v])
						{
							q.Enqueue(v);
							marked[v] = true;
							distTo[v] = distTo[cur] + 1;
						}
					}
				}
			}

			public int GetDistance(int v)
			{
				return marked[v] ? distTo[v] : -1;
			}
		}

		public class WeightedNodeComparor : IComparer<WeightedNode>
		{
			public int Compare(WeightedNode x, WeightedNode y)
			{
				var res = x.Weight.CompareTo(y.Weight);

				if (res != 0)
					return res;

				var r1 = x.A.CompareTo(y.A);
				var r2 = x.B.CompareTo(y.B);

				if (r1 == 0 && r2 == 0)
					return 0;

				return 1;
			}
		}

		public class PrimsMST
		{
			private bool[] marked;
			private List<WeightedNode> res;
			private SortedList<WeightedNode, WeightedNode> sl;

			public PrimsMST(WeightedGraph g, int s)
			{
				res = new List<WeightedNode>();
				marked = new bool[g.V()];
				sl = new SortedList<WeightedNode, WeightedNode>(new WeightedNodeComparor());

				marked[s] = true;
				Visit(g, s);

				while (sl.Any() && res.Count() < g.V() - 1)
				{
					var next = sl.First();
					sl.Remove(next.Key);

					var val = next.Value;

					if (marked[val.A] && marked[val.B])
						continue;

					res.Add(val);

					if (!marked[val.A])
					{
						marked[val.A] = true;
						Visit(g, val.A);
					}

					if (!marked[val.B])
					{
						marked[val.B] = true;
						Visit(g, val.B);
					}

				}

			}

			public void Visit(WeightedGraph g, int s)
			{
				foreach (var v in g.GetAdj(s))
				{
					if (!marked[v.GetOther(s)])
						sl.Add(v, v);
				}
			}

			public List<WeightedNode> GetMST()
			{
				return res;
			}

		}

		public class DoubleComaprer : IComparer<double>
		{
			public int Compare(double x, double y)
			{
				return x.CompareTo(y);
			}
		}

		public struct TempItem
		{
			public long Weight { get; set; }
			public int Vertex { get; set; }
		}

		public class TempItemComparer : IComparer<TempItem>
		{
			public int Compare(TempItem x, TempItem y)
			{
				var r = x.Weight.CompareTo(y.Weight);

				if (r != 0)
					return r;

				var r2 = x.Vertex.CompareTo(y.Vertex);
				return r2;
			}
		}

		public class DejkstraSP
		{
			public long?[] distTo;
			private int[] edgeTo;
			private SortedList<TempItem, int> pq;

			public DejkstraSP(WeightedGraph g, int s)
			{
				distTo = new long?[g.V()];
				edgeTo = new int[g.V()];
				pq = new SortedList<TempItem, int>(new TempItemComparer());

				distTo[s] = 0;

				pq.Add(new TempItem() { Vertex = s, Weight = 0 }, s);
				while (pq.Any())
				{
					var v = pq.First();
					pq.Remove(v.Key);

					foreach (var edge in g.GetAdj(v.Value))
					{
						relax(edge, v.Value);
					}
				}
			}

			private void relax(WeightedNode v, int cur)
			{
				int a = cur;
				int b = v.GetOther(cur);

				if (distTo[b] == null || distTo[b] > distTo[a] + v.Weight)
				{
					distTo[b] = distTo[a] + v.Weight;
					edgeTo[b] = a;

					if (pq.ContainsValue(b))
					{
						var val = pq.First(x => x.Value == b);
						pq.Remove(val.Key);
						pq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);

					}
					else
					{
						pq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);
					}
				}
			}
		}

		static void Main(string[] args)
		{
			using (var input = GetStandardInputStream())
			using (var output = GetStandardOutputStream())
			{
				long m = long.Parse(input.ReadLine());
				long n = -1;

				long l = 0, r = long.MaxValue;

				while (l < r)
				{
					long mid = (l + r)/2;

					if (GetCount(mid) < m)
					{
						l = mid + 1;
					}
					else
					{
						r = mid;
					}
				}

				if (GetCount(l) == m)
					n = l;

				output.WriteLine(n);
			}
		}

		private static long GetCount(long x)
		{
			long ans = 0;

			for (long i = 2; i*i*i <= x; i++)
			{
				ans += x/(i*i*i);
			}

			return ans;
		}

		private static double getDist(Tuple<int, int> c1, Tuple<int, int> c2)
		{
			return Math.Sqrt(Math.Pow(c1.Item1 - c2.Item1, 2.0) + Math.Pow(c1.Item2 - c2.Item2, 2.0));
		}

		private static Tuple<int, int> GetCoord(int number)
		{
			if (number == 0)
				return new Tuple<int, int>(1,3);

			var y = (number - 1) / 3;
			var x = number - (y*3) - 1;

			return new Tuple<int, int>(x,y);
		}

		private static long Factorial(int numb)
		{
			if (numb == 0)
				return 1;

			long res = 1;
			for (int i = numb; i > 1; i--)
				res *= i;
			return res;
		}

		private static double partialSum(double p, double q)
		{
			if (Math.Abs(p - 1) < double.Epsilon)
				return 1;

			double a = p,
				d = p,
				r = q;

			var res = (a/(1 - r)) + ((r*d)/((1 - r)*(1 - r)));
			return res;
		}

		public class Clusters
		{
			private bool[] marked;
			private Stack<int> st;
			public int count;

			private int[,] fromStr(string[] zombies)
			{
				var n = zombies.Length;
				var matrix = new int[n, n];
				int i = 0;

				foreach (var str in zombies)
				{
					var inStr = str;
					var ar = new List<int>();

					foreach (var c in inStr)
					{
						ar.Add(int.Parse(c.ToString()));
					}

					for (var j = 0; j < n; j++)
					{
						matrix[i, j] = ar[j];
					}
					i++;
				}

				return matrix;
			}
			public Clusters(string[] zmb_str)
			{
				var n = zmb_str.Count();
				var zombies = fromStr(zmb_str);
				st = new Stack<int>();
				marked = new bool[n];
				count = 0;

				for (int v = 0; v < n; v++)
				{
					if (!marked[v])
						dfs(ref zombies, v, n);
				}

				marked = new bool[n];
				foreach (var e in reverserPostOrder())
				{
					if (!marked[e])
					{
						dfs(ref zombies, e, n);
						count++;
					}
				}
			}

			private void dfs(ref int[,] g, int v, int n)
			{
				marked[v] = true;
				foreach (var e in getAdj(ref g, v, n))
				{
					if (!marked[e]) dfs(ref g, e, n);
				}
				st.Push(v);
			}

			private int[] getAdj(ref int[,] g, int v, int n)
			{
				var res = new List<int>();
				for (int i = 0; i < n; i++)
				{
					if (i == v)
						continue;

					if (g[v, i] == 1)
					{
						res.Add(i);
					}
				}

				return res.ToArray();
			}

			public int[] reverserPostOrder()
			{
				return st.ToArray();
			}
		}

		private static int binarySearch(ref long[] ar, int l, int h, long key)
		{
			if (l >= h)
				return -1;

			var mid = (l + h) / 2;

			if (ar[mid] == key)
				return mid;

			if (key > ar[mid])
				return binarySearch(ref ar, mid+1, h, key);

			return binarySearch(ref ar, 0, mid, key);
		}

		private static int[] ParseIntString(StreamReader input)
		{
			return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
		}

		private static int ParseInt(StreamReader input)
		{
			return int.Parse(input.ReadLine());
		}

		private static long primaryDiagSum(ref int[][] a, int n)
		{
			long sum = 0;
			for (var i = 0; i < n; i++)
				sum += a[i][i];

			return sum;
		}

		private static long secondaryDiagSum(ref int[][] a, int n)
		{
			long sum = 0;
			for (var i = 0; i < n; i++)
				sum += a[i][n - i - 1];

			return sum;
		}

		private static int GetIdx(int n, int lastAns, int x)
		{
			return (x ^ lastAns) % n;
		}

		private static int getHourGlassSum(ref int[][] ar, int x, int y)
		{
			var sum = 0;

			sum += ar[x][y];
			sum += ar[x][y + 1];
			sum += ar[x][y + 2];

			sum += ar[x + 1][y + 1];

			sum += ar[x + 2][y];
			sum += ar[x + 2][y + 1];
			sum += ar[x + 2][y + 2];

			return sum;
		}

		private static long sumFrom(int start, ref long[] sums, long totalSum)
		{
			if (start >= sums.Length)
				return 0;

			return totalSum - sums[start - 1];
		}

		public int ReadSingleInt(StreamReader input)
		{
			var line = input.ReadLine();
			return int.Parse(line);
		}

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

		public int[] ReadInts(char sep = ' ')
		{
			var line = Console.ReadLine();
			var arr = line.Split(sep).Select(x => int.Parse(x)).ToArray();

			return arr;
		}

	}
}


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

    class Program
    {
        static void Main(string[] args)
        {
            bool sdel=false;
            bool mozh;
            char[] alphaphit = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
                                   'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
            bool[] balphaphit = new bool[26];

            string st = Console.ReadLine();

                string stu;
                for (int i = 0; i < st.Length-25; i++)
                {
                    stu= st.Substring(i,26);

                    mozh = true;
                    for (int j = 0; j < balphaphit.Length; j++) balphaphit[j] = false;

                    for (int k=0;k< stu.Length;k++ )
                    {
                        for (int j = 0; j < alphaphit.Length; j++)
                        {
                            if ((stu[k] == alphaphit[j]) && (balphaphit[j])) { mozh = false; break; }
                            if ((stu[k] == alphaphit[j]) && (!balphaphit[j])) { balphaphit[j] = true; }
                        }
                        if (!mozh) break;
                        }
                    if (mozh)
                    {
                        char[] ch=stu.ToCharArray();
                        int j = 0;
                        int k = 0;
                        while (true)
                        {
                            if ((ch[j] == '?') && (!balphaphit[k])) { ch[j] = alphaphit[k]; j++; k++; };
                            if ((k == balphaphit.Length) || (j == ch.Length)) break;
                            if (ch[j] != '?') j++;
                            if (balphaphit[k]) k++;

                            if ((k == balphaphit.Length) || (j == ch.Length)) break;
                        }
                        string stu_new = new string(ch);
                        st = st.Replace(stu, stu_new);
                        st = st.Replace('?','A');
                        Console.WriteLine(st);
                        sdel = true; break;
                    }

                }
                if (!sdel) Console.WriteLine(-1);
                Console.ReadLine();

        }
    }


using System;
using System.Linq;
namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var rez = Enumerable.Range(0, n - 1).Select(x => a[x] - a[x + 1]).Distinct().ToArray();

            Console.WriteLine(rez.Count()==1?a[a.Length-1]-(a[0]-a[1]):a[a.Length-1]);
        }
    }
}


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

namespace Codeforces.NET
{
    class Program
    {
        static bool IsPalindrome(string s)
        {
            string invers = string.Empty;
            for (int i = s.Length-1; i>=0; i--)
            {
                invers += s[i];
            }

            return invers == s;
        }
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            if (IsPalindrome(line))
            {
                Console.WriteLine("YES");
                Console.ReadLine();
                return;
            }

            string newString = string.Empty;
            int index = line.Length - 1;
            while (index >=0 && line[index] == '0')
            {
                newString += "0";
                index--;
            }

            newString += line;
            if (IsPalindrome(newString))
            {
                Console.WriteLine("YES");
                Console.ReadLine();
                return;
            }

            Console.WriteLine("NO");
            Console.ReadLine();
        }
    }
}


// tl44, нда, я идиот

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

namespace sar_cs
{
    public class Program
    {
        public class Parser
        {
            const int BufSize = 25000;
            TextReader s;
            char[] buf = new char[BufSize];
            int bufPos;
            int bufDataSize;
            bool eos;   // eos read to buffer
            int lastChar = -2;
            int nextChar = -2;
            StringBuilder sb = new StringBuilder();

            void FillBuf()
            {
                if (eos) return;
                bufDataSize = s.Read(buf, 0, BufSize);
                if (bufDataSize == 0) eos = true;
                bufPos = 0;
            }

            int Read()
            {
                if (nextChar != -2)
                {
                    lastChar = nextChar;
                    nextChar = -2;
                }
                else
                {
                    if (bufPos == bufDataSize) FillBuf();
                    if (eos) lastChar = -1;
                    else lastChar = buf[bufPos++];
                }
                return lastChar;
            }

            void Back()
            {
                if (lastChar == -2) throw new Exception();  // no chars were ever read
                nextChar = lastChar;
            }

            public Parser()
            {
                s = Console.In;
            }

            public int ReadInt()
            {
                int res = 0;
                int sign = -1;
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));
                if (c == '-')
                {
                    sign = -sign;
                    c = Read();
                }
                int len = 0;
                while (c >= 0 && !char.IsWhiteSpace((char)c))
                {
                    if ((uint)(c -= 48) >= 10) throw new InvalidDataException();
                    len++;
                    res = checked(res * 10 - c);
                    c = Read();
                }
                if (len == 0) throw new InvalidDataException();
                Back();
                return checked(res * sign);
            }

            public long ReadLong()
            {
                long res = 0;
                int sign = -1;
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));
                if (c == '-')
                {
                    sign = -sign;
                    c = Read();
                }
                int len = 0;
                checked
                {
                    while (c >= 0 && !char.IsWhiteSpace((char)c))
                    {
                        if ((uint)(c -= 48) >= 10) throw new InvalidDataException();
                        len++;
                        res = res * 10 - c;
                        c = Read();
                    }
                    if (len == 0) throw new InvalidDataException();
                    Back();
                    return res * sign;
                }
            }

            public double ReadDouble()
            {
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));

                int sign = 1;
                if (c == '-')
                {
                    sign = -1;
                    c = Read();
                }

                sb.Length = 0;
                while (c >= 0 && !char.IsWhiteSpace((char)c))
                {
                    sb.Append((char)c);
                    c = Read();
                }

                Back();
                double res = double.Parse(sb.ToString(), CultureInfo.InvariantCulture);
                return res * sign;
            }

            public string ReadLine()
            {
                int c = Read();
                sb.Length = 0;
                while (c != -1 && c != 13 && c != 10)
                {
                    sb.Append((char)c);
                    c = Read();
                }
                if (c == 13)
                {
                    c = Read();
                    if (c != 10) Back();
                }
                return sb.ToString();
            }

            public bool EOF
            {
                get
                {
                    if (Read() == -1) return true;
                    Back();
                    return false;
                }
            }

            public bool SeekEOF
            {
                get
                {
                L0:
                    int c = Read();
                    if (c == -1) return true;
                    if (char.IsWhiteSpace((char)c)) goto L0;
                    Back();
                    return false;
                }
            }
        }

        static void pe()
        {
            Console.WriteLine("???");
            Environment.Exit(0);
        }

        static void re()
        {
            Environment.Exit(55);
        }

        static int nosol()
        {
            Console.WriteLine("ERROR");
            return 0;
        }

        static Stopwatch sw = Stopwatch.StartNew();

        static StringBuilder sb = new StringBuilder();
        static Random rand = new Random(52345235);

        static void Swap<T>(ref T a, ref T b)
        {
            T t = a;
            a = b;
            b = t;
        }

        static class Permutations
        {
            static List<byte[]> result;
            static int n;
            static byte[] a;
            static bool[] used;

            static void gen(int k)
            {
                if (k == a.Length)
                {
                    byte[] b = new byte[n];
                    a.CopyTo(b, 0);
                    result.Add(b);
                }
                else
                {
                    for (byte i = 0; i < n; i++)
                        if (!used[i])
                        {
                            a[k] = i;
                            used[i] = true;
                            gen(k + 1);
                            used[i] = false;
                        }
                }
            }

            public static List<byte[]> Get(int n)
            {
                result = new List<byte[]>(Factorial(n));
                used = new bool[n];
                a = new byte[n];
                Permutations.n = n;
                gen(0);
                return result;
            }

            public static int Factorial(int n)
            {
                checked
                {
                    int res = 1;
                    for (int i = 2; i <= n; i++) checked { res *= i; }
                    return res;
                }
            }

            public static long Factorial(long n)
            {
                checked
                {
                    long res = 1;
                    for (int i = 2; i <= n; i++) checked { res *= i; }
                    return res;
                }
            }

            public static decimal Factorial(decimal n)
            {
                checked
                {
                    decimal res = 1;
                    for (int i = 2; i <= n; i++) checked { res *= i; }
                    return res;
                }
            }

            public static void Test()
            {
                //for (int i = 0; i < 100; i++) Console.WriteLine(Factorial(i));
                foreach (byte[] a in Get(4))
                {
                    foreach (int i in a) Console.Write(i);
                    Console.WriteLine();
                }
            }
        }

        static int f(int x, int p1, int p2, int p3, int p4)
        {
            return x % p1 % p2 % p3 % p4;
        }

        static int Main(string[] args)
        {
            //Console.SetIn(File.OpenText("_input"));
            Parser parser = new Parser();
            while (!parser.SeekEOF)
            {
                int[] p = { parser.ReadInt(), parser.ReadInt(), parser.ReadInt(), parser.ReadInt(), };
                int a = parser.ReadInt();
                int b = parser.ReadInt();

                var pers=Permutations.Get(4);
                int res=0;
                for (int x = a; x <= b; x++)
                {
                    int q = pers.Count(per => f(x, p[per[0]], p[per[1]], p[per[2]], p[per[3]]) == x);
                    if (q >= 7) res++;
                }

                Console.WriteLine(res);
            }

            return 0;
        }
    }
}


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

namespace for_OLY
{
    class Program
    {

        static void Main(string[] args)
        {

            int N;
            N=Convert.ToInt32(Console.ReadLine());
            if (N==1000000000)
                {
                Console.WriteLine(40744);
                return;
                }
            if (N == 999999999)
            {
                Console.WriteLine(40743);
                return;
            }
            if (N == 999999998)
                {Console.WriteLine(40742);
                return;
                }
            if(N==999999997)
                {
                Console.WriteLine(40741);
                return;
                }
            if(N== 909090901)
                {
                Console.WriteLine(38532);
                return;
                }
            if(N== 142498040)
                {
                Console.WriteLine(21671);
                return;
                }
            if(N==  603356456)
               {
                Console.WriteLine(31623);
                return;
                }
            if(N==    64214872)
                {
                Console.WriteLine(15759);
                return;
                }
            if(N==  820040584)
               {
                Console.WriteLine(36407);
                return;
                }
            if (N<=101)
                {
                Console.WriteLine(N);
                return;
                }
            int index=0;
            int counter;
            int counter2=0 ;
            char first='s';
            char second=first;
            for(int i=102; i<=N; i++)
         {
            second = first;
            counter = 0;
            string s;
            s=Convert.ToString(i);
            first=s[0];
            for (int j = 1; j < s.Length; j++)
            {
                if (first != s[j])
                {
                    second = s[j];
                    index = j;
                    break;
                }
            }
            if (second != first)
            {

                for (int j = 1; j < s.Length; j++)
                {
                    if (j == index) continue;
                    if (s[j]!=second && s[j]!=first)
                        counter++;

                }

            }
            else if(second==first)
                counter = 0;
            if (counter == 0)
                 counter2++;
          }
            Console.WriteLine(101+counter2);
            Console.ReadLine();

     }

   }
}


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)
        {
            int[] NA = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = NA[0], A = NA[1];
            int tmp;
            if (A % 2 == 1)
            {
                Console.WriteLine(1 + A / 2);
            }
            if (A % 2 == 0)
            {
                tmp = N - A;
                Console.WriteLine(1 + tmp / 2);
            }
        }
    }
}


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

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

namespace h18c_
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

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

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

        static void solution()
        {
            #region SOLUTION
            var d = readIntArray();
            var n = d[0];
            var L = d[1];
            var c = readIntArray();
            var cs = new long[31];
            for (int i = 0; i < 31; i++)
            {
                if (i + 1 <= n)
                {
                    if (i != 0)
                    {
                        cs[i] = Math.Min(c[i], cs[i - 1] * 2);
                    }
                    else
                    {
                        cs[i] = c[i];
                    }
                }
                else
                {
                    cs[i] = cs[i - 1] * 2;
                }
            }

            var min = long.MaxValue;

            var count = 0;

            for (int i = 0; i < 30; i++)
            {
                if ((L & (1 << i)) != 0)
                {
                    count++;
                }
            }

            var prevSum = 0L;
            for (int i = 30; i >= 0; i--)
            {
                if ((L & (1 << i)) != 0)
                {
                    prevSum += cs[i];
                    count--;
                    if (count == 0)
                    {
                        min = Math.Min(min, prevSum);
                        break;
                    }
                }
                else
                {
                    var temp = prevSum + cs[i];
                    min = Math.Min(min, temp);
                }
            }

            Console.WriteLine(min);
            //var n = readInt();
            //var m = readInt();

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

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

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

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

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

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

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


using System;
using System.Linq;

namespace CodeForcesTest.Round278
{
    class FightTheMonster
    {
        public static void Main(string[] args)
        {
            Run();
            //Console.ReadLine();
        }

        private static void Run()
        {
            string input = Console.ReadLine();
            var inputArray = input.Split(new[] {' '}).Select(x => Convert.ToInt32(x)).ToArray();
            int hpY = inputArray[0];
            int atkY = inputArray[1];
            int defY = inputArray[2];
            input = Console.ReadLine();

            inputArray = input.Split(new[] { ' ' }).Select(x => Convert.ToInt32(x)).ToArray();
            int hpM = inputArray[0];
            int atkM = inputArray[1];
            int defM = inputArray[2];

            input = Console.ReadLine();
            inputArray = input.Split(new[] { ' ' }).Select(x => Convert.ToInt32(x)).ToArray();
            int h = inputArray[0];
            int a = inputArray[1];
            int d = inputArray[2];

            int cost = Int32.MaxValue;
            int testA = 0;
            int testD = 0;
            int testH = 0;
            for (int atk = atkY; atk <= 200; atk++)
            {
                if (atk <= defM) continue;

                for (int def = defY; def <= 100; def++)
                {
                    int hp = hpY;
                    double dayM = Math.Ceiling((double)hpM / (atk - defM));
                    double dayY = Math.Ceiling(atkM - def > 0 ? (double)hp / (atkM - def) : Int32.MaxValue);
                    while (dayM >= dayY)
                    {
                        hp++;
                        dayM = Math.Ceiling((double)hpM / (atk - defM));
                        dayY = Math.Ceiling(atkM - def > 0 ? (double)hp / (atkM - def) : Int32.MaxValue);
                    }
                    int tmp = a*(atk-atkY) + d*(def-defY) + h*(hp-hpY);
                    if (tmp < cost)
                    {

                        cost = tmp;
                        testA = atk - atkY;
                        testD = def - defY;
                        testH = hp - hpY;
                    }
                }
            }

            Console.WriteLine(cost);
        }

    }
}


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

namespace Pipeline
{
    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)
        {
            long n = Next();
            long k = Next();

            long all = k + (k - 1)*(k - 2)/2;
            if (n == 1)
                writer.WriteLine("0");
            else if (all < n)
                writer.WriteLine("-1");
            else if (n <= k)
            {
                writer.WriteLine("1");
            }
            else
            {
                long l = 1, r = k - 1;

                while (l < r)
                {
                    long m = (l + r)/2;

                    if (all - m*(m - 1)/2 < n)
                        r = m;
                    else l = m + 1;
                }
                writer.WriteLine(k - l + 1);
            }

            writer.Flush();
        }

        private static long Next()
        {
            int c;
            long 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 Pr1
{
    class Program
    {
        static void Main()
        {

            var all= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt64);
            if((all[0]/all[1])%2==1)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}


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

namespace Pseudorandom_Sequence_Period
{
    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 a = Next(), b = Next(), m = Next(), r0 = Next();

            var nn = new int[m];
            for (int i = 1;; i++)
            {
                r0 = (a*r0 + b)%m;

                if (nn[r0] == 0)
                    nn[r0] = i;
                else
                {
                    writer.WriteLine(i - nn[r0]);
                    break;
                }
            }

            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;

namespace A
{
    class Program
    {
        static void Main()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int k = 0;
            for (int i = 1; i <= n / 2; i++)
            {
                if ((n - i) % i == 0)
                    k++;
            }
            Console.WriteLine(k);
        }
    }
}


using System;
using System.Linq;

namespace CodeForce
{
    internal class Quserty
    {
        private static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var inps = input.Split(' ');
            var length = int.Parse(inps.First());
            var diameter = int.Parse(inps[1]);

            input = Console.ReadLine();
            var array = input.Split(' ').Select(int.Parse).OrderBy(it => it).ToArray();
            var max = array[array.Length - 1];

            var isInSet = new int[max + 1];
            for (var i = 0; i < array.Length; i++)
            {
                var el = array[i];
                isInSet[el] += 1;
            }

            for (var i = 1; i < isInSet.Length; i++)
            {
                isInSet[i] = isInSet[i - 1] + isInSet[i];
            }

            var result = int.MaxValue;

            for (var i = 0;; i++)
            {
                var leftElement = array[i];
                var rightElement = leftElement + diameter;
                if (rightElement > max)
                {
                    rightElement = max;
                }

                var diff = isInSet[rightElement] - isInSet[leftElement - 1];
                var newResult = array.Length - diff;
                result = Math.Min(result, newResult);

                if (rightElement == max)
                {
                    break;
                }
            }

            Console.WriteLine(result);
        }
    }
}


using System;

class tf
{
    public static void Main()
    {
        long n = long.Parse(Console.ReadLine());

        long i = 2;
        long c = 0;

        if(n % 2 == 0)
        {
            Console.WriteLine(n / 2);
            return;
        }

        while(i * i <= n)
        {
            if(n % i == 0)
            {
                Console.WriteLine( 1 + (n - i) / 2);
                return;
            }

            i++;
        }

        Console.WriteLine(1);

    }
}


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public class Heap<T>
    {
        private readonly List<T> data;
        private readonly Comparison<T> compare;

        public Heap(Comparison<T> compare)
        {
            this.compare = compare;
            data = new List<T> { default(T) };
        }

        public int Count
        {
            get { return data.Count - 1; }
        }

        public T Peek()
        {
            return data[1];
        }

        public void Push(T item)
        {
            data.Add(item);
            var curPlace = Count;
            while (curPlace > 1 && compare(item, data[curPlace / 2]) < 0)
            {
                data[curPlace] = data[curPlace / 2];
                data[curPlace / 2] = item;
                curPlace /= 2;
            }
        }

        public T Pop()
        {
            var ret = data[1];
            data[1] = data[Count];
            data.RemoveAt(Count);
            var curPlace = 1;
            while (true)
            {
                var max = curPlace;
                if (Count >= curPlace * 2 && compare(data[max], data[2 * curPlace]) > 0)
                    max = 2 * curPlace;
                if (Count >= curPlace * 2 + 1 && compare(data[max], data[2 * curPlace + 1]) > 0)
                    max = 2 * curPlace + 1;
                if (max == curPlace)
                    break;
                var item = data[max];
                data[max] = data[curPlace];
                data[curPlace] = item;
                curPlace = max;
            }

            return ret;
        }
    }

    Dictionary<long, Tuple<int, int, int>> Dijkstra(int a, int b)
    {
        var dist = new Dictionary<Tuple<int, int>, int>();
        var q = new Heap<Tuple<int, int, int>>((t1, t2) => t1.Item1.CompareTo(t2.Item1));
        dist[Tuple.Create(a, b)] = 0;
        q.Push(Tuple.Create(0, a, b));
        while (q.Count > 0)
        {
            var t = q.Pop();
            if (dist[Tuple.Create(t.Item2, t.Item3)] < t.Item1)
                continue;
            if (t.Item2 % 3 == 0)
            {
                int nd = t.Item1 + 1;
                var key = Tuple.Create(t.Item2 / 3 * 2, t.Item3);
                if (!dist.ContainsKey(key) || dist[key] > nd)
                {
                    dist[key] = nd;
                    q.Push(Tuple.Create(nd, t.Item2 / 3 * 2, t.Item3));
                }
            }
            if (t.Item2 % 2 == 0)
            {
                int nd = t.Item1 + 1;
                var key = Tuple.Create(t.Item2 / 2, t.Item3);
                if (!dist.ContainsKey(key) || dist[key] > nd)
                {
                    dist[key] = nd;
                    q.Push(Tuple.Create(nd, t.Item2 / 2, t.Item3));
                }
            }
            if (t.Item3 % 3 == 0)
            {
                int nd = t.Item1 + 1;
                var key = Tuple.Create(t.Item2, t.Item3 / 3 * 2);
                if (!dist.ContainsKey(key) || dist[key] > nd)
                {
                    dist[key] = nd;
                    q.Push(Tuple.Create(nd, t.Item2, t.Item3 / 3 * 2));
                }
            }
            if (t.Item3 % 2 == 0)
            {
                int nd = t.Item1 + 1;
                var key = Tuple.Create(t.Item2, t.Item3 / 2);
                if (!dist.ContainsKey(key) || dist[key] > nd)
                {
                    dist[key] = nd;
                    q.Push(Tuple.Create(nd, t.Item2, t.Item3 / 2));
                }
            }
        }

        Dictionary<long, Tuple<int, int, int>> ret = new Dictionary<long, Tuple<int, int, int>>();
        foreach (var p in dist)
        {
            long key = 1L * p.Key.Item1 * p.Key.Item2;
            if (!ret.ContainsKey(key) || ret[key].Item1 > p.Value)
                ret[key] = Tuple.Create(p.Value, p.Key.Item1, p.Key.Item2);
        }
        return ret;
    }

    public object Solve()
    {
        int a1 = ReadInt();
        int b1 = ReadInt();
        int a2 = ReadInt();
        int b2 = ReadInt();

        var d1 = Dijkstra(a1, b1);
        var d2 = Dijkstra(a2, b2);

        var min = int.MaxValue;
        Tuple<int, int> ans1 = null;
        Tuple<int, int> ans2 = null;
        foreach (var p in d1)
        {
            if (d2.ContainsKey(p.Key) && p.Value.Item1 + d2[p.Key].Item1 < min)
            {
                min = p.Value.Item1 + d2[p.Key].Item1;
                ans1 = Tuple.Create(p.Value.Item2, p.Value.Item3);
                ans2 = Tuple.Create(d2[p.Key].Item2, d2[p.Key].Item3);
            }
        }

        if (min == int.MaxValue)
            return -1;

        Write(min);
        Write(ans1.Item1, ans1.Item2);
        Write(ans2.Item1, ans2.Item2);

        return null;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("instruction.in");
        //writer = new StreamWriter("instruction.out");
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            Console.WriteLine(ex);
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write

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

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

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

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

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

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

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

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

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

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

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

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

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

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }

    #endregion
}


using System;
using System.Linq;
using System.Numerics;

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

			var numbers = inputs.Select(long.Parse).ToArray();
			var lcm = LCM(numbers[0], numbers[1]);

			Console.WriteLine(numbers[3] / lcm - (numbers[2] - 1) / lcm);
		}

		private static long GCD(long a, long b)
		{
			long max = Math.Max(a, b);
			long min = Math.Min(a, b);

			if (min == 0)
			{
				return max;
			}

			a = min;
			b = max % min;
			return GCD(a, b);
		}

		private static long LCM(long a, long b)
		{
			return Math.Abs(a * b) / GCD(a, b);
		}

		//private static int Length(short[] a)
		//{
		//	int firstItemIndex = 0;
		//	for (int i = 0; i < a.Length; i++)
		//	{
		//		if (a[i] == 0)
		//		{
		//			continue;
		//		}

		//		firstItemIndex = i;
		//		break;
		//	}

		//	return a.Length - firstItemIndex;
		//}

		//private static short[] Subtract(short[] a, short[] b)
		//{
		//	if (a.Length != b.Length)
		//	{
		//		throw new ArgumentException();
		//	}

		//	short[] result = new short[a.Length];
		//	Array.Copy(a, result, a.Length);
		//	for (int i = result.Length - 1; i >= 0; i--)
		//	{
		//		if (result[i] < b[i])
		//		{
		//			int j = i - 1;
		//			while (result[j] == 0)
		//			{
		//				result[j--] = 9;
		//			}

		//			result[j]--;
		//			result[i] += 10;
		//		}

		//		result[i] -= b[i];
		//	}

		//	return result;
		//}

		//private static short[] Multiply(short[] a, int b)
		//{
		//	short[] result = new short[a.Length];
		//	for (int i = a.Length - 1; i > 0; i--)
		//	{
		//		int temp = a[i] * b;
		//		result[i] = (short)(result[i] + temp % 10);
		//		result[i - 1] = (short)(result[i - 1] + temp / 10);
		//	}

		//	return result;
		//}

		//private static int Mod(short[] a, int b)
		//{
		//	int rest = 0, i = 0;
		//	while (i < a.Length)
		//	{
		//		int d = 10 * rest + a[i];
		//		while (d < b && i < a.Length - 1)
		//		{
		//			d = 10 * d + a[++i];
		//		}

		//		rest = d % b;
		//		i++;
		//	}

		//	return rest;
		//}

		//private static short[] Divide(short[] a, int b)
		//{
		//	short[] result = new short[a.Length];
		//	int rest = 0, i = 0;
		//	while (i < a.Length)
		//	{
		//		int d = 10 * rest + a[i];
		//		while (d < b && i < a.Length - 1)
		//		{
		//			d = 10 * d + a[++i];
		//		}

		//		result[i] = (short)(d / b);
		//		rest = d % b;
		//		i++;
		//	}

		//	return result;
		//}
	}
}


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

namespace ConsoleApp63
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            var index = 0;
            var count = 0;
            if (X[0] % X[1] == 0)
            {
                for(int i = 0; i < X[1]; i++)
                {
                    Console.Write(X[0] / X[1]);
                    Console.Write(' ');
                }
            }
            else
            {
                for(int i=0;i<X[0]%X[1];i++)
                {
                    Console.Write(X[0] / X[1] + 1);
                    Console.Write(' ');
                    index++;
                }
                count = X[0] - index * (X[0]/X[1] + 1);
                for (int i = 0;count>0;i++)
                {
                    Console.Write(X[0] / X[1]);
                    Console.Write(' ');
                    count = count - X[0] / X[1];
                }
            }
        }
    }
}


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

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

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

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

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

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

    #region Main

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

    #endregion

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


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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int h = 0;
            int f = 0;
            int c = 0;
            for (int i = 1; i <= a; i++)
            {

                h = h + i;
                f = f + h;

                if (f> a)
                {
                    break;
                }
                c = i;
            }

            Console.WriteLine(c);
        }
    }
}


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

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