//#define FILE_INPUT
using System;
using System.Text;
using System.Linq;
//using System.Numerics;
//using System.Collections;
using System.Collections.Generic;
//using System.Collections.Specialized;
//using System.Text.RegularExpressions;

//978A. Удаление дубликатов

namespace CodeForces
{
    class Solution
    {

        private void solve()
        {
            int n = gi();
            bool[] b = new bool[1024];
            Stack<int> s = new Stack<int>(n);
            int[] m = ga(n, () => gi());

            for (int i = n - 1; i >= 0; i--)
            {
                int v = m[i];

                if (!b[v])
                {
                    b[v] = true;
                    s.Push(v);
                }
            }

            Console.WriteLine(s.Count);
            Console.WriteLine(String.Join(" ", s));
        }

        #region Tools

        static void Main()
        {
            new Solution().solve();
            Pause();
        }

        [System.Diagnostics.Conditional("DEBUG")]
        static private void DebugOut<T>(string format, T arg)
        {
            Console.WriteLine(format, arg);
        }

        [System.Diagnostics.Conditional("DEBUG")]
        static private void DebugOut(string format, params object[] arg)
        {
            Console.WriteLine(format, arg);
        }

        [System.Diagnostics.Conditional("DEBUG")]
        static private void DebugStop()
        {
            Console.ReadKey(true);
        }

        private static T[] ga<T>(int n, Func<int, T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f(i);
            return a;
        }

        private static T[] ga<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        private static int gi()
        { return cin.gi(); }

        private static List<T> gl<T>(int n, Func<int, T> f)
        {
            var a = new List<T>(n + 1);
            for (int i = 0; i < n; ++i) a.Add(f(i));
            return a;
        }

        [System.Diagnostics.Conditional("DEBUG")]
        static private void Pause()
        {
            Console.WriteLine("[debug]");
            Console.ReadKey(true);
        }
        private static void swap<T>(ref T a, ref T b)
        {
            T t = a;
            a = b;
            b = t;
        }

        #endregion Tools
    }

    class cin
    {
        public static int error { get; set; }

        static cin()
        {
#if (ONLINE_JUDGE || !FILE_INPUT)
            reader = new System.IO.BufferedStream(Console.OpenStandardInput(1024 * 10), 1024 * 10);
#else
                reader = new System.IO.BufferedStream((new System.IO.StreamReader("input.txt")).BaseStream, 1024 * 16);
#endif
        }

        public static System.IO.BufferedStream reader { get; private set; }
        public static char Char() { return (char)reader.ReadByte(); }

        public static int gi()
        {
            for (int c = read(); c != -1; c = read())
            {
                switch ((char)c)
                {
                    case '-':
                        return -(int)gu(read());

                    default:
                        if (char.IsDigit((char)c)) return (int)gu(c);
                        break;
                }
            }

            throw new System.IO.IOException();
        }

        public static uint gu()
        {
            return gu(read());
        }

        public static string Line()
        {
            int c;
            StringBuilder sb = new StringBuilder();

            for (c = read(); c != 10 && c != -1; c = read()) sb.Append((char)c);

            if (sb.Length > 0 && sb[sb.Length - 1] == 13) sb.Length -= 1;
            return sb.ToString();
        }

        public static int rawLine(byte[] a, int offset = 0)
        {
            int c, i = offset;
            for (c = reader.ReadByte(); c != 10; c = reader.ReadByte()) a[i++] = (byte)c;
            if (i > 0 && a[i - 1] == 13) i--;
            return i;
        }

        public static int rawLine(char[] a, int offset = 0)
        {
            Array.ConvertAll(a, Convert.ToInt16);

            int c, i = offset;
            for (c = read(); c != 10 && c != -1; c = read()) a[i++] = (char)c;
            if (i > 0 && a[i - 1] == 13) i--;
            return i;
        }

        public static int rawLine<T>(T[] a, Func<int, T> converter) where T : IComparable<int>
        {
            int c, i = 0;
            for (c = read(); c != 10; c = read()) a[i++] = converter(c);
            if (i > 0 && a[i - 1].CompareTo(13) == 0) i--;
            return i;
        }

        public static string Scan()
        {
            int c;
            StringBuilder sb = new StringBuilder();

            do
            {
                c = read();
                if (c == -1) return string.Empty;
            }
            while (c < 33 || c > 126);

            for (; c >= 33 && c <= 126; c = read()) sb.Append((char)c);
            return sb.ToString();
        }

        public static bool Scan(ref StringBuilder sb)
        {
            int c;

            do
            {
                c = read();
                if (c == -1) return false;
            }
            while (c < 33 || c > 126);

            for (; c >= 33 && c <= 126; c = read()) sb.Append((char)c);
            return true;
        }

        private static uint gu(int first)
        {
            int c;
            uint u = (uint)first - '0';
            for (c = read(); c != -1 && char.IsDigit((char)c); c = read())
            {
                u = 10 * u + (uint)c - '0';
            }

            error = c;
            return u;
        }

        private static int read() { return reader.ReadByte(); }

        public static bool NewLine()
        {
            int c = error;
            if (c != 10) do c = reader.ReadByte(); while (c != -1 && c != 10);
            return c != -1;
        }
    }
}


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

