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

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

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

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

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

        private static Stopwatch _stopwatch = new Stopwatch();

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

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

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

        static int Count(string source, string key)
        {

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

            int index = source.IndexOf(key, 0);

            while (index > -1)
            {
                indices.Add(index);
                index = source.IndexOf(key, index + key.Length);
            }

            return indices.Count();
        }

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

            while (true)
            {
                bool used = false;

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

                        used = true;
                    }
                }

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

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

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

            return _curLine[_curTokenIdx++];
        }

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

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

            _stopwatch.Start();

#endif
        }

        private static void Main(string[] args)
        {

#if (DEBUG)
            double before = GC.GetTotalMemory(false);
#endif
            int N = int.Parse(Console.ReadLine());

            string s = Console.ReadLine();

            int max = 0;

            for (int i = 1; i <= N; i++)
            {
                if (2 * i > N)
                {
                    break;
                }

                if (s.Substring(0, i).Equals(s.Substring(i, 2 * i)))
                {
                    max = i;
                }

            }

            Console.WriteLine(Math.Min((N - 2 * max) + max + 1, N));

#if (DEBUG)
            _stopwatch.Stop();

            double after = GC.GetTotalMemory(false);

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

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

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

            Console.ReadKey();
#endif

        }

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

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

                else
                {
                    break;
                }

            }

            return countZero;
        }

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

            Array.Reverse(reverseArray);

            string reversedString = new string(reverseArray);

            return reversedString;
        }

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

        private static string StreamReader()
        {

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

        }

        private static void StreamWriter(string text)
        {

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

        }

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

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

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

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

            }
            return 0;

        }

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

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

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

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

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

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

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

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

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

            return arr;
        }
    }
}


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

namespace Codeforces
{
   class B
   {
      static void Main(string[] args)
      {
         int n = int.Parse(Console.ReadLine());
         string s = Console.ReadLine();

         int ans = n;
         int dup = 0;

         int up = (n%2==0)?n/2:(n-1)/2;
         string m1 = s[0] + "" + s[1];

         for(int i=2;i<=up;i++){
           string m2 = "";
           for(int j=i; ;j++){
             m2 += s[j]+"";
             if(m2.Length==i)break;
           }

           if(m2==m1){
             dup = Math.Max(dup,m2.Length);
           }

           m1 += s[i]+"";

         }

        if(dup>1){
          ans -= dup;
          ans++;
        }

         Console.WriteLine(ans);

      }
   }
}


using System;
using System.Collections.Generic;

class Program
{
static void Main()
{
string[] inp = Console.ReadLine().Split(' ');
char[] s = inp[0].ToCharArray();
char[] b = inp[1].ToCharArray();
for (int i = 0; i <= b.GetUpperBound(0); i++)
{
char swap = b[i];
b[i] = b[b.GetUpperBound(0) - i];
b[b.GetUpperBound(0)-i] = swap;
}
int outy = int.Parse(s.ToString()) + int.Parse(b.ToString());
Console.WriteLine(outy);
}
}


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

namespace Achill
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int res = 0;
            for(int i = 1; i <= n; ++i)
            {
                res += i.ToString().Length;
            }
            Console.WriteLine(res);
        }
    }
}


using System;
class Program
    {
        static void Main(string[] args)
        {
            int[] db = {0, 9, 108, 1107, 11106, 111105, 1111104, 11111103, 111111102};
            string inpt = Console.ReadLine();
            Console.WriteLine(inpt.Length * int.Parse(inpt) - db[inpt.Length - 1]);
        }
    }


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

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int input = int.Parse(Console.ReadLine());
            int ans = 0;
            for (int i = 1; i <= input; i++)
            {
                ans += i.ToString().Count();
            }
            Console.WriteLine(ans);
        }
    }
}


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

namespace Codeforces_Proj
{
	class MainClass
	{
		public static void Main(string[] args){
			int answer = 0;
			int N = int.Parse(Console.ReadLine());
			for (int i = 1; i <= N; i++)
			{
				answer += (i.ToString()).Length;
			}
			Console.WriteLine(answer);
		}
	}
}


using System;

class Program
{
	static void Main(string[] args)
	{
	    var ss = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(ss[0]);
        var m = int.Parse(ss[1]);
        var GL = true;
        var HF = false;
		string s = Console.ReadLine();
		for (int i=0; i+m+1<=n; i++)
		{
		    var ok = false;
		    for (int j=0; j<=m; j++)
	            if (s[i+j] != 'N')
		            ok = true;
			if (!ok)
			    GL = false;
		}
		for (int i=0; i+m<=n; i++)
		{
		    var ok = true;
		    for (int j=0; j<m; j++)
		        if (s[i+j] == 'Y')
		            ok = false;
		    if (ok)
		        HF = true;
		}
		if (GL && HF)
		    Console.Write("YES\n");
		else
		    Console.Write("NO\n");
	}
}


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

namespace Devu__the_Singer_and_Churu__the_Joker
{
    class Program
    {
        static IO io = new IO();
        static void Main(string[] args)
        {
            int int_N = io.ReadNextInt();
            int int_D = io.ReadNextInt();
            int int_T = 0;
            for (int i = 0; i < int_N; i++)
            {
                int_T += io.ReadInt();
            }
            if (int_D - int_T - 10 * (int_N - 1) < 0)
            {
                io.PutStr(-1);
            }
            else
            {
                int_D -= int_T;
                io.PutStr(int_D/5);
            }
            io.ReadInt();
        }
    }
    class IO
    {
        private static Queue<string> currentLineTokens = new Queue<string>();
        private static string[] ReadAndSplitLine()
        {
            return Console.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }
        public int ReadNextInt()
        {
            return int.Parse(ReadToken());
        }
        public long ReadNextLong()
        {
            return long.Parse(ReadToken());
        }