namespace CodeForce
{
    public class _977A
    {
        //Wrong Subtraction
        public static void Main()
        {
            string[] stringArray = Console.ReadLine().Split();
            int n = int.Parse(stringArray[0]);
            int k = int.Parse(stringArray[1]);
            for (int i = 0; i < k; i++)
            {
                if (n % 10 == 0)
                {
                    n /= 10;
                }
                else
                {
                    n -= 1;
                }
            }
            Console.WriteLine(n);
            //Console.ReadKey();
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {

            var abcd = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var a = abcd[0];
            var b = abcd[1];
            var c = abcd[2];
            var d = abcd[3];

            var list = new List<int>(3) { a, b, c };
            list.Sort();
            var left = d - (list[1] - list[0]);
            var right = d - (list[2] - list[1]);
            Console.WriteLine(Math.Max(left,0) + Math.Max(right,0));
        }

    }
}


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

namespace Round356e
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Get();
            p.Out(x);
        }

        object Get()
        {
            checked
            {
                var wa = Stopwatch.StartNew();
                //FileName = "input";
                var n = ReadIntToken();
                var k = ReadIntToken();
                var table = new bool[n, n];
                for (int i = 0; i < n; i++)
                {
                    var input = Read();
                    for (int j = 0; j < n; j++)
                        table[i, j] = input[j] == '.';
                }
                Cell[,] cells;
                int componentCount;
                BFS(table, out cells, out componentCount);
                var ccWeights = new int[componentCount + 1];
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        if (cells[i, j].CCNumber > 0)
                            ccWeights[cells[i, j].CCNumber]++;
                    }
                }
                var max = int.MinValue;
                var memory = new bool[componentCount + 1];
                for (int z = 0; z < n - k + 1; z++)
                {
                    //Console.WriteLine(z + " " + wa.Elapsed);
                    var activeField = new int[k, k];
                    var ccStats = new int[componentCount + 1];
                    var sumOfInternal = 0;
                    var blockedCount = 0;
                    for (int i = z; i < z + k; i++)
                    {
                        for (int j = 0; j < k; j++)
                        {
                            var cc = cells[i, j].CCNumber;
                            if (cc > 0)
                            {
                                if (ccStats[cc] == 0)
                                    sumOfInternal += ccWeights[cc];
                                ccStats[cc] += 1;
                            }
                            else
                                blockedCount++;
                        }
                    }

                    var max2 = Math.Max(max, Sum(GetNeighboursCcs(z, 0, k, n, cells, memory), ccStats, ccWeights) + sumOfInternal + blockedCount);
                    if (max2 > max)
                        max = max2;

                    for (int w = 1; w < n - k + 1; w++)
                    {
                        for (int i = 0; i < k; i++)
                        {
                            var ccNumber = cells[z + i, w - 1].CCNumber;
                            if (ccNumber > 0)
                            {
                                ccStats[ccNumber]--;
                                if (ccStats[ccNumber] == 0)
                                    sumOfInternal -= ccWeights[ccNumber];
                            }
                            else
                                blockedCount--;

                            ccNumber = cells[z + i, w + k - 1].CCNumber;
                            if (ccNumber > 0)
                            {
                                if (ccStats[ccNumber] == 0)
                                    sumOfInternal += ccWeights[ccNumber];
                                ccStats[ccNumber]++;
                            }
                            else
                                blockedCount++;
                        }
                        max2 = Math.Max(max, Sum(GetNeighboursCcs(z, w, k, n, cells, memory), ccStats, ccWeights) + sumOfInternal + blockedCount);
                        if (max2 > max)
                            max = max2;
                    }
                }
                if (!string.IsNullOrEmpty(FileName))
                    Console.WriteLine(wa.Elapsed);
                return max;
                //return here
            }
        }

        int Sum(IEnumerable<int> list, int[] set, int[] weights)
        {
            var second = new List<int>();
            foreach (var cc in list)
                if (set[cc] == 0)
                    second.Add(cc);
            var sum = 0;
            foreach (var cc in second)
                sum += weights[cc];
            return sum;
        }

        IEnumerable<int> GetNeighboursCcs(int i, int j, int k, int n, Cell[,] cells, bool[] memory)
        {
            var result = new List<int>();
            if (i > 0)
                //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + k, j + x)))
                //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j - 1)))
                //.Concat(Enumerable.Range(0, k).Select(x => Struct.Create(i + x, j + k))))
                for (var x = 0; x < k; x++)
                {
                    var cc = cells[i - 1, j + x].CCNumber;
                    if (cc > 0 && !memory[cc])
                    {
                        result.Add(cc);
                        memory[cc] = true;
                    }
                }
            if (i + k < n)
                for (var x = 0; x < k; x++)
                {
                    var cc = cells[i + k, j + x].CCNumber;
                    if (cc > 0 && !memory[cc])
                    {
                        result.Add(cc);
                        memory[cc] = true;
                    }
                }
            if (j > 0)
                for (var x = 0; x < k; x++)
                {
                    var cc = cells[i + x, j - 1].CCNumber;
                    if (cc > 0 && !memory[cc])
                    {
                        result.Add(cc);
                        memory[cc] = true;
                    }
                }
            if (j + k < n)
                for (var x = 0; x < k; x++)
                {
                    var cc = cells[i + x, j + k].CCNumber;
                    if (cc > 0 && !memory[cc])
                    {
                        result.Add(cc);
                        memory[cc] = true;
                    }
                }
            foreach (var cc in result)
            {
                memory[cc] = false;
            }
            return result;
        }

        void BFS(bool[,] input, out Cell[,] cells, out int componentCount)
        {
            var n = input.GetLength(0);
            cells = new Cell[n, n];
            var visited = new bool[n, n];
            var componentIndex = 0;
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    if (!visited[i, j] && input[i, j])
                        BFS(i, j, cells, input, visited, ++componentIndex);
            componentCount = componentIndex;
        }

        void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)
        {
            var n = input.GetLength(0);
            visited[i, j] = true;
            cells[i, j].CCNumber = ccIndex;
            var neighbours = new[] { Struct.Create(i + 1, j), Struct.Create(i - 1, j), Struct.Create(i, j + 1), Struct.Create(i, j - 1) };
            foreach (var c in neighbours.Where(x => x.Item1 >= 0 && x.Item1 < n && x.Item2 >= 0 && x.Item2 < n && !visited[x.Item1, x.Item2] && input[x.Item1, x.Item2]))
                BFS(c.Item1, c.Item2, cells, input, visited, ccIndex);
        }

        struct Cell
        {
            public int CCNumber { get; set; }
        }

        public static class Struct
        {
            public static Pair<T1, T2> Create<T1, T2>(T1 item1, T2 item2)
            {
                return new Pair<T1, T2> { Item1 = item1, Item2 = item2 };
            }
        }

        public struct Pair<T1, T2>
        {
            public T1 Item1 { get; set; }
            public T2 Item2 { get; set; }
        }

        class Automata
        {
            bool[] terminals;
            public int sigma;
            public int len;
            public int[,] jumps;

            public void Create()
            {
                var a = ReadInts();
                len = a[0];
                sigma = a[2];
                var ts = ReadInts();
                terminals = new bool[len];
                for (int i = 0; i < ts.Length; i++)
                    terminals[ts[i]] = true;
                jumps = new int[len, sigma];
                for (int i = 0; i < len * sigma; i++)
                {
                    var b = Console.ReadLine().Split(' ');
                    jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);
                }
            }
            protected int[] ReadInts()
            {
                return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            }

            public bool IsTerminal(int s)
            {
                return terminals[s];
            }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput())
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected int ReadInt()
        {
            return int.Parse(Read());
        }

        protected int ReadIntToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return int.Parse(tokens.Dequeue());
        }

        protected int[] ReadInts()
        {
            var tokens = Read().Split(' ');
            var result = new int[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = int.Parse(tokens[i]);
            return result;
        }

        protected long ReadLongToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return long.Parse(tokens.Dequeue());
        }

        protected long ReadLong()
        {
            return Convert.ToInt64(Read());
        }

        protected long[] ReadLongs()
        {
            var tokens = Read().Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> source, string delimeter)
        {
            return string.Join(delimeter, source.ToArray());
        }

        public static string JoinStrings(this IEnumerable<int> source, string delimeter)
        {
            return source.Select(x => x.ToString()).JoinStrings(delimeter);
        }
    }
}


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

namespace IamBoredwithLife
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split(' ');
            int x = Int32.Parse(a[0]);
            int y = Int32.Parse(a[1]);
            int gcd = 1;
            for (int i = 1; i <= Math.Min(x, y); i++)
                gcd *= i;
            Console.WriteLine(gcd);
            Console.ReadLine();
        }
    }
}


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

namespace a2oj
{
    class Program
    {

        static void Main(string[] args)
        {
            long t = long.Parse(Console.ReadLine());
            long sum = 0,c=1;
            while (t>0)
            {
                sum += (long)Math.Pow(2, c);
                c++;
                t--;
            }

            Console.WriteLine(sum);
            //Console.ReadLine();

        }
    }
}


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

namespace Olimp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();

            BigInteger ans = 0, p = 1;

            while (true)
            {
                if(s == "") break;
                string cur = "";

                while (s != "" && BigInteger.Parse(s[s.Length - 1] + cur) < n)
                {
                    cur = s[s.Length - 1] + cur;
                    s = s.Remove(s.Length - 1, 1);
                }

                if (cur[0] == '0' && cur.Length != 1)
                {
                    if (cur.Count(x => x == '0') == cur.Length)
                    {
                        for (int i = 0; i < cur.Length - 1; i++)
                        {
                            s += "0";
                        }
                        cur = "0";
                    }
                    else
                    {
                        while (cur[0] == '0')
                        {
                            s += "0";
                            cur = cur.Remove(0, 1);
                        }
                    }
                }

                ans += Convert.ToInt64(cur) * p;
                p *= n;
            }

            Console.WriteLine(ans);
        }
    }
}