        public int ReadInt()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
        public long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }
        public string ReadStr()
        {
            return Console.ReadLine();
        }
        public string[] ReadStrArr()
        {
            return Console.ReadLine().Split(' ');
        }
        public int[] ReadIntArr()
        {
            return Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), s => int.Parse(s));
        }
        public long[] ReadLongArr()
        {
            return Array.ConvertAll<string, long>(Console.ReadLine().Split(' '), s => long.Parse(s));
        }
        public void PutStr(string str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(int str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(long str)
        {
            Console.WriteLine(str);
        }

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


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

namespace CodeForces
{
    class B
    {
        static void Main(string[] args)
        {
          string[] token = Console.ReadLine().Split();
          int l = int.Parse(token[0]);
          int r = int.Parse(token[1]);
          int x = int.Parse(token[2]);
          int y = int.Parse(token[3]);
          int k = int.Parse(token[4]);

          for(;l<r;l++)
          {
             for(;x<y;y++)
             {
                if(l/x == k)
                {
                   Console.WriteLine("YES");
                   return;
                }
             }
          }
          Console.WriteLine("NO");

        }

    }
}


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

namespace ConsoleApplication12
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split('+').Select(int.Parse).ToArray();
            int s = 0;
            for (int i=1; i<=a[2]; i++)
            {
                s += a[0] * i;
            }
            Console.WriteLine(s - a[1]);
        }
    }
}


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 if (min == 3)
            {
                throw new Exception();
                Printer.PrintLine(4);
            }
        }
        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.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> karta = new List<int>(); List<int> itogi = new List<int>();
            string stroka = ""; ; string konec = ""; int a = 2; int itog = 0; int kol = 0; int dnei = 0; long y = 1; long minut = 0; string konec2 = ""; long[] strochenka = { 0, 0 }; List<long> str = new List<long>();
            konec = Console.ReadLine();
            string[] split = konec.Split(new Char[] { ' ' });
            foreach (string s in split)
            {
                karta.Add(Convert.ToInt32(s));
            }
            karta.Sort();
            itog = karta.Sum();
            dnei = karta.Sum();
            foreach (int e in karta)
            {
                foreach (int t in karta)
                {
                    if (t == e)
                    {
                        a--;
                        if(a>=0)
                        itog -= t;
                    }
                }
                if(a<1)
                itogi.Add(itog);
                a = 2;
                itog = karta.Sum();

            }
            if (itogi.Count > 0)
                dnei = itogi.Min();
            Console.WriteLine(dnei);

        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{CDB32670-23CF-4D55-8B01-E9508F2B3E5F}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string sayi = Console.ReadLine();

            Console.Write(toplam1(sayi));
            Console.ReadKey();

        }
        static int toplam1(string sayi)
        {
            int[] a = new int[5];
            int sayilartop = 0;
            int ds = 0;
            int sayac = 0;
            int sayac1 = 0;
            int t1 = 0;
            int t2 = 0;
            string[] sayilar = sayi.Split(' ');
            for (int i = 0; i < sayilar.Length; i++)
            {
                 sayilartop = sayilartop + int.Parse(sayilar[i]);
            }
            for (int i = 0; i < 5; i++)
            {
                for (int j = i+1; j < 5; j++)
                {
                    if (sayilar[i] == sayilar[j])
                    {
                        a[ds] = int.Parse(sayilar[i]);
                        ds++;
                    }
                }
            }
            Array.Sort(a);
            if (a.Length == 0)
            {
                return sayilartop;
            }
            do
            {
                if (a[sayac].Equals(a[sayac+1]))
                {
                    sayac1++;
                    if (sayac1 == 2)
                    {
                        t1 = sayilartop - a[2]*3;
                    }
                }
                sayac++;
            } while (sayac < a.Length-1);

            t2 = Math.Min(sayilartop -a[a.Length-1]*2,sayilartop-a[0]*2);
            if (t1 == 0)
            {
                return t2;
            }
            return Math.Min(t1,t2);

        }
    }

}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string sayi = Console.ReadLine();

                Console.Write(toplam1(sayi));
                Console.ReadKey();
            }
            catch
            {
            }

        }
        static int toplam1(string sayi)
        {
            int[] sayilar = new int[5];
            int[] a_sayi = new int[2];
            int x = 0;
            int sayilartop = 0;
            int i = 0;
            int sayac = 0;
            int t1 = 0;
            foreach (string sayi1 in sayi.Split(' '))
            {
                sayilar[i] = int.Parse(sayi1);
            }
            Array.Sort(sayilar);
            for (int j = 0; j < 5; j++)
            {
                sayilartop += sayilar[j];
            }

            while (sayac < sayilar.Length-1)
            {
                if (sayilar[sayac] == sayilar[sayac+1])
                {
                    if (sayilar[sayac+1]== sayilar[sayac+2] && sayac != sayilar.Length-2)
                    {
                        t1 = sayilartop - (sayilar[sayac] * 3);
                    }
                    else
                    {
                        a_sayi[x] = sayilartop - (sayilar[sayac] * 2);
                        x++;
                    }

                }
            }
            Array.Sort(a_sayi);
            x = Math.Min(t1,a_sayi[0]);
            return Math.Min(x,sayilartop);

}
    }

}


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

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(s);
            int r1 = 0;
            int r2 = 0;
            int y1 = 0;
            int y2 = 0;
            for (int i = s.Length - 1; i > 1; i--)
            {
                if ((s[i]==s[i-1])&&(s[i-1]==s[i-2]))
                {
                    r1 = s[i] + s[i - 1] + s[i - 2];
                    y1 = i;

                    break;
                }
            }

                for (int i = s.Length - 1; i >= 1; i--)
                {
                    if ((s[i] == s[i - 1])&&s[i-1]!=s[i-2])
                    {
                        r2 = s[i] + s[i - 1];

                        y2 = i;
                        break;
                    }
                }

            if ((r1>=r2)&&(r1>0))
            {
                s[y1] = s[y1 - 1] = s[y1 - 2] = 0;
            }
            else if((r2>r1)&&(r2>0))
            {
                s[y2] = s[y2 - 1] = 0;
            }

            Console.WriteLine(s.Sum());

        }
    }
}


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

// (づ*ω*)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int BitCount(int x)
    {
        int ret = 0;
        while (x > 0)
        {
            ret++;
            x &= x - 1;
        }
        return ret;
    }

    public object Solve()
    {
        int n = ReadInt();
        var cards = new Tuple<int, int>[n];
        for (int i = 0; i < n; i++)
        {
            var t = ReadToken();
            cards[i] = Tuple.Create("RGBYW".IndexOf(t[0]) + 5, t[1] - '1');
        }

        int ans = 15;
        for (int k = 0; k < 2 << 10; k++)
        {
            bool ok = true;
            for (int i = 0; i < n && ok; i++)
                for (int j = i + 1; j < n && ok; j++)
                    if (cards[i].ToString() != cards[j].ToString())
                    {
                        ok = false;
                        if (cards[i].Item1 != cards[j].Item1 && ((k >> cards[i].Item1 & 1) == 1 || (k >> cards[j].Item1 & 1) == 1))
                            ok = true;
                        if (cards[i].Item2 != cards[j].Item2 && ((k >> cards[i].Item2 & 1) == 1 || (k >> cards[j].Item2 & 1) == 1))
                            ok = true;
                    }
            if (ok)
                ans = Math.Min(ans, BitCount(k));
        }

        return ans;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

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

    #endregion

    #region Read/Write

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

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

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

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

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

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

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

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

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

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

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

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

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

    #endregion
}


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

namespace Bsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string time = Console.ReadLine();
            string h = time.Substring(0, 2);
            string m = time.Substring(3, 2);
            int mingr = 0;
            double hourdgr = 0;
            int hours = Int16.Parse(h);
            int mins = Int16.Parse(m);

            if (hours > 12) hours -= 12;
            if (hours == 12) hours =0;
            hourdgr = hours * 30 + mins / 2.0;
            h = hourdgr.ToString();
            h = h.Replace(',', '.');
            if (mins>0) mins = 60 - mins;
            mingr = mins * 6;
            mingr = Math.Min(mingr, 360 - mingr);

            Console.WriteLine(h + " " + mingr);

        }
    }
}


using System;

namespace consap1
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            String[] inp = Console.ReadLine().Split();
            long Ax = long.Parse(inp[0]), Ay = long.Parse(inp[1]),
            Bx = long.Parse(inp[2]), By = long.Parse(inp[3]),
            Cx = long.Parse(inp[4]), Cy = long.Parse(inp[5]);
            if ((Ax - Bx)*(Ax - Bx) + (Ay - By)*(Ay - By) == (Cx - Bx) * (Cx - Bx) + (Cy - By) * (Cy - By)) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


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

namespace ConsoleApplication1.CodeForces
{
    public class LowerBoundSortedSet<T> : SortedSet<T>
    {

        private ComparerDecorator<T> _comparerDecorator;

        private class ComparerDecorator<T> : IComparer<T>
        {

            private IComparer<T> _comparer;

            public T LowerBound { get; private set; }
            public T UpperBound { get; private set; }

            private bool _reset = true;

            public void Reset()
            {
                _reset = true;
            }

            public ComparerDecorator(IComparer<T> comparer)
            {
                _comparer = comparer;
            }

            public int Compare(T x, T y)
            {
                int num = _comparer.Compare(x, y);
                if (_reset)
                {
                    LowerBound = y;
                    UpperBound = y;
                }
                if (num >= 0)
                {
                    LowerBound = y;
                    _reset = false;
                }
                if (num <= 0)
                {
                    UpperBound = y;
                    _reset = false;
                }
                return num;
            }
        }

        public LowerBoundSortedSet()
            : this(Comparer<T>.Default) { }

        public LowerBoundSortedSet(IComparer<T> comparer)
            : base(new ComparerDecorator<T>(comparer))
        {
            _comparerDecorator = (ComparerDecorator<T>)this.Comparer;
        }

        public T FindLowerBound(T key)
        {
            _comparerDecorator.Reset();
            this.Contains<T>(key);
            return _comparerDecorator.LowerBound;
        }

        public T FindUpperBound(T key)
        {
            _comparerDecorator.Reset();
            this.Contains<T>(key);
            return _comparerDecorator.UpperBound;
        }
    }
    public abstract class Heap<T> : IEnumerable<T>
    {
        private const int InitialCapacity = 0;
        private const int GrowFactor = 2;
        private const int MinGrow = 1;

        private int _capacity = InitialCapacity;
        private T[] _heap = new T[InitialCapacity];
        private int _tail = 0;

        public int Count { get { return _tail; } }
        public int Capacity { get { return _capacity; } }

        protected Comparer<T> Comparer { get; private set; }
        protected abstract bool Dominates(T x, T y);

        protected Heap() : this(Comparer<T>.Default)
        {
        }

        protected Heap(Comparer<T> comparer) : this(Enumerable.Empty<T>(), comparer)
        {
        }

        protected Heap(IEnumerable<T> collection)
            : this(collection, Comparer<T>.Default)
        {
        }

        protected Heap(IEnumerable<T> collection, Comparer<T> comparer)
        {
            if (collection == null) throw new ArgumentNullException("collection");
            if (comparer == null) throw new ArgumentNullException("comparer");

            Comparer = comparer;

            foreach (var item in collection)
            {
                if (Count == Capacity)
                    Grow();

                _heap[_tail++] = item;
            }

            for (int i = Parent(_tail - 1); i >= 0; i--)
                BubbleDown(i);
        }

        public void Add(T item)
        {
            if (Count == Capacity)
                Grow();

            _heap[_tail++] = item;
            BubbleUp(_tail - 1);
        }

        private void BubbleUp(int i)
        {
            if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))
                return; //correct domination (or root)

            Swap(i, Parent(i));
            BubbleUp(Parent(i));
        }

        public T GetMin()
        {
            if (Count == 0) throw new InvalidOperationException("Heap is empty");
            return _heap[0];
        }

        public T ExtractDominating()
        {
            if (Count == 0) throw new InvalidOperationException("Heap is empty");
            T ret = _heap[0];
            _tail--;
            Swap(_tail, 0);
            BubbleDown(0);
            return ret;
        }

        private void BubbleDown(int i)
        {
            int dominatingNode = Dominating(i);
            if (dominatingNode == i) return;
            Swap(i, dominatingNode);
            BubbleDown(dominatingNode);
        }

        private int Dominating(int i)
        {
            int dominatingNode = i;
            dominatingNode = GetDominating(YoungChild(i), dominatingNode);
            dominatingNode = GetDominating(OldChild(i), dominatingNode);

            return dominatingNode;
        }

        private int GetDominating(int newNode, int dominatingNode)
        {
            if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))
                return newNode;
            else
                return dominatingNode;
        }

        private void Swap(int i, int j)
        {
            T tmp = _heap[i];
            _heap[i] = _heap[j];
            _heap[j] = tmp;
        }

        private static int Parent(int i)
        {
            return (i + 1) / 2 - 1;
        }

        private static int YoungChild(int i)
        {
            return (i + 1) * 2 - 1;
        }

        private static int OldChild(int i)
        {
            return YoungChild(i) + 1;
        }

        private void Grow()
        {
            int newCapacity = _capacity * GrowFactor + MinGrow;
            var newHeap = new T[newCapacity];
            Array.Copy(_heap, newHeap, _capacity);
            _heap = newHeap;
            _capacity = newCapacity;
        }

        public IEnumerator<T> GetEnumerator()
        {
            return _heap.Take(Count).GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }

    public class MaxHeap<T> : Heap<T>
    {
        public MaxHeap()
            : this(Comparer<T>.Default)
        {
        }

        public MaxHeap(Comparer<T> comparer)
            : base(comparer)
        {
        }

        public MaxHeap(IEnumerable<T> collection, Comparer<T> comparer)
            : base(collection, comparer)
        {
        }

        public MaxHeap(IEnumerable<T> collection) : base(collection)
        {
        }

        protected override bool Dominates(T x, T y)
        {
            return Comparer.Compare(x, y) >= 0;
        }
    }

    public class MinHeap<T> : Heap<T>
    {
        public MinHeap()
            : this(Comparer<T>.Default)
        {
        }

        public MinHeap(Comparer<T> comparer)
            : base(comparer)
        {
        }

        public MinHeap(IEnumerable<T> collection) : base(collection)
        {
        }

        public MinHeap(IEnumerable<T> collection, Comparer<T> comparer)
            : base(collection, comparer)
        {
        }

        protected override bool Dominates(T x, T y)
        {
            return Comparer.Compare(x, y) <= 0;
        }
    }
    static class _4032123
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        class Node
        {
            public int Number { get; set; }
            public int Depth { get; set; }

        }
        static double Distance(double x1, double y1, double x2, double y2)
        {
            return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
        }
        static void Main(String[] args)
        {
            //var n = int.Parse(Console.ReadLine().TrimEnd());
            var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();
            var x1 = data[0];
            var y1 = data[1];
            var x2 = data[2];
            var y2 = data[3];
            var x3 = data[4];
            var y3 = data[5];
            if (Distance(x1,y1,x2,y2) == Distance(x2,y2,x3,y3) && (y1-y2)* (x1 - x3) != (y1 - y3) * (x1 - x2))
            {
                writer.WriteLine("Yes");
            } else
            {
                writer.WriteLine("No");
            }

            writer.Flush();

        }
    }
}