using System;
    class Program
    {
        static void Main(string[] args)
        {
            int f= int.Parse(Console.ReadLine());
            int z=0,a=0,b=0,c=1,d=1;
            if(f==0)
            {
                Console.WriteLine("0 0 0");
                return;
            }
            if(f==2)
            {
                Console.WriteLine("0 0 2");
                return;
            }
            while(d!=f)
            {
                z=a;a=b;b=c;c=d;d=c+b;
            }
            Console.WriteLine(z.ToString()+" "+a.ToString()+" "+c.ToString());
         }
    }


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

namespace KingsWay
{
    class Program
    {

        static void Main(string[] args)
        {

         int n = int.Parse(Console.ReadLine());
         int x = int.Parse(Console.ReadLine());
         int initial = 0;

         int[] shells = new int[3];

        for(int i = 0;i<shells.Length;i++)
        {
            if(i==x)
            {
                shells[i]=1;
            }
            else
            {
                shells[i]=0;
            }
        }
        n %= 6;
         for(int i = n;i>0;i--)
         {
             if(i%2==0)
             {
                 int temp1 = shells[2];
                 shells[2] = shells[1];
                 shells[1] = temp1;
             }
             else
             {
                 int temp2 = shells[0];
                 shells[0] = shells[1];
                 shells[1] = temp2;
             }
         }

         for(int i=0;i<shells.Length;i++)
         {
             if(shells[i]==1)
             {
                 initial = i;
                 break;
             }
         }

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


using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace Codeforces
{
	internal class Template
	{
		private void Solve()
		{
			var n = cin.NextInt();
			var t = cin.NextInt();
			var k = cin.NextInt();
			var d = cin.NextInt();
			var times = n/k;
			if (n%k > 0)
			{
				times++;
			}
			var time = t*times;
			time -= t;
			var res = time > d;
			Console.WriteLine(res ? "YES" : "NO");
		}

		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
#if DEBUG
			var inputText = File.ReadAllText(@"..\..\input.txt");
			var testCases = inputText.Split(new[] { "input" }, StringSplitOptions.RemoveEmptyEntries);
			var consoleOut = Console.Out;
			for (var i = 0; i < testCases.Length; i++)
			{
				var parts = testCases[i].Split(new[] { "output" }, StringSplitOptions.RemoveEmptyEntries);
				Console.SetIn(new StringReader(parts[0].Trim()));
				var stringWriter = new StringWriter();
				Console.SetOut(stringWriter);
				var sw = Stopwatch.StartNew();
				new Template().Solve();
				sw.Stop();
				var output = stringWriter.ToString();

				Console.SetOut(consoleOut);
				var color = ConsoleColor.Green;
				var status = "Passed";
				if (parts[1].Trim() != output.Trim())
				{
					color = ConsoleColor.Red;
					status = "Failed";
				}
				Console.ForegroundColor = color;
				Console.WriteLine("Test {0} {1} in {2}ms", i + 1, status, sw.ElapsedMilliseconds);
			}
			Console.ReadLine();
			Console.ReadKey();
#else
			new Template().Solve();
			Console.ReadLine();
#endif
		}
	}

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

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

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

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

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


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

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

            double answer;
            string[] input = Console.ReadLine().Split(null);
            answer = Math.Sqrt(Math.Pow(Int32.Parse(input[3]) - Int32.Parse(input[1]),2) + Math.Pow(Int32.Parse(input[4]) - Int32.Parse(input[2]),2))/(Int32.Parse(input[0])*2);
            Console.WriteLine(answer==(Int32)answer?answer:(Int32)answer+1);
        }
    }
}


//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5

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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string ip = Console.ReadLine();
            int []count = new int[3]; //RGB
            for(int i=0;i<n;i++){
                if(ip[i]=='R')
                    count[0]++;
                else if(ip[i]=='G')
                    count[1]++;
                else if(ip[i]=='B')
                    count[2]++;
            }
            //Console.WriteLine("{0} {1} {2}",count[0],count[1],count[2]);
            string s="";
            //all three cards
            if(count[0]!=0 && count[1]!=0 && count[2]!=0)
                s+="BGR";

            //only one type of card
            else if(count[0]!=0 && count[1]==0 && count[2]==0)
                s+="R";
            else if(count[0]==0 && count[1]!=0 && count[2]==0)
                s+="G";
            else if(count[0]==0 && count[1]==0 && count[2]!=0)
                s+="B";

            //two type of card but only one of each
            else if(count[0]==1 && count[1]==1 && count[2]==0)
                s+="B";
            else if(count[0]==0 && count[1]==1 && count[2]==1)
                s+="R";
            else if(count[0]==1 && count[1]==0 && count[2]==1)
                s+="G";

            //atleast two of one and only one of second
            else if(count[0]>=2 && count[1]==1 && count[2]==0)
                s+="BG";
            else if(count[0]>=2 && count[1]==0 && count[2]==1)
                s+="BG";
            else if(count[0]==0 && count[1]>=2 && count[2]==1)
                s+="BR";
            else if(count[0]==1 && count[1]>=2 && count[2]==0)
                s+="BR";
            else if(count[0]==1 && count[1]==0 && count[2]>=2)
                s+="GR";
            else if(count[0]==0 && count[1]==1 && count[2]>=2)
                s+="GR";

             //if only two type but both greater than two
             else if(count[0]>=2 && count[1]>=2 && count[2]==0)
                s+="BGR";
            else if(count[0]>=2 && count[1]==0 && count[2]>=2)
                s+="BGR";
            else if(count[0]==0 && count[1]>=2 && count[2]>=2)
                s+="BGR";
            Console.WriteLine(s);
        }
    }
}


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

namespace SharpApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = new StringBuilder(Console.ReadLine());

            var count = 0;
            var canTake = new int[str.Length];
            for (int i = 0; i < str.Length; i++)
            {
                if (str[i] == 'V')
                {
                    if (i + 1 == str.Length)
                    {
                        break;
                    }
                    if (str[i + 1] == 'K')
                    {
                        canTake[i] = 1;
                        canTake[i + 1] = 1;
                        count++;
                        i++;
                    }
                    else if (str[i + 1] == 'V')
                    {
                        canTake[i] = 2;
                        canTake[i + 1] = 2;
                    }
                }
                else if (i + 1 != str.Length && str[i + 1] == 'K')
                {
                    canTake[i] = 2;
                    canTake[i + 1] = 2;
                }
            }

            for (int i = 0; i < canTake.Length; i++)
            {
                if (canTake[i] == 2)
                {
                    if (i + 1 != canTake.Length && canTake[i + 1] == 2)
                    {
                        count++;
                        break;
                    }
                }
            }

            Console.WriteLine(count);
        }
    }
}


using System;
using System.Linq;