using System;
class Test {
    static void Main() {
        string [] str = Console.ReadLine().Split();
        int [] a = new int [3];
        for(int k=0 ; k<3 ; k++){
            a[k] = int.Parse(str[k]);
        }
        int i = 0;
        int n = 0;
        int ct = -1;
        while(n<3){
            if(i==3){
                i=0;
            }
            if(a[i]<=0){
                i++;
                ct++;
                continue;
            }
            a[i] -= 2;
            if(a[i]<=0){
                n++;
            }
            ct++;
            i++;
        }
        Console.WriteLine(30+ct);
    }
}


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

namespace Cableway
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int totalRed = (int.Parse(input[0]) + 1) / 2 - 1;
            int totalGreen = (int.Parse(input[1]) + 1) / 2 - 1;
            int totalBlue = (int.Parse(input[2]) + 1) / 2 - 1;
            int total = 30;
            if (totalBlue > totalGreen && totalBlue > totalRed)
                total += (3 * totalBlue) + 2;
            else if (totalGreen > totalBlue && totalGreen > totalRed)
                total += (3 * totalGreen) + 1;
            else if (totalRed > totalBlue && totalRed > totalGreen)
                total += (3 * totalRed);
            else
            {
                int max = Math.Max(totalRed, Math.Max(totalBlue, totalGreen));
                total += (3 * max);
                if (max == totalBlue)
                    total += 2;
                else if (max == totalGreen)
                    total++;
            }
            Console.WriteLine(total);
            Console.ReadLine();
        }
    }
}


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

public class NewYearsEve : ISolution
    {
        public override void Solve()
        {
            ulong[] NandK = ReadArrString().Select(ulong.Parse).ToArray();
            ulong result;
            if(NandK[1]==1)
            {
                Console.Write(NandK[0]);
                return;
            }
            while (NandK[0]>=0)
            {
                result = 2*result + 1;
                NandK[0]>>=1;
            }
            Console.Write(result);
        }
    }

    public abstract class ISolution
    {
        public static Func<int> ReadInt = () => int.Parse(Console.ReadLine().Trim());
        public static Func<short> ReadShort = () => short.Parse(Console.ReadLine().Trim());
        public static Func<string> ReadString = () => Console.ReadLine().Trim();
        public static Func<byte> ReadByte = () => byte.Parse(Console.ReadLine().Trim());
        public static StringBuilder output = new StringBuilder();
        public static Func<string[]> ReadArrString = () => ReadString().Split(' ').ToArray();
        public abstract void Solve();
    }

    class Solution
    {
        static void Main(string[] args)
        {
            new NewYearsEve().Solve();
            Console.ReadLine();
        }
    }


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

public class NewYearsEve : ISolution
    {
        public override void Solve()
        {
            long[] NandK = ReadArrString().Select(long.Parse).ToArray();
            long result=0;
            if(NandK[1]==1)
            {
                Console.Write(NandK[0]);
                return;
            }
            while (NandK[0]>=0)
            {
                result = 2*result + 1;
                NandK[0]>>=1;
            }
            Console.Write(result);
        }
    }

    public abstract class ISolution
    {
        public static Func<int> ReadInt = () => int.Parse(Console.ReadLine().Trim());
        public static Func<short> ReadShort = () => short.Parse(Console.ReadLine().Trim());
        public static Func<string> ReadString = () => Console.ReadLine().Trim();
        public static Func<byte> ReadByte = () => byte.Parse(Console.ReadLine().Trim());
        public static StringBuilder output = new StringBuilder();
        public static Func<string[]> ReadArrString = () => ReadString().Split(' ').ToArray();
        public abstract void Solve();
    }

    class Solution
    {
        static void Main(string[] args)
        {
            new NewYearsEve().Solve();
            Console.ReadLine();
        }
    }


using System;
using System.Linq;

namespace B_NewYearsEve
{
    class Program
    {
        static void Main(string[] args)
        {
            var having = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

            long pow = 1;
            while(pow *2 <= having[0])
            {
                pow *= 2;
            }

            long result = 0;
            for(int i=0;i< having[1]; ++i)
            {
                result += pow;
                pow /= 2;
            }

            Console.WriteLine(result);
        }
    }
}


using System;
using System.Linq;
using System.Text;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] nk = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long n = nk[0];
            long k = nk[1];
            string s = Convert.ToString(n, 2);
            StringBuilder strB = new StringBuilder(s);
            bool start = false;
            for (int i = 0; i < s.Length; i++)
            {
                if (strB[i] == '1' && !start) {
                    start = true;
                    continue;
                }
                if (start && --k > 0) {
                    strB[i] = '1';
                }
            }
            s = strB.ToString();
            long ans = Convert.ToInt32(s, 2);
            Console.WriteLine(ans);
        }
    }
}


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

namespace Codeforces
{
    class A
    {
        private static ThreadStart s_threadStart = new A().Go;
        private static bool s_time = false;
        private static double s_eps = 1e-16;

        HashSet<long>[] adj;

        private void Go()
        {
            long n = GetInt();
            long m = GetInt();

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

            for (int i = 0; i < m; i++)
            {
                long x = GetInt() - 1;
                long y = GetInt() - 1;
                adj[x].Add(y);
                adj[y].Add(x);
            }

            int[] visited = new int[n];

            for (int i = 0; i < n; i++)
            {
                if (adj[i].Count == n - 1)
                    visited[i] = -1;
            }

            int compCount = 0;

            for (int i = 0; i < n; i++)
            {
                if (visited[i] == 0)
                {
                    Queue<Tuple<long, int>> q = new Queue<Tuple<long, int>>();
                    q.Enqueue(new Tuple<long, int>(i, 1));
                    visited[i] = ++compCount;
                    while (q.Count > 0)
                    {
                        var node = q.Dequeue();
                        long x = node.Item1;
                        int level = node.Item2;
                        foreach (long child in adj[x])
                        {
                            if (visited[child] == 0)
                            {
                                q.Enqueue(new Tuple<long, int>(child, level));
                                visited[child] = level;
                            }
                        }
                    }
                }
            }

            if (compCount > 2)
            {
                Wl("No");
                return;
            }

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (i != j && !adj[i].Contains(j) && (visited[i] + visited[j]) != 3)
                    {
                        Wl("No");
                        return;
                    }
                }
            }

            Wl("Yes");
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < n; i++)
            {
                if (visited[i] == -1) sb.Append('b');
                else if (visited[i] == 1) sb.Append('a');
                else sb.Append('c');
            }
            Wl(sb.ToString());
        }

        #region Template

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

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

            return ioEnum.Current;
        }

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

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

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

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

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

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

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

        #endregion
    }
}


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

class Program
{
    private static bool Go(int v, int value)
    {
        if (ans[v] != 0)
        {
            return (ans[v] == value);
        }

        ans[v] = value;
        for (int i = 1; i <= n; i++)
            if (i != v && g[i, v] == 0)
            {
                if (!Go(i, 3 - value))
                    return false;
            }

        return true;
    }

    private static int[] ans;
    private static int[,] g;
    private static int n;
    static void Main(string[] args)
    {
        n = ReadInt();
        int m = ReadInt();
        g = ReadGraphAsMatrix(n, m);
        ans = new int[n + 1];

        for (int i = 1; i <= n; i++)
            if (ans[i] == 0)
                for (int j = i + 1; j <= n; j++)
                    if (g[i, j] == 0)
                    {
                        if (!Go(i, 1))
                        {
                            Console.WriteLine("No");
                            return;
                        }
                        break;
                    }

        Console.WriteLine("Yes");
        char[] map = new char[] { 'b', 'a', 'c' };
        for (int i = 1; i <= n; i++)
            Console.Write(map[ans[i]]);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n + 1];
        for (int i = 0; i <= n; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt();
            int b = ReadInt();
            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt();
            int b = ReadInt();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static readonly StreamReader consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);

    private static int ReadInt()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong ReadULong()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long ReadLong()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] ReadIntArray(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadInt();
        return ans;
    }

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

    private static char[] ReadString()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans < 'a' || ans > 'z');

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans >= 'a' && ans <= 'z');

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans < 'a' || ans > 'z');

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            ans = consoleReader.Read();
        } while (ans >= 'a' && ans <= 'z');

        return s;
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        while (true)
        {
            return ReadDigit() - (int)'0';
        }
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }
}


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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            string burg = Console.ReadLine();
            string [] EstMas = Console.ReadLine().Split(new char[]{' '});
            string [] MagMas = Console.ReadLine().Split(new char[] { ' ' });
            long nb = long.Parse(EstMas[0]);
            long ns = long.Parse(EstMas[1]);
            long nc = long.Parse(EstMas[2]);
            long pb = long.Parse(MagMas[0]);
            long ps = long.Parse(MagMas[1]);
            long pc = long.Parse(MagMas[2]);
            long deneg = long.Parse(Console.ReadLine());
            long b = 0, s = 0, c = 0;
            for (int i = 0; i < burg.Length; i++)
            {
                if (burg[i] == 'B')
                {
                    b++;
                }
                else if (burg[i] =='S')
                {
                    s++;
                }
                else if (burg[i] == 'C')
                {
                    c++;
                }
            }

            long res=0;
            long bb = b == 0 ? long.MaxValue : nb / b;
            long cc = c == 0 ? long.MaxValue : nc / c;
            long ss = s == 0 ? long.MaxValue : ns / s;
            long min = Math.Min(Math.Min(bb, cc), ss);
                res+=min;
                nb -= min*b;
                ns -= min*s;
                nc -= min*c;

            while (true)
            {
                long nadodeneg = 0;
                if (nb == 0 && nc == 0 && ns == 0)
                {
                    nadodeneg = pb * b + pc * c + ps * s;
                    res += deneg / nadodeneg;
                    break;
                }

                if (nb < b)
                {
                    nadodeneg+=(b-nb)*pb;
                }
                if (nc < c)
                {
                    nadodeneg += (c - nc) * pc;

                }
                if (ns < s)
                {
                    nadodeneg += (s - ns) * ps;

                }
                if (nadodeneg <= deneg)
                {
                    res++;
                    deneg -= nadodeneg;
                    if (nb >= b)
                    {
                        nb -= b;
                    }
                    else {
                        nb = 0;
                    }
                    if (nc >= c)
                    {
                        nc -= c;
                    }
                    else {
                        nc = 0;
                    }
                    if (ns >= s)
                    {
                        ns -= s;

                    }
                    else {
                        ns = 0;
                    }
                }
                else
                {
                    break;
                }
            }
            Console.WriteLine(res);
        }
    }
}


using System;

namespace L
{
    class Program
    {
        static void Main(string[] args)
        {
            char[]c = Console.ReadLine().ToCharArray();
            int n = 10000 * (Convert.ToInt32(c[0]) - '0') + 1000 * (Convert.ToInt32(c[2]) - '0') + 100 * (Convert.ToInt32(c[4]) - '0') + 10 * (Convert.ToInt32(c[3]) - '0') + (Convert.ToInt32(c[1]) - '0'), a = n;
            for (int i = 0; i < 4; i++)
            {
                char[]f = Convert.ToString(n * a).ToCharArray();
                a = 10000 * (Convert.ToInt32(f[f.Length - 5]) - '0') + 1000 * (Convert.ToInt32(f[f.Length - 4]) - '0') + 100 * (Convert.ToInt32(f[f.Length - 3]) - '0') + 10 * (Convert.ToInt32(f[f.Length - 2]) - '0') + (Convert.ToInt32(f[f.Length - 1]) - '0');
            }
            Console.Write(a);
        }
    }
}


using System;

namespace L
{
    class Program
    {
        static void Main(string[] args)
        {
            char[]c = Console.ReadLine().ToCharArray();
            ulong n = 10000 * (Convert.ToUInt32(c[0]) - '0') + 1000 * (Convert.ToUInt32(c[2]) - '0') + 100 * (Convert.ToUInt32(c[4]) - '0') + 10 * (Convert.ToUInt32(c[3]) - '0') + (Convert.ToUInt32(c[1]) - '0'), a = n;
            for (int i = 0; i < 4; i++)
            {
                char[]f = Convert.ToString(n * a).ToCharArray();
                a = 10000 * (Convert.ToUInt32(f[f.Length - 5]) - '0') + 1000 * (Convert.ToUInt32(f[f.Length - 4]) - '0') + 100 * (Convert.ToUInt32(f[f.Length - 3]) - '0') + 10 * (Convert.ToUInt32(f[f.Length - 2]) - '0') + (Convert.ToUInt32(f[f.Length - 1]) - '0');
            }
            Console.Write(a);
        }
    }
}


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

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

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

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

            var max1 = new int[nn.Max() + 1];

            for (int i = 0; i < n; i++)
            {
                int m = 0;
                for (int j = 0; j <= nn[i]; j++)
                {
                    if (m < max1[j])
                        m = max1[j];
                }
                max1[nn[i]] = m + 1;
            }

            if (T == 1)
            {
                writer.WriteLine(max1.Max());
                writer.Flush();
                return;
            }

            var max2 = (int[]) max1.Clone();

            for (int i = 0; i < n; i++)
            {
                int m = 0;
                for (int j = 0; j <= nn[i]; j++)
                {
                    if (m < max2[j])
                        m = max2[j];
                }
                max2[nn[i]] = m + 1;
            }

            if (T == 2)
            {
                writer.WriteLine(max2.Max());
                writer.Flush();
                return;
            }

            var max3 = (int[]) max2.Clone();

            for (int i = 0; i < n; i++)
            {
                int m = 0;
                for (int j = 0; j <= nn[i]; j++)
                {
                    if (m < max3[j])
                        m = max3[j];
                }
                max3[nn[i]] = m + 1;
            }
            if (T == 3)
            {
                writer.WriteLine(max3.Max());
                writer.Flush();
                return;
            }

            int m3max = max3.Max();
            int delta = m3max - max2.Max();

            writer.WriteLine(m3max + delta*(T - 3));

            writer.Flush();
        }

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