namespace FlippingGame
{
    class FlippingGame
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] values = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] partialOnesObtained = new int[n];

            int numOfOnes = values.Count(v => v == 1);

            if (numOfOnes == n)
                Console.WriteLine(n - 1);
            else
            {
                partialOnesObtained[0] = 1 - values[0];

                for (int i = 1; i < n; i++)
                {
                    if (values[i] == 0)
                        partialOnesObtained[i] = partialOnesObtained[i - 1] + 1;
                    else
                        partialOnesObtained[i] = partialOnesObtained[i - 1] - 1 < 0 ? 0 : partialOnesObtained[i - 1] - 1;
                }

                Console.WriteLine(numOfOnes + partialOnesObtained.Max());
            }
        }
    }
}


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

namespace CodeForces {
    struct Position : IComparable<Position>{
        public int Index, Min, Max;
        public Position(int index, int min, int max) {
            Index = index; Min = min; Max = max;
        }

        public int CompareTo(Position other) {
            return other.Max.CompareTo(Max);
        }
    }

    class C4B {
        static void Main(string[] args) {
            int[] arr = ReadIntArray();
            int d = arr[0];
            int sumTime = arr[1];
            int sumMin = 0;
            int sumMax = 0;
            Position[] time = new Position[d];
            for (int i = 0; i < d; ++i) {
                int[] m = ReadIntArray();
                time[i] = new Position(i, m[0], m[1]);
                sumMin += m[0];
                sumMax += m[1];
            }
            if (sumMin > sumTime || sumMax < sumTime) {
                Console.WriteLine("NO");
                return;
            }
            int[] result = new int[d];
            Array.Sort(time);
            for (int i = 0; i < d; ++i) {
                Position p = time[i];
                if (sumTime == sumMin) {
                    result[p.Index] = p.Min;
                    sumTime -= p.Min;
                    sumMin -= p.Min;
                }
                else if (sumTime - p.Max >= sumMin - p.Min) {
                    result[p.Index] = p.Max;
                    sumTime -= p.Max;
                    sumMin -= p.Min;
                }
                else {
                    result[p.Index] = sumTime - (sumMin - p.Min);
                    sumMin -= p.Min;
                    sumTime -= result[p.Index];
                }
            }
            Console.WriteLine("YES");
            PrintArray(result);
            //Console.ReadLine();
        }

        public static void PrintArray(int[] arr) {
            foreach (int i in arr)
                Console.Write("{0} ", i);
        }

        public static int[] ReadIntArray() {
            return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }
    }
}


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

    public class Program
    {
        public static void Main(string[] args)
        {
            var hand = Console.ReadLine();
            var keys = "qwertyuiopasdfghjkl;zxcvbnm,./";
            var sb = new StringBuilder(keys);
            var inp = Console.ReadLine();
            var outp = "";
            var ind = 0;
            if (hand == "R")
            {

                for (int i = 0; i < inp.Length; i++)
                {
                    var ch = inp[i];
                    for (int j = 0; j < sb.Length; j++)
                    {
                        if (ch == sb[j])
                        {
                            outp += sb[j - 1];
                        }
                    }

                }
            }
            else
            {
                for (int i = 0; i < inp.Length; i++)
                {
                    var ch = inp[i];
                    for (int j = 0; j < sb.Length - 1; j++)
                    {
                        if (ch == sb[j])
                        {
                            outp += sb[j + 1];
                        }
                    }
                }
            }
            Console.WriteLine(outp.ToString());

        }
    }


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using static CF.ReadNext;

namespace CF
{
    public static class Program
    {
        private static void Main()
        {
            var s = Console.ReadLine();
            for (int i = 0; i <= s.Length - 3; i++)
            {
                var substring = string.Concat(s.Substring(i, 3).OrderBy(c=>c));
                if (substring == "ABC")
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }
    }

    public static class ReadNext
    {
        public static int NextInt()
        {
            var next = ReadUntilSpace();
            return int.Parse(next);
        }

        public static double NextDouble()
        {
            var next = ReadUntilSpace();
            return double.Parse(next);
        }

        public static string NextWord()
        {
            return ReadUntilSpace();
        }

        private static bool IsWhiteSpace(int n)
        {
            return n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1;
        }

        private static string ReadUntilSpace()
        {
            var result = "";

            var n = Console.Read();
            // read whitespace
            while (IsWhiteSpace(n))
            {
                n = Console.Read();
            }

            // read characters
            while (!IsWhiteSpace(n))
            {
                result += (char)n;
                n = Console.Read();
            }

            return result;
        }
    }
}


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

namespace Zad
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            n = Convert.ToInt32(Console.ReadLine());
            int[] k = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int cot = 0, mac = 0;
            for(int i = 0; i < n ; i++)
            {
                if (k[i] == 0)
                    cot++;
                else mac = Math.Max(cot, mac)+1;
            }

            Console.WriteLine(Math.Max(cot,mac));

        }
    }
}


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

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

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

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

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

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

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

            d1 = readIntArray();
            var n = d1[0];
            var m = d1[1];
            var k = readInt();
            var need = Math.Max( n * m - k, 0);

            if (d * n <= c)
            {
                Console.WriteLine(need * d);
                return;
            }

            var rem = need % n;
            var pr = need / n;
            var tc = pr * c;
            if (rem * d < c)
            {
                tc += rem * d;
            }
            else
            {
                tc += c;
            }

            Console.WriteLine(tc);
            //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.Collections;
using System.Collections.Generic;

namespace contest
{
    class Program
    {
        static int[] arr = new int[150005];

        public static void Main()
        {
            int n , k;
            var inp = Console.ReadLine().Split(' ');
            n = int.Parse(inp[0]);
            k = int.Parse(inp[1]);
            inp = Console.ReadLine().Split(' ');
            for( int i = 0; i < n; i++ )
            {
                arr[i] = int.Parse(inp[i]);
            }
            int ans = int.MaxValue;
            for( int i = 0; i <= 200000; i++)
            {
                List<int> list = new List<int>();

                int cnt = 0;
                for( int j = 0; j < n; j++ )
                {
                    cnt = 0;
                    int x = arr[j];
                    while( x > i)
                    {
                        cnt++;
                        x /= 2;
                    }
                    if( x == i )
                    {
                        list.Add(cnt);
                    }
                }
                list.Sort();
                if( list.Count >= k )
                {
                    int sm = 0;
                    for (int j = 0; j < k; j++)
                        sm += list[j];
                    ans = Math.Min(ans, sm);
                }
            }
            Console.WriteLine(ans);
            Console.ReadLine();
        }

    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            long i;
            while (long.TryParse(Console.ReadLine(), out i)) {
                i = (i / 10000)*10000 + ((i / 100) % 10)*1000 + (i%10)*100 + ((i/10)%10)*10 + (i/1000)%10;
                var r = i;
                r *= i;
                r = r% 100000;
                r *= i;
                r = r% 100000;
                r *= i;
                r = r% 100000;
                r *= i;
                r = r% 100000;
                Console.WriteLine(r.ToString("D5"));
            }
        }
    }
}


using System;
 class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.In.ReadToEnd().Split(new char[] {' ', '\n', '\r', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[input.Length];
            for (int i = 0; i < ar.Length; ++i)
                ar[i]=int.Parse(input[i]);
            input = null;
            Array.Sort(ar, 1, ar.Length - 1);
            int a = 0;
            int sum=0;
            if(ar[0]>0)
            {
                for(int i=ar.Length-1; i>0; --i)
                {
                    a++;
                    if((sum += ar[i])>=ar[0]) break;
                }
            }
            Console.WriteLine(a<ar.Length-1?a:sum<ar[0]?-1:a);
        }
    }


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

namespace CodeForces
{
	internal class B
	{
		private int[] cnt;
		private string N;

		private int?[, ,] dp;
		int Go( int pos, int left, int more )
		{
			if ( left < 0 ) return 0;
			int res;

			if ( pos == N.Length )
			{
				if ( left == 0 ) res = 1;
				else res = 0;
			}
			else
			{
				if ( dp[pos, left, more].HasValue ) return dp[pos, left, more].Value;

				res = 0;
				for ( int i = 0; i < ( more == 1 ? 10 : N[pos] - '0' + 1 ); ++i )
				{
					int nl = left;
					if ( i == 4 || i == 7 ) nl--;
					int nm = more;
					if ( i < N[pos] - '0' ) nm = 1;
					res += Go( pos + 1, nl, nm );
				}

				dp[pos, left, more] = res;
			}

			return res;
		}

		private void Solve()
		{
			int n = NextInt();
			N = n.ToString();
			cnt = new int[10];
			dp = new int?[N.Length, 10, 2];
			for ( int i = 0; i <= 9; ++i )
			{
				cnt[i] = Go( 0, i, 0 );
			}
			cnt[0]--;
			cnts = new int[10];

			sum = 0;
			taken = new int[10];
			int rr = 0;
			for ( k = 1; k < 10; ++k )
			{
				if ( cnt[k] > 0 )
				{
					res = 0;
					Go2( 0 );
					res = (int)( ( (long)res * cnt[k] ) % MOD );
					rr += res;
					if ( rr >= MOD ) rr -= MOD;
				}
			}
			Out.WriteLine( rr );
		}

		private int k, res, sum, sz;
		private int[] taken, cnts;
		void Go2( int pos )
		{
			if ( pos == 6 )
			{
				int cur = 1;
				for ( int i = 0; i < 10; ++i )
				{
					int tot = cnt[i];
					for ( int j = 0; j < cnts[i]; ++j )
					{
						cur = (int)( ( (long)cur * tot ) % MOD );
						--tot;
					}
				}
				res += cur;
				if ( res >= MOD ) res -= MOD;
				return;
			}
			for ( int i = 0; i < 10; ++i )
			{
				if ( sum + i < k && cnt[i] >= cnts[i] + 1 )
				{
					++cnts[i];
					sum += i;
					Go2( pos + 1 );
					sum -= i;
					--cnts[i];
				}
			}
		}

		private const int MOD = 1000000007;

		#region Local wireup

		public int NextInt()
		{
			return _in.NextInt();
		}

		public long NextLong()
		{
			return _in.NextLong();
		}

		public string NextLine()
		{
			return _in.NextLine();
		}

		public double NextDouble()
		{
			return _in.NextDouble();
		}

		readonly Scanner _in = new Scanner();
		static readonly TextWriter Out = Console.Out;

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

		static void Main()
		{
			new B().Start();
		}

		class Scanner : IDisposable
		{
			#region Fields

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

			#endregion

			#region .ctors

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

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

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

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

			#endregion

			#region IDisposable Members

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

			#endregion

			#region Properties

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

			#endregion

			#region Methods

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

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

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

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

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

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

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

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

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

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

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

			#endregion
		}

		#endregion
	}
}


using System;
using System.Numerics;

namespace CSharp
{
    class _785C
    {
        public static void Main()
        {
            var tokens = Console.ReadLine().Split();

            long n = long.Parse(tokens[0]);
            long m = long.Parse(tokens[1]);

            if (n < m)
            {
                Console.WriteLine(n);
            }
            else
            {
                BigInteger l = m;
                BigInteger r = m + n;

                while (l < r)
                {
                    var d = (l + r) / 2;

                    if ((d - m) * (d - m + 1) / 2 + m >= n)
                    {
                        r = d;
                    }
                    else
                    {
                        l = d + 1;
                    }
                }

                Console.WriteLine(l);
            }
        }
    }
}


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

class Program
{

    void solve()
    {
        int n = nextInt();
        int m = nextInt();
        int[] dp = new int[n + 1];
        int c0 = nextInt();
        int d0 = nextInt();
        for (int i = 0; i <= n; i++)
            dp[i] = i / c0 * d0;
        for (int i = 1; i <= m; i++)
        {
            int a = nextInt();
            int b = nextInt();
            int c = nextInt();
            int d = nextInt();
            int[] next = new int[n + 1];
            for (int x = 0; x <= n; x++)
            {
                for (int cur = 0; ; cur++)
                {
                    if (cur * b > a)
                        break;
                    if (cur * c > x)
                        break;
                    next[x] = Math.Max(next[x], cur * d + dp[x - cur * c]);
                }
            }
            dp = next;
        }
        println(dp[n]);
    }