using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using static Codeforces.IO;
using static System.Linq.Enumerable;

namespace Codeforces
{
    static class IO
    {
        static StringBuilder builder = new StringBuilder();
        static Dummy dummy = new Dummy();
        class Dummy
        {
            ~Dummy()
            {
                Console.Write(builder);
            }
        }
        public static void Write(object obj)
        {
            builder.Append(obj);
        }
        public static void WriteLine(object obj)
        {
            builder.AppendLine(obj.ToString());
        }
        public static void Write(params object[] objs)
        {
            if (objs.Length != 0)
            {
                Write(objs[0]);
                for (var i = 1; i < objs.Length; ++i)
                {
                    Write(" ");
                    Write(objs[i]);
                }
            }
        }
        public static void WriteLine(params object[] objs)
        {
            Write(objs);
            WriteLine();
        }

        public static void WriteLine()
        {
            builder.AppendLine();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }
        public static T ReadLine<T>(Func<string, T> parser)
        {
            return parser(ReadLine());
        }
        public static T[] ReadArray<T>(Func<string, T> parser)
        {
            return ReadLine().Split(' ').Select(parser).ToArray();
        }
        public static string[] ReadArray()
        {
            return ReadLine().Split(' ');
        }
        public static (T, T) ReadTuple2<T>(Func<string, T> parser)
        {
            var ar = ReadArray(parser);
            return (ar[0], ar[1]);
        }
        public static (string, string) ReadTuple2()
        {
            var ar = ReadArray();
            return (ar[0], ar[1]);
        }
        public static (T, T, T) ReadTuple3<T>(Func<string, T> parser)
        {
            var ar = ReadArray(parser);
            return (ar[0], ar[1], ar[2]);
        }
        public static (string, string, string) ReadTuple3()
        {
            var ar = ReadArray();
            return (ar[0], ar[1], ar[2]);
        }
    }

    static class Program
    {
        static int? Min(int? a,int? b)
        {
            return
                !a.HasValue ? b :
                !b.HasValue ? a :
                a.Value < b.Value ? a : b;
        }
        static void Main(string[] args)
        {
            var N = ReadLine(int.Parse);
            var ar = ReadArray(int.Parse);
            if (N == 1)
            {
                WriteLine(0);
                return;
            }
            var set = new SortedSet<int>(Range(1, N));
            foreach(var v in ar)
            {
                if (v != 0)
                {
                    set.Remove(v);
                }
            }
            var odd = 0;
            var even = 0;
            foreach(var v in set)
            {
                if (v % 2 == 0)
                {
                    ++even;
                }
                else
                {
                    ++odd;
                }
            }
            var dp = new int?[odd + 1, even + 1, 2];
            if (ar[0] != 0)
            {
                dp[odd, even, ar[0] % 2] = 0;
            }
            else
            {
                if (odd != 0)
                {
                    dp[odd - 1, even, 1] = 0;
                }
                if (even != 0)
                {
                    dp[odd, even - 1, 0] = 0;
                }
            }
            foreach(var i in Range(1, N - 2))
            {
                var next = new int?[odd + 1, even + 1, 2];
                if (ar[i] != 0)
                {
                    foreach (var a in Range(0, odd + 1))
                    {
                        foreach (var b in Range(0, even + 1))
                        {
                            next[a, b, ar[i] % 2] = Min(
                                dp[a, b, 0] + ar[i] % 2,
                                dp[a, b, 1] + 1 - (ar[i] % 2));
                        }
                    }
                }
                else
                {
                    foreach(var a in Range(1, odd))
                    {
                        next[a - 1, 0, 1] = Min(dp[a, 0, 0] + 1, dp[a, 0, 1] + 0);
                    }
                    foreach(var b in Range(1,even))
                    {
                        next[0, b - 1, 0] = Min(dp[0, b, 0], dp[0, b, 1] + 1);
                    }
                    foreach (var a in Range(1, odd))
                    {
                        foreach (var b in Range(1, even))
                        {
                            next[a - 1, b, 1] = Min(dp[a, b, 0] + 1, dp[a, b, 1]);
                            next[a, b - 1, 0] = Min(dp[a, b, 0], dp[a, b, 1] + 1);
                        }
                    }
                }
                dp = next;
            }
            if (ar[N - 1] != 0)
            {
                WriteLine(Min(
                    dp[0, 0, 0] + ar[N - 1] % 2,
                    dp[0, 0, 1] + 1 - (ar[N - 1] % 2)));
            }
            else
            {
                WriteLine(Min(
                    Min(dp[0, 1, 0], dp[1, 0, 0] + 1),
                    Min(dp[0, 1, 1] + 1, dp[1, 0, 1])));
            }
        }
    }
}


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

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

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

            int n = int.Parse(tokens[0]);
            int k = int.Parse(tokens[1]);
            int t = int.Parse(tokens[2]);

            int s = 0;

            for (int i = 0; i <=t;i++)
            {

                if (i > 0)
                {
                    s = s + 1;
                    if ((i > k) & (k <= n))
                    {
                        s = s - 1;
                    }
                    if (i > n) s = s - 1;
                }

                if (i == t)
                {
                    Console.WriteLine(s);
                    break;
                }

            }
               // while (Console.ReadKey().Key != ConsoleKey.Enter) { }

        }
    }
}


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

namespace ConsProg
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] data = Console.ReadLine().Split(' ').Select(x => x.ToInt()).ToArray();
            int n = data[0], k = data[1], t = data[2], count = 0;
            int[] moments = new int[n + k];
            for(int i = 1; i < moments.Length; i++)
            {
                if (i <= k)
                    count++;
                else if (i > n)
                    count--;
                moments[i] = count;
            }
            Console.WriteLine(moments[t]);
        }
        static int ReadInt()
        {
            return Console.ReadLine().ToInt();
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(x => x.ToInt()).ToArray();
        }

    }
    //Extensions
    public static class Extension
    {
        public static int ToInt(this object str)
        {
            return Convert.ToInt32(str);
        }
        public static void PrintArray<T>(this T[] arr)
        {
            for (int i = 0; i < arr.Length; i++)
                Console.WriteLine(arr[i]);
        }
    }
}


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

namespace TestPlace
{
    class Program
    {
        static void Main(string[] args)
        {
            var value = Convert.ToInt64(Console.ReadLine());
            Console.WriteLine(Mahmut(value,0));

        }
        static long Mahmut(long value, long result)
        {
            long m;
            if (value == -1)
                return result;
            else if (value % 2 == 1)
            {
                m = -1;
                result = result + m * value;
                return Mahmut(value - 1, result);
            }

            else
            {
                m = 1;
                result = result + m * value;
                return Mahmut(value - 1, result);

            }
        }
    }
}