    ////////////
    private void println(int[] ar)
    {
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i]);
            else
                print(ar[i] + " ");
        }
    }
    private void println(int[] ar, bool add)
    {
        int A = 0;
        if (add)
            A++;
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i] + A);
            else
                print((ar[i] + A) + " ");
        }
    }

    private void println(string Stringst)
    {
        Console.WriteLine(Stringst);
    }
    private void println(char charnum)
    {
        Console.WriteLine(charnum);
    }
    private void println(int Intnum)
    {
        Console.WriteLine(Intnum);
    }
    private void println(long Longnum)
    {
        Console.WriteLine(Longnum);
    }
    private void println(double Doublenum)
    {
        string s = Doublenum.ToString(CultureInfo.InvariantCulture);
        Console.WriteLine(s);
    }

    private void print(string Stringst)
    {
        Console.Write(Stringst);
    }
    private void print(int Intnum)
    {
        Console.Write(Intnum);
    }
    private void print(char charnum)
    {
        Console.Write(charnum);
    }
    private void print(long Longnum)
    {
        Console.Write(Longnum);
    }
    private void print(double Doublenum)
    {
        Console.Write(Doublenum);
    }

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (inputLine.Length == 0)
            readInput();

    }
    int nextInt()
    {
        return int.Parse(nextString());
    }
    long nextLong()
    {
        return long.Parse(nextString());
    }
    double nextDouble()
    {
        return double.Parse(nextString());
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        new Program().solve();
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
class Solver
{
    void Solve()
    {
        var h = new HashMap<char, int>();
        foreach (var c in sc.ScanLine())
            h[c]++;
        var a = h.Select(x => x.Value).OrderBy(x => x).ToArray();
        if (a.Length == 1)//
            Printer.PrintLine(1);
        else if (a.Length == 2)
        {
            var min = a[0];
            if (min == 1)
                Printer.PrintLine(1);//
            else if (min == 2)
                Printer.PrintLine(2);//
            else Printer.PrintLine(2);
        }
        else if (a.Length == 3)
        {
            if (a[0] == 1)
            {
                if (a[1] == 1)
                    Printer.PrintLine(2);
                else Printer.PrintLine(3);//
            }
            else
                Printer.PrintLine(6);//
        }
        else if (a.Length == 4)
        {
            if (a[3] == 3)
                Printer.PrintLine(5);//
            else Printer.PrintLine(8);//
        }
        else if (a.Length == 5)
            Printer.PrintLine(15);//
        else if (a.Length == 6)
            Printer.PrintLine(30);//

    }

    static void Main()
    {
#if DEBUG
        var ostream = new System.IO.FileStream("debug.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write);
        var iStream = new System.IO.FileStream("input.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
        Console.SetIn(new System.IO.StreamReader(iStream));
        System.Diagnostics.Debug.AutoFlush = true;
        System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(new System.IO.StreamWriter(ostream, System.Text.Encoding.UTF8)));
        try
        {
#endif
            var solver = new Solver();
            solver.Solve();
#if DEBUG
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            Console.WriteLine(ex.StackTrace);
        }
        Console.ReadKey(true);
#endif
    }
    _Scanner sc = new _Scanner();

}
static public class Printer
{
    static readonly private System.IO.TextWriter writer;
    static readonly private System.Globalization.CultureInfo info;
    static string Separator { get; set; }
    static Printer()
    {
        writer = Console.Out;
        info = System.Globalization.CultureInfo.InvariantCulture;
        Separator = " ";
    }

    static public void Print(int num) { writer.Write(num.ToString(info)); }
    static public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }
    static public void Print(long num) { writer.Write(num.ToString(info)); }
    static public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }
    static public void Print(double num) { writer.Write(num.ToString(info)); }
    static public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }
    static public void Print(string str) { writer.Write(str); }
    static public void Print(string format, params object[] arg) { writer.Write(format, arg); }
    static public void Print(IEnumerable<char> sources) { writer.Write(sources.AsString()); }
    static public void Print(params object[] arg)
    {
        var res = new System.Text.StringBuilder();
        foreach (var x in arg)
        {
            res.AppendFormat(info, "{0}", x);
            if (!string.IsNullOrEmpty(Separator))
                res.Append(Separator);
        }
        writer.Write(res.ToString(0, res.Length - Separator.Length));
    }
    static public void Print<T>(IEnumerable<T> sources)
    {
        var res = new System.Text.StringBuilder();
        foreach (var x in sources)
        {
            res.AppendFormat(info, "{0}", x);
            if (string.IsNullOrEmpty(Separator))
                res.Append(Separator);
        }
        writer.Write(res.ToString(0, res.Length - Separator.Length));
    }
    static public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }
    static public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }
    static public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }
    static public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }
    static public void PrintLine(double num) { writer.WriteLine(num.ToString(info)); }
    static public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }
    static public void PrintLine(string str) { writer.WriteLine(str); }
    static public void PrintLine(string format, params object[] arg) { writer.WriteLine(format, arg); }
    static public void PrintLine(IEnumerable<char> sources) { writer.WriteLine(sources.AsString()); }
    static public void PrintLine(params object[] arg)
    {
        var res = new System.Text.StringBuilder();
        foreach (var x in arg)
        {
            res.AppendFormat(info, "{0}", x);
            if (!string.IsNullOrEmpty(Separator))
                res.Append(Separator);
        }
        writer.WriteLine(res.ToString(0, res.Length - Separator.Length));
    }
    static public void PrintLine<T>(IEnumerable<T> sources)
    {
        var res = new System.Text.StringBuilder();
        foreach (var x in sources)
        {
            res.AppendFormat(info, "{0}", x);
            if (!string.IsNullOrEmpty(Separator))
                res.Append(Separator);
        }
        writer.WriteLine(res.ToString(0, res.Length - Separator.Length));
    }
}
public class _Scanner
{
    readonly private System.Globalization.CultureInfo info;
    readonly System.IO.TextReader reader;
    string[] buffer = new string[0];
    int position;

    public char[] Separator { get; set; }
    public _Scanner(System.IO.TextReader reader = null, string separator = null, System.Globalization.CultureInfo info = null)
    {

        this.reader = reader ?? Console.In;
        if (string.IsNullOrEmpty(separator))
            separator = " ";
        this.Separator = separator.ToCharArray();
        this.info = info ?? System.Globalization.CultureInfo.InvariantCulture;
    }
    public string Scan()
    {
        if (this.position < this.buffer.Length)
            return this.buffer[this.position++];
        this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);
        this.position = 0;
        return this.buffer[this.position++];
    }

    public string[] ScanToEndLine()
    {
        if (this.position >= this.buffer.Length)
            return this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);
        var size = this.buffer.Length - this.position;
        var ar = new string[size];
        Array.Copy(this.buffer, position, ar, 0, size);
        return ar;

    }

    public string ScanLine()
    {
        if (this.position >= this.buffer.Length)
            return this.reader.ReadLine();
        else
        {
            var sb = new System.Text.StringBuilder();
            for (; this.position < buffer.Length; this.position++)
            {
                sb.Append(this.buffer[this.position]);
                sb.Append(' ');
            }
            return sb.ToString();
        }
    }
    public string[] ScanArray(int length)
    {
        var ar = new string[length];
        for (int i = 0; i < length; i++)
        {
            ar[i] = this.Scan();
        }
        return ar;
    }

    public int Integer()
    {
        return int.Parse(this.Scan(), info);
    }
    public long Long()
    {
        return long.Parse(this.Scan(), info);
    }
    public double Double()
    {
        return double.Parse(this.Scan(), info);
    }

    public int[] IntArray(int length)
    {
        var a = new int[length];
        for (int i = 0; i < length; i++)
            a[i] = this.Integer();
        return a;
    }
    public long[] LongArray(int length)
    {
        var a = new long[length];
        for (int i = 0; i < length; i++)
            a[i] = this.Long();
        return a;
    }
    public double[] DoubleArray(int length)
    {
        var a = new double[length];
        for (int i = 0; i < length; i++)
            a[i] = this.Double();
        return a;
    }

}
static public partial class EnumerableEx
{
    static public string AsString(this IEnumerable<char> source)
    {
        return new string(source.ToArray());
    }
    static public IEnumerable<T> Enumerate<T>(this int count, Func<int, T> selector)
    {
        return Enumerable.Range(0, count).Select(x => selector(x));
    }
}
class HashMap<K, V> : Dictionary<K, V>
{
    new public V this[K i]
    {
        get
        {
            V v;
            return TryGetValue(i, out v) ? v : base[i] = default(V);
        }
        set { base[i] = value; }
    }
}
//*/


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

namespace FootballChampionship
{
    internal class Team
    {
        public String Name
        {
            get;
            set;
        }

        public int GamesPlayed
        {
            get;
            set;
        }

        public int Points
        {
            get;
            set;
        }

        public int Scored
        {
            get;
            set;
        }

        public int Missed
        {
            get;
            set;
        }
    }

    internal class Program
    {
        private static readonly Dictionary<string, Team> tournament = new Dictionary<string, Team>();

        private static void Main(string[] args)
        {
            Process(Console.ReadLine());
            Process(Console.ReadLine());
            Process(Console.ReadLine());
            Process(Console.ReadLine());
            Process(Console.ReadLine());

            String result = Solve();
            Console.Out.WriteLine(result);
        }

        private static string Solve()
        {
            var teams = new List<Team>(tournament.Values);
            Team o = teams.Where(t => t.GamesPlayed == 2 && t.Name != "BERLAND").First();
            Team b = teams.Where(t => t.GamesPlayed == 2 && t.Name == "BERLAND").First();
            int bScored = b.Scored;
            int oScored = o.Scored;
            int bMissed = b.Missed;
            int oMissed = o.Missed;

            b.Points += 3;
            for (int i = 1; i < 60; i++)
            {
                for(int j = 0; j < 60; j++)
                {
                    b.Scored = bScored;
                    o.Scored = oScored;
                    b.Missed = bMissed;
                    o.Missed = oMissed;

                    b.Scored += (i + j);
                    b.Missed += j;
                    o.Scored += j;
                    o.Missed += (i + j);
                    SortTeams(teams);
                    if (teams[0].Name == "BERLAND" || teams[1].Name == "BERLAND")
                    {
                        return String.Format("{0}:{1}", i + j, j);
                    }
                }
            }
            return "IMPOSSIBLE";
        }

        private static void SortTeams(List<Team> teams)
        {
            teams.Sort(
                (t1, t2) =>
                {
                    int x = t2.Points.CompareTo(t1.Points);
                    if (x != 0)
                    {
                        return x;
                    }
                    x = (t2.Scored - t2.Missed).CompareTo(t1.Scored - t1.Missed);
                    if (x != 0)
                    {
                        return x;
                    }
                    x = t2.Scored.CompareTo(t1.Scored);
                    if (x != 0)
                    {
                        return x;
                    }
                    return t1.Name.CompareTo(t2.Name);
                });
        }

        private static void Process(string line)
        {
            String[] parts = line.Split(' ');
            String team1 = parts[0];
            String team2 = parts[1];
            int[] scores = parts[2].Split(':').Select(x => Convert.ToInt32(x)).ToArray();
            int score1 = scores[0];
            int score2 = scores[1];

            AddTeam(team1, score1, score2);
            AddTeam(team2, score2, score1);
        }

        private static void AddTeam(string team, int scored, int missed)
        {
            if (!tournament.ContainsKey(team))
            {
                tournament[team] = new Team { Name = team };
            }
            tournament[team].GamesPlayed++;
            tournament[team].Scored += scored;
            tournament[team].Missed += missed;
            tournament[team].Points += scored > missed ? 3 : (scored == missed ? 1 : 0);
        }
    }
}


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

namespace cf
{
    class Program
    {

        static void Main(string[] args)
        {
            try
            {
                long[] ar = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
                long n = ar[0];
                long k = ar[1];
                //        Console.WriteLine((1000000000000/ 2 -499999999999)/2);
                long d = (n / 2) / (k + 1);
                long c = k * d;
                long no = n - d - c;
                Console.WriteLine(d+" "+c+" "+no);
                Console.ReadKey();
            }
            catch { }
            }

    }
}


using System;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            var s = 2*Convert.ToInt16(Console.ReadLine());
            var a = (byte) Math.Sqrt(s);
            Console.WriteLine(a*(a+1)==s?"YES":"NO");
        }
    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    void Solve()
    {
        int n = ReadInt();
        if (n == 1)
        {
            Write(1);
            return;
        }
        int m = ReadInt();
        Write(m <= n / 2 ? m + 1 : m - 1);
    }

    #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("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
            //            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //            thread.Start();
            //            thread.Join();
            checked
            {
                new Solver().Solve();
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#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;

namespace Contest_276
{
    class Program
    {
        static string yes = "Yes";
        static string no = "No";

        static void Main(string[] args)
        {
            string[] lines = Console.ReadLine().Split(' ');
            int a = Int32.Parse(lines[0]);
            int m = Int32.Parse(lines[1]);

            printResult(a, m);

            Console.ReadLine();
        }

        static void printResult(int a, int m)
        {
            HashSet<int> set = new HashSet<int>();
            int rest = -1;

            while (true)
            {
                rest = a % m;
                if (rest == 0)
                {
                    Console.WriteLine(yes);
                    return;
                }

                if (set.Contains(rest))
                {
                    Console.WriteLine(no);
                    return;
                }

                set.Add(rest);
                a += rest;
            }
        }
    }
}


using System;
using System.Text;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool metAt = false;
            var builder = new StringBuilder(Console.ReadLine());
            for(int i=1; i < builder.Length - 2; i++)
            {
                if (i <builder.Length - 3 && builder[i] == 'd' && builder[i + 1] == 'o' && builder[i + 2] == 't')
                    builder.Replace("dot", ".", i, 3);
                if (!metAt && builder[i] == 'a' && builder[i + 1] == 't')
                {
                    builder.Replace("at", "@", i, 2);
                    metAt = true;
                }
            }
            Console.WriteLine(builder);
        }
    }
}


#define EXTENDSTACKSIZE