using System;
using System.Linq;

class Program
{
    static void Main()
    {
        string str = Console.ReadLine();
        int n = int.Parse(str);

        var squares = new int[n, 4];

        int minX = -1, maxX = -1, minY = -1, maxY = -1;

        for (int i = 0; i < n; i++)
        {
            str = Console.ReadLine();
            var q = str.Split(new char[] {' '});

            squares[i, 0] = int.Parse(q[0]);
            squares[i, 1] = int.Parse(q[1]);
            squares[i, 2] = int.Parse(q[2]);
            squares[i, 3] = int.Parse(q[3]);

            if (i == 0)
            {
                minX = squares[i, 0];
                minY = squares[i, 1];
                maxX = squares[i, 2];
                maxY = squares[i, 3];
            }

            if (minX > squares[i, 0]) minX = squares[i, 0];
            if (minY > squares[i, 1]) minY = squares[i, 1];
            if (maxX < squares[i, 2]) maxX = squares[i, 2];
            if (maxY < squares[i, 3]) maxY = squares[i, 3];
            // Console.WriteLine(str);
        }

        Console.WriteLine("min X: {0}", minX);
        Console.WriteLine("min Y: {0}", minY);
        Console.WriteLine("max X: {0}", maxX);
        Console.WriteLine("max Y: {0}", maxY);

        // 31400, 0 ≤ y1 < y2 ≤ 31400
        var a = new byte[31401, 31401];

        for (int i = 0; i < n; i++)
        {
            for (int x = squares[i, 0]; x < squares[i, 2]; x++)
            {
                for (int y = squares[i, 1]; y < squares[i, 3]; y++)
                {
                    a[x, y] = 1;
                }
            }
        }

        if (maxX - minX != maxY - minY)
        {
            Console.WriteLine("NO");
            return;
        }

        int square1 = (maxX - minX) * (maxY - minY);
        int square2 = 0;

        for (int i = 0; i < n; i++)
        {
            square2 += (squares[i, 2] - squares[i, 0]) * (squares[i, 3] - squares[i, 1]);
        }

        if (square1 != square2)
        {
            // Console.WriteLine("NO 2 1: {0} 2: {1}", square1, square2);
            Console.WriteLine("NO");
            return;
        }

        Console.WriteLine("YES");
    }
}


using System;

namespace task124D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] splitStr = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(splitStr[0]);
            int b = Convert.ToInt32(splitStr[1]);
            int x1 = Convert.ToInt32(splitStr[2]);
            int y1 = Convert.ToInt32(splitStr[3]);
            int x2 = Convert.ToInt32(splitStr[4]);
            int y2 = Convert.ToInt32(splitStr[5]);
            int x, y;
            x = x1;
            y = y1;
            x1 = x + y;
            y1 = y - x;
            x = x2;
            y = y2;
            x2 = x + y;
            y2 = y - x;
            a *= 2;
            b *= 2;
            x1 = x1 / a + ((x1 > 0) ? 1 : 0);
            x2 = x2 / a + ((x2 > 0) ? 1 : 0);
            y1 = y1 / a + ((y1 > 0) ? 1 : 0);
            y2 = y2 / a + ((y2 > 0) ? 1 : 0);
            Console.WriteLine(Math.Max(Math.Abs(y2-y1), Math.Abs(x2-x1)));
        }
    }
}


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