using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Globalization;
using System.IO;
using System.Linq;
 using System.Net;
 using System.Reflection;
 using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        private readonly int[,] config = new int[8, 2];

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;

        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var m = sr.NextInt32();
            var matrix = new char[n, m];
            for (var i = 0; i < n; i++) {
                var str = sr.NextString();
                for (var j = 0; j < m; j++) {
                    matrix[i, j] = str[j];
                }
            }

            config[0, 0] = 0;
            config[0, 1] = 0;
            config[1, 0] = 0;
            config[1, 1] = 1;
            config[2, 0] = 0;
            config[2, 1] = 2;

            config[3, 0] = 1;
            config[3, 1] = 2;
            config[4, 0] = 2;
            config[4, 1] = 2;
            config[5, 0] = 2;
            config[5, 1] = 1;

            config[6, 0] = 2;
            config[6, 1] = 0;
            config[7, 0] = 1;
            config[7, 1] = 0;

            for (var i = 0; i < n; i++) {
                for (var j = 0; j < m; j++) {
                    var ch = matrix[i, j];
                    if (ch == '#') {
                        if (!Check(matrix, i, j, n, m)) {
                            sw.WriteLine("NO");
                            return;
                        }
                    }
                }
            }

            sw.WriteLine("YES");
        }

        private bool Check(char[,] matrix, int i, int j, int n, int m)
        {
            for (var l = 0; l <= 2; l++) {
                for (var k = 0; k <= 2; k++) {
                    if(l == 1 && k == 1)
                        continue;

                    var x = i - l;
                    var y = j - k;
                    var can = true;
                    for (var p = 0; p < 8; p++) {
                        var newX = x + config[p, 0];
                        var newY = y + config[p, 1];
                        if (newX < 0 || newX >= n || newY < 0 || newY >= m || matrix[newX, newY] != '#')
                            can = false;
                        if (!can)
                            break;
                    }

                    if (can)
                        return true;
                }
            }

            return false;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


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

namespace prA {
    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter(@"..\..\output");
        private static readonly StreamReader reader = new StreamReader(@"..\..\input");
#endif

        static void Main(string[] args) {
            int n = NextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = NextInt();
            }
            int best = int.MaxValue;
            for (int j = 0; j < n; j++) {
                int cur = 0;
                for (int i = 0; i < n; i++) {
                    cur += a[i] * (Math.Abs(i - j) + i + j + j + i + Math.Abs(i - j));
                }
                best = Math.Min(best, cur);
            }
            writer.Write(best);
            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int NextInt() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
        private static long NextLong() {
            int c;
            long res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using SB = System.Text.StringBuilder;
using System.Numerics;
using static System.Math;
using Number = System.Int64;
namespace Program {
    public class Solver {
        Random rnd = new Random(0);

        public void Solve() {
            var n = ri;
            var s = rs;
            const string T = "ACTG";
            var ans = 1000000000;
            for (int i = 0; i <= n - 4; i++) {
                var val = 0;
                for (int j = 0; j < 4; j++) {
                    var u = T[j] - 'A';
                    var v = s[i + j] - 'A';
                    val += Min(Abs(u - v), 26 - Abs(u - v));
                }
                ans = Min(ans, val);
            }
            Console.WriteLine(ans);
        }

        const long INF = 1L << 60;
        int ri => sc.Integer();
        long rl => sc.Long();
        double rd => sc.Double();
        string rs => sc.Scan();
        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());

        static IEnumerable<int> Rep(int n) => Enumerable.Range(0, n);
        static IEnumerable<int> RRep(int n) => Enumerable.Range(0, n).Reverse();
        static T[] Enumerate<T>(int n, Func<int, T> f) {
            var a = new T[n];
            for (int i = 0; i < a.Length; ++i) a[i] = f(i);
            return a;
        }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex {
    static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
        return string.Join(st, ie);
    }
    static public void Main() {
        Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });
        var solver = new Program.Solver();
        solver.Solve();
        Console.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO {
    using System.IO;
    using System.Text;
    using System.Globalization;

    public class Printer : StreamWriter {
        public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;
        public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
    }

    public class StreamScanner {
        public StreamScanner(Stream stream) { str = stream; }

        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;

        private byte read() {
            if (isEof) return 0;
            if (ptr >= len) {
                ptr = 0;
                if ((len = str.Read(buf, 0, 1024)) <= 0) {
                    isEof = true;
                    return 0;
                }
            }
            return buf[ptr++];
        }

        public char Char() {
            byte b = 0;
            do b = read(); while ((b < 33 || 126 < b) && !isEof);
            return (char)b;
        }
        public string Scan() {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine() {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n' && b != 0; b = (char)read()) if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
        public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
        public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
    }
}

#endregion


using System;

public class Program
{
    public static void Main()
    {
        int count, zeroCount;
        string binaryNumber;

        count = int.Parse(Console.ReadLine());
        binaryNumber = Console.ReadLine();
        zeroCount = 0;

        if (binaryNumber == "0")
        {
            Console.WriteLine("0");
            return;
        }

        for (int i = 0; i < binaryNumber.Length; i++)
        {
            if (binaryNumber[i] == '0')
                zeroCount++;
        }

        Console.Write("1");
        for (int i = 0; i < zeroCount; i++)
        {
            Console.Write("0");
        }
        Console.WriteLine();
    }
}


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

namespace CompetitiveProgramming
{
	class Program
	{
		static void Main()
		{
			var cases = int.Parse(Console.ReadLine());
			var output = new ModVal[cases];

			for (int i = 0; i < cases; i++)
			{
				var ints = Console.ReadLine().Split().Select(long.Parse).ToArray();
				var n = ints[0];
				var k = ints[1];
				ModVal ans = Solve(n, k);

				//var s2 = S2(n, k);
				//if (s2 != ans)
				//	Console.WriteLine(s2.Val.ToString() + " " + ans.ToString());

				output[i] = ans;
			}

			output.ToList().ForEach(x => Console.WriteLine(x.Val));
		}

		private static ModVal S2(long n, long k)
		{
			var gaa = new long[n];

			int ab = 0;

			var mask = ~(-1L << (int)k);

			var groups = new int[k];

			var eqa = 0;

			for (long i = 0; i < 1 << ((int)n * (int)k); i++)
			{
				for (int j = 0; j < n; j++)
				{
					gaa[j] = (i >> (j * (int)k)) & mask;
				}

				var anda = gaa.Aggregate(mask, (x, y) => x & y);
				var xora = gaa.Aggregate(0L, (x, y) => x ^ y);

				if (anda == xora)
					eqa++;
				if (anda >= xora)
				{
					ab++;
					//Console.WriteLine(string.Join(' ', gaa));
				}
			}

			Console.WriteLine((ab - eqa).ToString() + ' ' + eqa.ToString());

			return ab;
		}

		private static ModVal Solve(long n, long k)
		{
			// jesli jest nieparzysta to wygrywa gdy na wszystkich bitach jest albo parzysta liczba jedynek albo wszystkie jedynki
			// parzysta liczba jedynek może być na 2^(n-1) sposobow

			ModVal ans;
			if (n % 2 == 1)
			{
				var xa = BigInteger.ModPow(2, n - 1, ModVal.Mod) + 1;
				var va = BigInteger.ModPow(xa, k, ModVal.Mod);
				ans = (long)va;
			}
			else
			{
				// albo wygrywam na ktoryms bicie, albo to co w poprzednim
				var xa = BigInteger.ModPow(2, n - 1, ModVal.Mod) - 1;
				var va = BigInteger.ModPow(xa, k, ModVal.Mod);

				ModVal acc = 0;
				for (int j = 0; j < k; j++)
				{
					var va2 = BigInteger.ModPow(xa, k - j - 1, ModVal.Mod);

					var ga = BigInteger.ModPow(2, j * n, ModVal.Mod)*va2;
					acc = (long)ga + acc;
				}

				//Console.WriteLine((acc).ToString() + ' ' + va.ToString());

				ans = acc + (long)va;
			}

			return ans;
		}
	}

	public struct ModVal
	{
		public static long Mod = 1000000007;
		public readonly long Val;

		public ModVal(long val)
		{
			Val = val % Mod;
		}

		public override bool Equals(object obj) => obj is ModVal && Val == ((ModVal)obj).Val;
		public override int GetHashCode() => Val.GetHashCode();
		public override string ToString() => Val.ToString();
		public static ModVal operator +(ModVal a, ModVal b) => new ModVal(a.Val + b.Val);
		public static ModVal operator -(ModVal a, ModVal b) => new ModVal(a.Val - b.Val + Mod);
		public static ModVal operator *(ModVal a, ModVal b) => new ModVal(a.Val * b.Val);
		public static bool operator ==(ModVal a, ModVal b) => a.Val == b.Val;
		public static bool operator !=(ModVal a, ModVal b) => a.Val != b.Val;
		public static implicit operator ModVal(long a) => new ModVal(a);
	}
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static object Solve()
    {
        var n = ReadInt();
        var m = ReadInt();
        var k = ReadInt();
        var a = ReadIntArray().OrderByDescending(d => d).ToArray();
        var x = m;
        x -= k > 1 ? k - 1 : 0;
        int i;
        for (i = 0; x > 0 && i < n; i++)
        {
            if (x - a[i] == 0)
            {
                x = 0;
                continue;
            }
            else
            {
                x -= (a[i] - 1);
            }
        }
        writer.WriteLine(m <= k ? 0 : x <= 0 ? i : -1);
        return null;
    }
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        try
        {
            object result = Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        reader.Close();
        writer.Close();
    }
    #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);
    }
    static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c != '-' && (c < '0' || c > '9'));
        int sign = 1;
        if (c == '-')
        {
            sign = -1;
            c = reader.Read();
        }
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res * sign;
            res *= 10;
            res += c - '0';
        }
    }
    #endregion
}


// See https://aka.ms/new-console-template for more information

(int x, int y) = ReadTwoInts();
Console.WriteLine(y == 1 ? x - 1 : 1L * x * (y - 1));

#region Read
static int ReadInt() => int.Parse(Console.ReadLine());
static (int x, int y) ReadTwoInts()
{
	var ints = ReadInts();
	return (ints[0], ints[1]);
}
static string ReadString() => Console.ReadLine();
static List<string> ReadStrings() => Console.ReadLine().Split(' ').ToList();
static List<int> ReadInts()
{
	List<string> strings = ReadStrings();
	List<int> ints = new();
	for (int i = 0; i < strings.Count; i++)
	{
		ints.Add(int.Parse(strings[i]));
	}
	return ints;
}
#endregion