namespace cases_mark_0
{
    class Program
    {
        static void Main(string[] args)
        {
            Move move = new Move();
            int x = move.counter;
            string inOut = Convert.ToString(Console.ReadLine());
            string[] bufSplit = inOut.Split(' ');
            int a = Int32.Parse(bufSplit[0]);
            int b = Int32.Parse(bufSplit[1]);
            int x1 = Int32.Parse(bufSplit[2]);
            int y1 = Int32.Parse(bufSplit[3]);
            int x2 = Int32.Parse(bufSplit[4]);
            int y2 = Int32.Parse(bufSplit[5]);
            if (x1 == x2 && y1 == y2)
            {
                Console.WriteLine(0);
            }
            else if ((x1 < x2) && (y1 < y2))//вверх вправо
            {
                y1 = move.MoveUp(a, b, y1, y2, x1);
                x1 = move.MoveRight(a, b, x1, x2, y1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
            else if (x1 > x2 && y1 < y2)//право низ
            {
                x1 = move.MoveLeft(a, b, x1, x2, y1);
                y1 = move.MoveUp(a, b, y1, y2, x1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
            else if (x1 > x2 && y1 > y2)//низ лево
            {
                y1 = move.MoveDown(a, b, y1, y2, x1);
                x1 = move.MoveLeft(a, b, x1, x2, y1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
            else if (x1 < x2 && y1 > y2)//верх лево
            {
                y1 = move.MoveUp(a, b, y1, y2, x1);
                x1 = move.MoveLeft(a, b, x1, x2, y1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
            else if (x1 == x2 && y1 > y2)//низ
            {
                y1 = move.MoveDown(a, b, y1, y2, x1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
            else if (x1 == x2 && y1 < y2)//верх
            {
                y1 = move.MoveUp(a, b, y1, y2, x1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
            else if (x1 > x2 && y1 == y2)//лево
            {
                x1 = move.MoveLeft(a, b, x1, x2, y1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
            else //право
            {
                x1 = move.MoveRight(a, b, x1, x2, y1);
                if (x1 == x2 && y1 == y2)
                    Console.WriteLine(move.counter);
            }
        }

        class Move
        {
            public int counter = 0;
            public int MoveUp(int a, int b, int y1, int y2, int x1)
            {
                int numY1 = y1;
                for (int i = 0; i < y2 - numY1; i++)
                {
                    if ((Math.Abs((x1 + y1)) % (2 * a)) == 0 || (Math.Abs((x1 - y1)) % (2 * b)) == 0)
                        counter++;
                    y1++;
                }
                return y1;
            }
            public int MoveDown(int a, int b, int y1, int y2, int x1)
            {
                int numY1 = y1;
                for (int i = 0; i < numY1 - y2; i++)
                {
                    if ((Math.Abs((x1 + y1)) % (2 * a)) == 0 || (Math.Abs((x1 - y1)) % (2 * b)) == 0)
                        counter++;
                    y1--;
                }
                return y1;
            }
            public int MoveLeft(int a, int b, int x1, int x2, int y1)
            {
                int numX1 = x1;
                for (int i = 0; i < numX1 - x2; i++)
                {
                    if ((Math.Abs((x1 + y1)) % (2 * a)) == 0 || (Math.Abs((x1 - y1)) % (2 * b)) == 0)
                        counter++;
                    x1--;
                }
                return x1;
            }
            public int MoveRight(int a, int b, int x1, int x2, int y1)
            {
                int numX1 = x1;
                for (int i = 0; i < x2 - numX1; i++)
                {
                    if ((Math.Abs((x1 + y1)) % (2 * a)) == 0 || (Math.Abs((x1 - y1)) % (2 * b)) == 0)
                        counter++;
                    x1++;
                }
                return x1;
            }
        }
    }
}


using System;
using System.Linq;
class Oo
{
    internal static void Main(string[] arg)
    {
        int ans = 0;
        int[] a = Array.ConvertAll(arg[1].Split(), int.Parse);
        Func<int[], bool> IsWin = x => x[0] == x.Max() & x.Count(k => k == x.Max()) == 1;
        while(!IsWin(a))
        {
            ans++;
            a[0]++;
            int m = a.Max();
            for (int i = 1; i < a.Length; i++)
            {
                if (a[i] != m) continue;
                a[i]--;
                break;
            }
        }
        Console.WriteLine(ans);
    }
}


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

namespace zadacha2
{
    class Program
    {
        static void Main()
        {
            byte n, answer = 0, bear = 0;
            byte[] a = new byte[0];
            n = Convert.ToByte(Console.ReadLine());
            string[] Data = Console.ReadLine().Split(' ');
            bear = Convert.ToByte(Data[0]);

            for (byte i = 0; i < n - 1; i++ )
            {
                Array.Resize(ref a, a.Length + 1);
                a[i] = Convert.ToByte(Data[i + 1]);
            }
            for (long i = 1; ; i++)
            {
                Array.Sort(a);
                if (a[n - 2] >= bear)
                {
                    a[n - 2]--;
                    bear++;
                    answer++;
                }
                else
                {
                    break;
                }
            }
            Console.WriteLine(answer);
        }
    }
}


using System;
class Test {
    static void Main() {
        int d = int.Parse(Console.ReadLine()) - 10;
        if(d>11){
            Console.WriteLine(0);
        }else{
            int [] n = new int[12]{0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4};
            Console.WriteLine(n[d]);
        }
    }
}


using System;
using System.IO;
class Program
    {
        static void Main(string[] args)
        {
            int n = 0;
            int res = 0;
            using (StreamReader sr = new StreamReader("standard input"))
            {
                n = int.Parse(sr.ReadLine());
            };
            if (n < 20 && n > 10 || n==21) res = 4;
            else
                if (n == 10) res = 0;
                else
                    if (n > 21) res = 0;
                    else
                        if (n==20) res = 15;

            if (File.Exists("standard output")) File.Delete("standard output");
            using (StreamWriter sw = new StreamWriter("standard output"))
            {
                sw.WriteLine(res);
                sw.Flush();
            };

        }
    }


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

namespace ProjectContest
{
    class Test
    {
        static void Main()
        {
            var nm = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            int n = nm[0], m = nm[1];
            var t= Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            List<int> a = new List<int>();
            for(int i = 0; i < t.Length; i++)
            {
                a.Add(t[i]);
                a.Sort((x, y) => y - x);
                if (a.Sum() <= m) Console.Write(0+" ");
                else
                {
                    int sum = a.Sum();
                    int kq = 0;
                    while (true)
                    {
                        sum -= a[kq];
                        kq++;
                        if (sum < m) { Console.Write(kq+" "); break; }
                    }
                }
            }

        }
    }
}


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

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
           // int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            //string[] s = Console.ReadLine().Split(' ');
            //List<int> list = new List<int>();
            string str = "";

            for (int i = 0; i <= s.Length - 1; i++)
            {
                switch (s[i])
                {
                    case '>':
                        {
                            str += "1000";
                            break;
                        }
                    case '<':
                        {
                            str += "1001";
                            break;
                        }
                    case '+':
                        {
                            str += "1010";
                            break;
                        }
                    case '-':
                        {
                            str += "1011";
                            break;
                        }
                    case '.':
                        {
                            str += "1100";
                            break;
                        }
                    case ',':
                        {
                            str += "1101";
                            break;
                        }
                    case '[':
                        {
                            str += "1110";
                            break;
                        }
                    case ']':
                        {
                            str += "1111";
                            break;
                        }
                }
            }
            int _int = Convert.ToInt32(str, 2) % 1000003;

            Console.Write("{0}", _int);
        }
    }
}


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

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

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

            var nn = new int[2*n + 1];
            nn[n] = n;
            int l = n;
            int r = n;

            for (int i = n - 1; i > 0; i--)
            {
                if ((m & 1) == 1)
                {
                    nn[++r] = i;
                }
                else
                {
                    nn[--l] = i;
                }
                m >>= 1;
            }

            for (int i = l; i <= r; i++)
            {
                writer.Write(nn[i]);
                writer.Write(' ');
            }
            writer.Flush();
        }

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


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

namespace CodeForcesPractice
{
    class CF513B2
    {
        private static int n;
        private static int m;

        private static void Execute(string[] args)
        {
            var input = args.Select(s => Int32.Parse(s)).ToList();

            n = input[0];
            m = input[1];

            var permutations = MaxFp(Enumerable.Range(1, n).ToList());

            var result = permutations.Skip(m - 1).First();

            foreach (var i in result)
            {
                Console.Write(i + " ");
            }
        }

        private static IEnumerable<List<int>> MaxFp(List<int> elements)
        {
            if (elements.Count == 1)
            {
                yield return elements;
                yield break;
            }

            int smallest = elements[0];
            var smallestExcluded = FirstExcluded(elements);
            var tail = MaxFp(smallestExcluded).ToList();

            foreach (var p in tail)
            {
                yield return ElementIncluded(p,smallest,0);
            }

            foreach (var p in tail)
            {
                yield return ElementIncluded(p, smallest, p.Count);
            }
        }

        private static List<int> FirstExcluded(List<int> list)
        {
            var smallestExcluded = list.ToList();
            smallestExcluded.RemoveAt(0);
            return smallestExcluded;
        }

        private static List<int> ElementIncluded(List<int> list, int element, int index)
        {
            var result = list.ToList();
            result.Insert(index, element);
            return result;
        }

        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            Execute(input);
        }
    }
}


using System;
using System.Linq;
class Demo{
static void Main(string[] args){
int[] a =args.Cast<int>().ToArray();
Console.WriteLine(Math.Ceiling(a[0] * a[2] / 100D) - a[1]);
}}


using System;

namespace CF610A
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long c = 0;

            for(long i = 1; i <= n/4; i++)
            {
                if (i != (n - 2 * i) / 2) c++;
            }

            Console.WriteLine(c);
        }
    }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string a, b;
            a = Console.ReadLine();
            b = Console.ReadLine();

            StringBuilder str = new StringBuilder(b);
            for (int i = 0; i < str.Length / 2; i++)
            {
                char t = str[i];
                str[i] = str[str.Length - 1 - i];
                str[str.Length - 1 - i] = t;
            }

            b = str.ToString();
            Console.WriteLine(Convert.ToInt32(a) + Convert.ToInt32(b));
        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main()
        {
            int a = Console.Read();

            int b = Console.Read();

            int c = a + b;
            Console.WriteLine(c);
        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main()
        {

            int a, b;
            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine(a + b);
        }
    }
}