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

using static util;
using P = pair<int, int>;

using Binary = System.Func<System.Linq.Expressions.ParameterExpression,
                           System.Linq.Expressions.ParameterExpression,
                           System.Linq.Expressions.BinaryExpression>;
using Unary = System.Func<System.Linq.Expressions.ParameterExpression,
                          System.Linq.Expressions.UnaryExpression>;

class Program {
    static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static Scan sc = new Scan();
    const int M = 1000000007;
    const int M2 = 998244353;
    const long LM = 1L << 60;
    const double eps = 1e-11;
    static void Main(string[] args)
    {
        int n = sc.Int;
        var p = new P[n * 4 + 1];
        var xs = new HashSet<int>();
        var ys = new HashSet<int>();
        for (int i = 0; i < n * 4 + 1; i++)
        {
            p[i] = sc.P;
            xs.Add(p[i].v1);
            ys.Add(p[i].v2);
        }
        foreach (var x1 in xs)
        {
            foreach (var x2 in xs)
            {
                if (x1 >= x2) continue;
                foreach (var y1 in ys)
                {
                    foreach (var y2 in ys)
                    {
                        if (y1 >= y2) continue;
                        var lis = new List<P>();
                        for (int i = 0; i < n * 4 + 1; i++)
                        {
                            if ((p[i].v1 == x1 || p[i].v1 == x2) && y1 <= p[i].v2 && p[i].v2 <= y2 ||
                                (p[i].v2 == y1 || p[i].v2 == y2) && x1 <= p[i].v1 && p[i].v1 <= x2) {
                            }
                            else {
                                lis.Add(p[i]);
                            }
                        }
                        if (lis.Count == 1) {
                            DBG(lis[0]);
                            return;
                        }
                    }
                }
            }
        }

        sw.Flush();
    }

    static void DBG(string a) => Console.WriteLine(a);
    static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a));
    static void DBG(params object[] a) => DBG(string.Join(" ", a));
    static void Prt(string a) => sw.WriteLine(a);
    static void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a));
    static void Prt(params object[] a) => Prt(string.Join(" ", a));
}
class pair<T, U> : IComparable<pair<T, U>> {
    public T v1;
    public U v2;
    public pair() : this(default(T), default(U)) {}
    public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; }
    public int CompareTo(pair<T, U> a) {
        int c = Comparer<T>.Default.Compare(v1, a.v1);
        return c != 0 ? c : Comparer<U>.Default.Compare(v2, a.v2);
    }
    public override string ToString() => v1 + " " + v2;
    public void Deconstruct(out T a, out U b) { a = v1; b = v2; }
    public static bool operator>(pair<T, U> a, pair<T, U> b) => a.CompareTo(b) > 0;
    public static bool operator<(pair<T, U> a, pair<T, U> b) => a.CompareTo(b) < 0;
    public static bool operator>=(pair<T, U> a, pair<T, U> b) => a.CompareTo(b) >= 0;
    public static bool operator<=(pair<T, U> a, pair<T, U> b) => a.CompareTo(b) <= 0;
}
static class util {
    public static pair<T, U> make_pair<T, U>(T v1, U v2) => new pair<T, U>(v1, v2);
    public static T sq<T>(T a) => Operator<T>.Multiply(a, a);
    public static T Max<T>(params T[] a) => a.Max();
    public static T Min<T>(params T[] a) => a.Min();
    public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;
    static readonly int[] dd = { 0, 1, 0, -1 };
    static readonly string dstring = "RDLU";
    public static P[] adjacents(this P p) => adjacents(p.v1, p.v2);
    public static P[] adjacents(this P p, int h, int w) => adjacents(p.v1, p.v2, h, w);
    public static pair<P, char>[] adjacents_with_str(int i, int j)
        => Enumerable.Range(0, dd.Length).Select(k => new pair<P, char>(new P(i + dd[k], j + dd[k ^ 1]), dstring[k])).ToArray();
    public static pair<P, char>[] adjacents_with_str(int i, int j, int h, int w)
        => Enumerable.Range(0, dd.Length).Select(k => new pair<P, char>(new P(i + dd[k], j + dd[k ^ 1]), dstring[k])).Where(p => inside(p.v1.v1, p.v1.v2, h, w)).ToArray();
    public static P[] adjacents(int i, int j)
        => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).ToArray();
    public static P[] adjacents(int i, int j, int h, int w)
        => Enumerable.Range(0, dd.Length).Select(k => new P(i + dd[k], j + dd[k ^ 1])).Where(p => inside(p.v1, p.v2, h, w)).ToArray();
    public static void Assert(bool cond) { if (!cond) throw new Exception(); }
    public static Dictionary<T, int> compress<T>(this IEnumerable<T> a)
        => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);
    public static Dictionary<T, int> compress<T>(params IEnumerable<T>[] a) => compress(a.Aggregate(Enumerable.Union));
    public static void swap<T>(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }
    public static void swap<T>(this IList<T> a, int i, int j) where T : struct { var t = a[i]; a[i] = a[j]; a[j] = t; }
    public static T[] copy<T>(this IList<T> a) {
        var ret = new T[a.Count];
        for (int i = 0; i < a.Count; i++) ret[i] = a[i];
        return ret;
    }
}
static class Operator<T> {
    static readonly ParameterExpression x = Expression.Parameter(typeof(T), "x");
    static readonly ParameterExpression y = Expression.Parameter(typeof(T), "y");
    public static readonly Func<T, T, T> Add = Lambda(Expression.Add);
    public static readonly Func<T, T, T> Subtract = Lambda(Expression.Subtract);
    public static readonly Func<T, T, T> Multiply = Lambda(Expression.Multiply);
    public static readonly Func<T, T, T> Divide = Lambda(Expression.Divide);
    public static readonly Func<T, T> Plus = Lambda(Expression.UnaryPlus);
    public static readonly Func<T, T> Negate = Lambda(Expression.Negate);
    public static Func<T, T, T> Lambda(Binary op) => Expression.Lambda<Func<T, T, T>>(op(x, y), x, y).Compile();
    public static Func<T, T> Lambda(Unary op) => Expression.Lambda<Func<T, T>>(op(x), x).Compile();
}

class Scan {
    StreamReader sr;
    public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }
    public Scan(string path) { sr = new StreamReader(path); }
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public string Str => sr.ReadLine().Trim();
    public pair<T, U> Pair<T, U>() {
        T a; U b;
        Multi(out a, out b);
        return new pair<T, U>(a, b);
    }
    public P P => Pair<int, int>();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();
    public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
                       : eq<T, long>()   ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>()   ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    public void Multi<T>(out T a) => a = cv<T>(Str);
    public void Multi<T, U>(out T a, out U b)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); }
    public void Multi<T, U, V>(out T a, out U b, out V c)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); }
    public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); }
    public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); }
}


using System;
using System.Collections.Generic;
using System.Diagnostics;

internal class Program
{
    private static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var n1 = Math.Abs(n % 10);
        var n2 = Math.Abs((n / 10) % 10);

        if (n >= 0)
        {
            Console.WriteLine(n);
        }
        else
        {
            if (n2 < n1)
            {
                Console.WriteLine(n / 10);
            }
            else
            {
                n /= 100;
                n *= 10;
                n -= n1;
                Console.WriteLine(n);
            }
        }
    }
}


using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class Test
{

	public static void Main()
	{
		int n = Convert.ToInt32(Console.ReadLine());
		int sayac = 0;

		sayac += n / 100;
		n = n % 100;
		sayac += n / 20;
		n = n % 20;
		sayac += n / 10;
		n = n % 10;
		sayac += n / 5;
		n = n % 5;
		sayac += n / 1;

		Console.WriteLine(sayac);
	}
}


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

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

			int[] a = new int[n];
			int i = 0;

			foreach (string s in Console.ReadLine().Split(' '))
			{
				a[i++] = int.Parse(s);
			}

			List<int> numbers = CountAndReturnDifferentOnes(a);

			if (numbers.Count >= 4)
			{
				Console.WriteLine(-1);
				return;
			}

			switch (numbers.Count)
			{
				case 1:
					Console.WriteLine(0);
					break;
				case 2:
					int diff = Math.Abs(numbers[0] - numbers[1]);
					Console.WriteLine(diff % 2 == 0 ? diff / 2 : diff);
					break;
				case 3:
					numbers.Sort();
					int fark = numbers[2] - numbers[0];

					if (fark % 2 == 0)
					{
						if (numbers[0] + (fark / 2) == numbers[1])
						{
							Console.WriteLine(numbers[1] - numbers[0]);
							return;
						}
					}
					Console.WriteLine(-1);
					break;
				default:
					break;
			}
		}

		static List<int> CountAndReturnDifferentOnes(int[] a)
		{
			List<int> numbers = new List<int>();

			foreach (int item in a)
			{
				if (numbers.Contains(item))
				{
					continue;
				}

				numbers.Add(item);

				if (numbers.Count >= 4)
				{
					break;
				}
			}

			return numbers;
		}
	}
}


using System;
using System.Collections.Generic;

namespace ConsoleApplication6
{
    class Program
    {
       static int getN(int n)
        {
            if (n == 0) return 1;
            switch (n % 4)
            {
                case 0: return 6;
                case 1: return 8;
                case 2: return 4;
                case 3: return 2;
            }
            return 0;
        }

        static void Main(string[] args)
        {
           double n = double.Parse(Console.ReadLine());
           Console.Write(getN((int)n));
        }

    }
}


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

namespace CF._3C
{
    class Program
    {
        static void Main(string[] args)
        {
            char[,] board = new char[3, 3];
            int x = 0, o = 0;
            for (int i = 0; i < 3; i++)
            {
                string temp = Console.ReadLine();
                for (int j = 0; j < 3; j++)
                {
                    board[i, j] = temp[j];
                    if (board[i, j] == 'X')
                        x++;
                    else if (board[i, j] == '0')
                        o++;
                }
            }
            if (o > x || x > o + 1)
                Console.WriteLine("illegal");
            else
            {
                string winner;
                winner="";
                bool illegal = false;
                for (int i = 0; i < 3; i++)
                    if ((board[i, 0] == 'X' && board[i, 1] == 'X' && board[i, 2] == 'X') || (board[0, i] == 'X' && board[1, i] == 'X' && board[2, i] == 'X'))
                        winner = "first";
                if ((board[0, 0] == 'X' && board[1, 1] == 'X' && board[2, 2] == 'X') || (board[0, 2] == 'X' && board[1, 1] == 'X' && board[2, 0] == 'X'))
                    winner = "first";
                for (int i = 0; i < 3; i++)
                    if ((board[i, 0] == '0' && board[i, 1] == '0' && board[i, 2] == '0') || (board[0, i] == '0' && board[1, i] == '0' && board[2, i] == '0'))
                    {
                        if (winner.Length != 0)
                            illegal = true;
                        winner = "second";
                    }
                if ((board[0, 0] == '0' && board[1, 1] == '0' && board[2, 2] == '0') || (board[0, 2] == '0' && board[1, 1] == '0' && board[2, 0] == '0'))
                    winner = "second";
                if (illegal)
                    Console.WriteLine("illegal");
                else if (winner.Length == 0)
                {
                    if (x + o == 9)
                        Console.WriteLine("draw");
                    else if (x == o)
                        Console.WriteLine("first");
                    else
                        Console.WriteLine("second");
                }
                else
                {
                    if (winner.Equals("first") && x == o + 1)
                        Console.WriteLine("the first player won");
                    else if (winner.Equals("second") && x == o)
                        Console.WriteLine("the second player won");
                    else
                        Console.WriteLine("illegal");
                }
            }
        }
    }
}


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

namespace Codeforces
{
    class Program : IDisposable
    {
        private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
        private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

        void Solve()
        {
            var n = long.Parse(Console.ReadLine());
            var a = long.Parse(Console.ReadLine());
            var b = long.Parse(Console.ReadLine());
            var c = long.Parse(Console.ReadLine());

            var plasticRes = n/a;
            var plastOst = n - plasticRes*a;

            long glassRes = 0;
            long glassOst = 0;
            //Glass(n, a, b, c, ref glassRes, ref glassOst);

            Glass(plastOst, b, c, ref glassRes, ref glassOst);
            var res1 = plasticRes + glassRes;

            glassRes = 0;
            glassOst = 0;
            Glass(n, b, c, ref glassRes, ref glassOst);
            var res2 = glassRes;
            if (glassOst >= a)
            {
                res2 += (glassOst/a);
            }
            var ans = Math.Max(res1, res2);
            Console.WriteLine(ans);
           // Console.ReadLine();
        }

        void Glass(long n, long b, long c, ref long glassRes, ref long glassOst)
        {
            glassRes = (n / b);
            if(glassRes == 0)
                return;
            var step = b - c;
            glassOst = (n%b)+c*(n/b);//n - (n / b) * b + c * (n / b);
            if(glassOst < b)
                return;
            var diff = (glassOst - b);
            if (diff < step)
            {
                glassRes++;
                //glassOst = 0;
            }

            else
            {
                glassRes += (diff / step)+1;
            }
            glassOst = n - (b - c)*glassRes;
            //glassOst = (glassOst/b)*c; //diff % step;
            //while (glassOst >= b)
            //{
            //    glassOst = (glassOst/b)*c + (glassOst%b);
            //}
        }

        static void Main(string[] args)
        {
            var p = new Program();
            p.Solve();
            p.Dispose();
        }

        #region Helpers

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

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

        private static int[] ReadIntArray()
        {
            return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        #endregion

        public void Dispose()
        {
            textReader.Close();
            textWriter.Close();
        }
    }
}


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

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

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

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

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

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

		static void solution()
		{
			#region SOLUTION
			var n = readInt();
			var s = Console.ReadLine();
			var f = new long[n];
			f[0] = 0;
			for (int i = 0; i < n; i++)
			{
				f[i] = 0;
				for (int j = 0; j < i; j++)
				{
					f[i] += (1 + f[j]);
				}
			}

			var res = 0L;
			for (int i = 0; i < n; i++)
			{
				if (s[i] == 'B')
				{
					res += f[i] + 1;
				}
			}

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

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

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

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

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

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

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

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


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

namespace ReadWriteTemplate
{
    public static class Solver
    {
        private static void SolveCase()
        {
            long n = ReadLong();
            int m = ReadInt();

            const long MOD = 1000000007;

            long[,] a = new long[m, m];
            for (int i = 0; i < m - 1; i++)
            {
                a[i, i + 1] = 1;
            }
            a[m - 1, 0] = 1;
            a[m - 1, m - 1] = 1;

            a = MatrixBinPower(m, a, n, MOD);

            long ans = a[m - 1, m - 1];

            Writer.WriteLine(ans);
        }

        public static long[,] MatrixBinPower(int n, long[,] a, long p, long mod)
        {
            long[,] result = new long[n, n];
            for (int i = 0; i < n; i++)
            {
                result[i, i] = 1;
            }

            while (p > 0)
            {
                if ((p & 1) != 0)
                {
                    result = MatrixMult(n, result, a, mod);
                }

                a = MatrixMult(n, a, a, mod);
                p >>= 1;
            }

            return result;
        }

        public static long[,] MatrixMult(int n, long[,] a, long[,] b, long mod)
        {
            long[,] c = new long[n, n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < n; k++)
                    {
                        c[i, j] = (c[i, j] + a[i, k] * b[k, j]) % mod;
                    }
                }
            }

            return c;
        }

        public static void Solve()
        {
#if DEBUG
            var sw = Stopwatch.StartNew();
#endif

            SolveCase();

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

#if DEBUG
            sw.Stop();
            Console.WriteLine($"{sw.ElapsedMilliseconds} ms");
#endif
        }

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

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

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

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

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

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

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

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

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

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

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

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

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

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

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

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

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

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

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

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

        #endregion
    }
}


using System;

namespace CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var alpha = "abcdefghijklmnopqrstuvwxyz";
            var str = Console.ReadLine();
            var count = 0;
            var prev = 'a';
            foreach (char symbol in str)
            {
                var delta = alpha.IndexOf(symbol) - alpha.IndexOf(prev);
                if (delta < 0)
                    delta = -delta;
                delta = Math.Min(delta, alpha.Length - delta);
                count += (delta < 0 ? alpha.Length + delta : delta);
                prev = symbol;
            }
            Console.WriteLine(count);
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[3];
            string[] str = Console.ReadLine().Split(' ');
            a[0] = Int32.Parse(str[0]);
            a[1] = Int32.Parse(str[1]);
            a[2] = Int32.Parse(str[2]);
            int x = (a[0] + a[1] + a[2]);
            int i = 29;
            int color = 0;
            while (x>0)
            {
                if (color > 2) { color = 0; }
                if (a[color] > 2) { a[color] -= 2; } else { a[color] = 0; }
                x = a[0] + a[1] + a[2];
                i++;
                color++;
            }
            Console.WriteLine(i.ToString());
        }
    }
}


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

namespace _160618
{
    class Program
    {
        static void Main(string[] args)
        {
            string InStr=Console.ReadLine()+" ";
            int n, m;
            n = int.Parse(InStr.Substring(0, InStr.IndexOf(" ")));
            InStr = InStr.Substring(InStr.IndexOf(" ") + 1);
            m = int.Parse(InStr.Substring(0, InStr.IndexOf(" ")));
            string InStr1 = Console.ReadLine() + " ";
            string InStr2 = Console.ReadLine() + " ";
            string OutStr = "";
            int[] in1 = new int[n];
            int[] in2 = new int[m];
            int k = 0;
            for(int i=0;i<n;i++)
            {
                in1[i] = int.Parse(InStr1.Substring(0, InStr1.IndexOf(" ")));
                InStr1 = InStr1.Substring(InStr1.IndexOf(" ") + 1);
            }
            for (int i = 0; i < m; i++)
            {
                in2[i] = int.Parse(InStr2.Substring(0, InStr2.IndexOf(" ")));
                InStr2 = InStr2.Substring(InStr2.IndexOf(" ") + 1);
            }
            for(int i=0;i<n;i++)
            {
                if(in2.Contains(in1[i]))
                {
                    OutStr = OutStr + in1[i].ToString()+" ";
                }
            }
            Console.WriteLine(OutStr);
        }
    }
}


using System;

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

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

            if (m % n == 0)
            {
                m /= n;

                int moves = 0;

                while (m % 2 == 0)
                {
                    m /= 2;
                    moves++;
                }

                while (m % 3 == 0)
                {
                    m /= 3;
                    moves++;
                }

                if (m == 1)
                {
                    Console.WriteLine(moves);
                    return;
                }
            }

            Console.WriteLine(-1);
        }
    }
}


using System;

public class Class2
{
    public static void Main()
    {
        string[] tokens = Console.ReadLine().Split();
        long w = long.Parse(tokens[0]);
        long m = long.Parse(tokens[1]);
        /*
        if (w == 2 || w == 3)
        {
            Console.Write("YES");
            return;
        }
        */

        bool ans = solve(w,m);
        if (ans)
        {
            Console.Write("YES");
        }
        else {
            Console.Write("NO");
        }

    }

    private static bool solve(long w, long m)
    {
        if (m<w) {
            if ((m == 1) || m==(w-1))
            {
                return true;
            }
            else {
                return false;
            }
        }
        //m = (w^k1 + w^k2 .. w^ki) - (w^l1 + w^l2 .. w^li)
        long rem = m % w;//rem = 1,0,-1 only
        if (rem == 0) {
            return solve(w, m/w);
        }
        else if (rem == 1) {
            return solve(w, ((m-1)/w));
        }
        else if (rem == (w - 1)) {
            return solve(w, ((m + 1) / w));
        }
        else {
            return false;
        }

    }
}


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

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

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }
            long x = Next(), y = Next();
            double ans;
            if (k == n + 1)
            {
                int min = nn.Min();
                int max = nn.Max();
                ans = max - min + Math.Min(Math.Sqrt((x - min)*(x - min) + y*y), Math.Sqrt((x - max)*(x - max) + y*y));
            }
            else
            {
                int xx = nn[k - 1];

                ans = GM(nn, x, y, xx);
                for (int i = 0; i < nn.Length; i++)
                {
                    nn[i] = - nn[i];
                }
                x = - x;
                xx = - xx;
                ans = Math.Min(ans, GM(nn, x, y, xx));

                Array.Sort(nn);
                int min = nn[0];
                int max = nn[n - 1];
                for (int i = 0; i < n; i++)
                {
                    if (xx > nn[i])
                    {
                        ans = Math.Min(ans, nn[i] - min + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)
                                            + Math.Sqrt((x - nn[i + 1])*(x - nn[i + 1]) + y*y)
                                            + max - nn[i + 1] + max - xx);
                        ans = Math.Min(ans, nn[i] - min + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)
                                            + Math.Sqrt((x - max)*(x - max) + y*y)
                                            + max - nn[i + 1] + xx - nn[i + 1]);
                    }
                    else if (xx < nn[i])
                    {
                        ans = Math.Min(ans, max - nn[i] + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)
                                            + Math.Sqrt((x - nn[i - 1])*(x - nn[i - 1]) + y*y)
                                            + nn[i - 1] - min + xx - min);
                        ans = Math.Min(ans, max - nn[i] + Math.Sqrt((x - nn[i])*(x - nn[i]) + y*y)
                                            + Math.Sqrt((x - min)*(x - min) + y*y)
                                            + nn[i - 1] - min + nn[i - 1] - xx);
                    }
                }
            }

            writer.WriteLine(ans.ToString("#0.0000000", CultureInfo.InvariantCulture));
            writer.Flush();
        }

        private static double GM(int[] nn, long x, long y, int xx)
        {
            double ans;

            int min = nn.Min();
            int max = nn.Max();

            //  ___/___\
            if (xx == min)
            {
                ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y);
            }
            else
            {
                int mix = nn.Where(e => e < xx).Max();
                ans = max - xx + Math.Sqrt((x - max)*(x - max) + y*y)
                      + Math.Sqrt((x - mix)*(x - mix) + y*y) + mix - min;
            }

            // <- ->\
            if (xx != min)
            {
                ans = Math.Min(ans, xx - min + max - min + Math.Sqrt((x - max)*(x - max) + y*y));
            }

            if (xx < x && xx != max)
            {
                int max1 = nn.Where(e => e < x).Max();
                int max2 = nn.Where(e => e <= x).Max();

                List<int> lmax1 = nn.Where(e => e > max1).ToList();
                if (lmax1.Any())
                {
                    int nmax1 = lmax1.Min();
                    ans = Math.Min(ans, xx - min + max1 - min + Math.Sqrt((x - max1)*(x - max1) + y*y) +
                                        Math.Sqrt((x - nmax1)*(x - nmax1) + y*y) + max - nmax1);

                    if (max1 != max2)
                    {
                        List<int> lmax2 = nn.Where(e => e > max2).ToList();
                        if (lmax2.Any())
                        {
                            int nmax2 = lmax2.Min();
                            ans = Math.Min(ans, xx - min + max2 - min + Math.Sqrt((x - max2)*(x - max2) + y*y) +
                                                Math.Sqrt((x - nmax2)*(x - nmax2) + y*y) + max - nmax2);
                        }
                    }
                }
            }

            return ans;
        }

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


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Point
		{
			public int x;

			public int y;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

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

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static List<long> getLongList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(long.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static long getLong()
		{
			var s = Console.ReadLine();
			return long.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public bool was;
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var t = new List<string>();
			for (var i = 0; i < 8; ++i)
				t.Add(getString());
			var minA = 100;
			var minB = 100;
			for (var i = 0; i < 8; ++i)
				for (var j = 0; j < 8; ++j)
				{
					if (t[i][j] == 'W')
					{
						var can = true;
						for (var z = 0; z < i; ++z)
							if (t[z][j] == 'B')
								can = false;
						if (can)
							minA = Min(minA, i);
					}
					if (t[i][j] == 'B')
					{
						var can = true;
						for (var z = i + 1; z < 8; ++z)
							if (t[z][j] == 'W')
								can = false;
						if (can)
							minB = Min(minB, 7 - i);
					}
				}
			WriteYESNO(minA <= minB, "A", "B");
			Console.ReadLine();
		}
	}
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Globalization;
namespace ConsoleApplication1
{
  class Program
  {

    static double[,] dp;

    static double solve(int w, int b)
    {
      if (dp[w,b] == -1)
      {
        dp[w, b] = (double) w / (w + b);
        if (b > 1)
          dp[w, b] += ((double)b / (w + b)) * ((double)(b - 1) / (w + b - 1)) * ((double)(w) / (w + b - 2)) * solve(w - 1, b - 2);
        if (b > 2)
          dp[w, b] += ((double)b / (w + b)) * ((double)(b - 1) / (w + b - 1)) * ((double)(b - 2) / (w + b - 2)) * solve(w, b - 3);
      }
      return dp[w,b];
    }

    static void Main(string[] args)
    {
      string[] readen = Console.ReadLine().Split(' ');
      int w = int.Parse(readen[0]);
      int b = int.Parse(readen[1]);
      dp = new double[w+1, b+1];
      for (int i = 0; i <= w; i++)
        for (int j = 0; j <= b; j++)
          dp[i, j] = -1;
      for (int i = 0; i <= w; i++)
        dp[i, 0] = 1;
      for (int i = 0; i <= b; i++)
        dp[0, i] = 0;
      Console.WriteLine(solve(w, b).ToString(CultureInfo.InvariantCulture));
    }
  }
}


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

namespace скамейка
{
    class Program
    {
        static void Main(string[] args)
        {
            Int64 n = Convert.ToInt64(Console.ReadLine());
            Int64 c1 = ((n * (n - 1) * (n - 2) * (n - 3) * (n - 4)) / 120);
            Console.WriteLine(c1 * (n * (n - 1) * (n - 2) * (n - 3) * (n - 4)));
        }
    }
}


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

class Program
{
    static void Main(string[] args)
    {
        int n;
        n = int.Parse(Console.ReadLine());
        string s = "";
        string t = Console.ReadLine();
        foreach (char c in t)
        {
            if (c != ' ')
                s += c;
        }
        s = s.Trim('0');
        if (s == "")
        {
            Console.WriteLine(0);
            return;
        }
        string[] ss = s.Split('1');
        ulong res = 1;
        foreach (string i in ss)
        {
            if (i.Length != 0)
                res *= (ulong)(i.Length + 1);
        }
        Console.WriteLine(res);
    }
}


using System;
class a
{
    static void Main()
    {
        Console.ReadLine();
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Array.Sort(a);
        int r, t; r = t = 1;
        for (int i = 1; i < a.Length; i++)
        {
            if(a[i-1] == a[i]) t++;
            else t = 1;
            r = t > r ? t : r;
        }
        Console.WriteLine(r);
    }
}


using System;
using System.Globalization;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime time = DateTime.ParseExact(Console.ReadLine(), "HH:mm", CultureInfo.InvariantCulture);
            Console.WriteLine("{0:0.#} {1:0.#}", (time.Hour % 12) * 30d + 30d * (time.Minute / 60d), time.Minute * 6);
        }
    }
}


#define Online

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

delegate double F(double x);
delegate decimal Fdec(decimal x);

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

        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if FileIO
        StreamReader sr = new StreamReader("forest.in");
        StreamWriter sw = new StreamWriter("forest.out");
        Console.SetIn(sr);
        Console.SetOut(sw);
#endif

        int r1, r2, c1, c2, d1, d2;
        string[] input = ReadArray();
        r1 = int.Parse(input[0]);
        r2 = int.Parse(input[1]);
        input = ReadArray();
        c1 = int.Parse(input[0]);
        c2 = int.Parse(input[1]);
        input = ReadArray();
        d1 = int.Parse(input[0]);
        d2 = int.Parse(input[1]);

        int a11, a21, a12, a22;
        a11 = c1 + d1 - r2;
        if (a11 % 2 == 0)
        {
            a11 /= 2;
        }
        else
        {
            Console.WriteLine(-1);
            return;
        }
        a22 = d1 - a11;
        a21 = c1 - a11;
        a12 = c2 - a22;
        if (a11 == a12 || a11 == a21 || a11 == a22 || a12 == a21 || a12 == a22 || a21 == a22)
        {
            Console.WriteLine(-1);
            return;
        }
        if (a11 > 0 && a11 < 10 && a22 > 0 && a22 < 10 && a21 > 0 && a21 < 10 && a12 > 0 && a12 < 10)
        {
            Console.WriteLine(a11 + " " + a12);
            Console.WriteLine(a21 + " " + a22);
        }
        else
        {
            Console.WriteLine(-1);
        }

#if Online
        Console.ReadLine();
#endif

#if FileIO
        sr.Close();
        sw.Close();
#endif
    }

    static string[] ReadArray()
    {
        return Console.ReadLine().Split(' ');
    }

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

    static decimal Sqrt(decimal x)
    {
        decimal mid;
        decimal right = (x <= 1 ? 1 : x);
        decimal left = 0;
        decimal eps = 0.00000000000000000001m;
        while (right - left > eps)
        {
            mid = left + ((right - left) / 2m);
            if (Math.Sign(mid * mid - x) != Math.Sign(left * left - x))
                right = mid;
            else
                left = mid;
        }
        return (left + right) / 2m;
    }

}

static class ArrayUtils
{
    public static int BinarySearch(int[] a, int val)
    {
        int left = 0;
        int right = a.Length - 1;
        int mid;

        while (left < right)
        {
            mid = left + ((right - left) >> 1);
            if (val <= a[mid])
            {
                right = mid;
            }
            else
            {
                left = mid + 1;
            }
        }

        if (a[left] == val)
            return left;
        else
            return -1;
    }

    public static double Bisection(F f, double left, double right, double eps)
    {
        double mid;
        while (right - left > eps)
        {
            mid = left + ((right - left) / 2d);
            if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                right = mid;
            else
                left = mid;
        }
        return (left + right) / 2d;
    }

    public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
    {
        decimal m1, m2;
        while (r - l > eps)
        {
            m1 = l + (r - l) / 3m;
            m2 = r - (r - l) / 3m;
            if (f(m1) < f(m2))
                if (isMax)
                    l = m1;
                else
                    r = m2;
            else
                if (isMax)
                    r = m2;
                else
                    l = m1;
        }
        return r;
    }

    public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
    {
        double m1, m2;
        while (r - l > eps)
        {
            m1 = l + (r - l) / 3d;
            m2 = r - (r - l) / 3d;
            if (f(m1) < f(m2))
                if (isMax)
                    l = m1;
                else
                    r = m2;
            else
                if (isMax)
                    r = m2;
                else
                    l = m1;
        }
        return r;
    }

    public static void Merge(int[] A, int p, int q, int r, int[] L, int[] R)
    {
        for (int i = p; i <= q; i++)
            L[i] = A[i];
        for (int i = q + 1; i <= r; i++)
            R[i] = A[i];

        for (int k = p, i = p, j = q + 1; k <= r; k++)
        {
            if (i > q)
            {
                for (; k <= r; k++, j++)
                    A[k] = R[j];
                return;
            }
            if (j > r)
            {
                for (; k <= r; k++, i++)
                    A[k] = L[i];
                return;
            }
            if (L[i] <= R[j])
            {
                A[k] = L[i];
                i++;
            }
            else
            {
                A[k] = R[j];
                j++;
            }
        }
    }

    public static void Merge_Sort(int[] A, int p, int r, int[] L, int[] R)
    {
        if (!(p < r)) return;
        int q = p + ((r - p) >> 1);
        Merge_Sort(A, p, q, L, R);
        Merge_Sort(A, q + 1, r, L, R);
        Merge(A, p, q, r, L, R);
    }
}


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

namespace AprilFools
{
    internal class Program
    {
        private const string TestIn = @"..\..\In\Text.in";
        private const string TestOut = @"..\..\In\Text.out";

        private static void Solve()
        {
            var nums = ReadIntArray();
            var n = nums[0];
            var k = nums[1];
            var nk = n - k;
            var nmul = nk;
            var kmul = k;

            // factorial n
            long kf = kmul;
            while (--k > 1)
            {
                kf *= kmul;
                kf = kf%1000000007;
            }

            long nkp = nk;
            while (--nk > 0)
            {
                nkp *= nmul;
                nkp = nkp%1000000007;
            }

            if (kf == 0) kf = 1;
            if (nkp == 0) nkp = 1;
            Console.WriteLine(((nkp * kf) % 1000000007));
        }

        public static string Multiply(string source, int multiplier)
        {
            StringBuilder sb = new StringBuilder(multiplier * source.Length);
            for (int i = 0; i < multiplier; i++)
            {
                sb.Append(source);
            }

            return sb.ToString();
        }

        private static void Main()
        {
            if (Debugger.IsAttached)
            {
                Console.SetIn(new StreamReader(TestIn));
                Console.SetOut(new StreamWriter(TestOut));
            }

            Solve();

            if (Debugger.IsAttached)
            {
                Console.In.Close();
                Console.Out.Close();
                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                //Console.ReadLine();
            }
        }

        #region Reader

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

        private static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static List<int> ReadIntArray()
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();
            return input;
        }

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

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

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        #endregion
    }
}


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

namespace Dima_and_the_equation
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;
            long x;
            string[] hold;
            List<long> result = new List<long>();
            hold = Console.ReadLine().Split(' ');
            a = Int32.Parse(hold[0]);
            b = Int32.Parse(hold[1]);
            c = Int32.Parse(hold[2]);
            for (int i = 1; i < 82; i++)
            {
                x = b *(long) Math.Pow(i, a) + c;
                if (x>0&& x< Math.Pow(10,9))
                    if (sum(x) == i)
                        result.Add(x);
            }
            Console.WriteLine(result.Count);
            foreach (int i in result)
            {
                Console.Write(i + " ");
            }
            Console.ReadLine();
        }
        static int sum(long number)
        {
            string k = number.ToString();
            int sum = 0;
            foreach (char i in k)
            {
                sum += Int32.Parse(i.ToString());
            }
            return sum;
        }
    }
}


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

class C546 {
    class Battle {
        public Queue<int>[] A;
        public int FightCount = 0;
    }

    class BattleResult: Exception {
        public int FightCount, Winner;
        public override string ToString() => $"{FightCount} {Winner}";
    }

    class BattleField: TortoiseHare<Battle> {
        public Battle Seed;

        protected override Battle Clone(Battle state) {
            return new Battle {
                A = new Queue<int>[] {
                    new Queue<int>(state.A[0]),
                    new Queue<int>(state.A[1])
                }
            };
        }

        protected override Battle GetSeed() => Seed;

        protected override bool IsEquivalent(Battle a1, Battle a2) =>
            a1.A[0].SequenceEqual(a2.A[0]) && a1.A[1].SequenceEqual(a2.A[1]);

        protected override void Next(Battle battle) {
            var head = new int[2];
            for (int i = 0; i < 2; ++i)
                if (battle.A[i].Count == 0)
                    throw new BattleResult {
                        FightCount = battle.FightCount,
                        Winner = 2 - i
                    };
                else head[i] = battle.A[i].Dequeue();
            ++battle.FightCount;
            var win = head[0] < head[1] ? 1 : 0;
            battle.A[win].Enqueue(head[1 - win]);
            battle.A[win].Enqueue(head[win]);
        }
    }

    public static void Main() {
        Console.ReadLine();
        var a1 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var a2 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        try {
            new BattleField {
                Seed = new Battle {
                    A = new Queue<int>[2] {
                        new Queue<int>(a1.Skip(1)),
                        new Queue<int>(a2.Skip(1))
                    }
                }
            }.CycleLength();
            Console.WriteLine(-1);
        } catch (BattleResult result) {
            Console.WriteLine(result);
        }
    }

    // Snippet: TortoiseHare
    abstract class TortoiseHare<T> {
        protected abstract T GetSeed();
        protected abstract T Clone(T state);
        protected abstract bool IsEquivalent(T a1, T a2);
        protected abstract void Next(T state);

        public int CycleLength() {
            int n1 = 0, n2 = 1;
            T a1 = Clone(GetSeed()), a2 = Clone(a1);
            Next(a2);
            while (!IsEquivalent(a1, a2)) {
                if (n1 + n1 < n2) {
                    n1 = n2;
                    a1 = Clone(a2);
                }
                ++n2;
                Next(a2);
            }
            return n2 - n1;
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
           string[] token = Console.ReadLine().Split();

           int n = int.Parse(token[0]);
           int a = int.Parse(token[1]);
           int b = int.Parse(token[2]);

           int min = Math.Min(a,b);
           int max = Math.Max(a,b);

           int ans = CountTrailingZero(n);

           int N  = n;

           while(true){
             if( max>N/2 && min<=N/2){
               break;
             }else if(max>N/2&&min>N/2){
               max -= N/2;
               min -= N/2;
             } else{
               N = N/2;
               ans--;
             }
           }

           if(n==N)
            Console.WriteLine("Final!");
           else
            Console.WriteLine(ans);
        }

        static int CountTrailingZero(int x)
        {
            int []lookup = {32, 0, 1, 26, 2, 23,
                            27, 0, 3, 16, 24, 30,
                            28, 11, 0, 13, 4, 7,
                            17, 0, 25, 22, 31, 15,
                            29, 10, 12, 6, 0, 21,
                            14, 9, 5, 20, 8, 19, 18};

            return lookup[(-x & x) % 37];
        }

    }
}


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

namespace CodeForcesApp
{
    class E
    {
        #region Shortcuts
        static string RL() { return Console.ReadLine(); }
        static string[] RSA() { return RL().Split(' '); }
        static int[] RIA() { return Array.ConvertAll<string, int>(RSA(), int.Parse); }
        static int RInt() { return int.Parse(RL()); }
        static long RLong() { return long.Parse(RL()); }
        static double RDouble() { return double.Parse(RL()); }
        static void RInts2(out int p1, out int p2) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; }
        static void RInts3(out int p1, out int p2, out int p3) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; }
        static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }

        static void Swap<T>(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }
        static void Fill<T>(T[] d, T v) { for (int i = 0; i < d.Length; i++) d[i] = v; }
        static void Fill<T>(T[,] d, T v) { for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { d[i, j] = v; } } }
        #endregion

        static void Main(string[] args)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            //SolutionTester tester = new SolutionTester(CodeForcesTask.E);
            //tester.Test();

            Task task = new Task();
            task.Solve();
        }

        public class Task
        {
            public void Solve()
            {
                int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;
                RInts2(out xv, out yv);
                RInts2(out xp, out yp);
                RInts4(out xw1, out yw1, out xw2, out yw2);
                RInts4(out xm1, out ym1, out xm2, out ym2);

                Point v = new Point(xv, yv);
                Point p = new Point(xp, yp);

                Segment view = new Segment(xv, yv, xp, yp);
                Segment wall = new Segment(xw1, yw1, xw2, yw2);
                Segment mirror = new Segment(xm1, ym1, xm2, ym2);

                Point rp = p.Reflect(mirror.ToLine());

                Segment rview = new Segment(xv, yv, rp.x, rp.y);
                Segment rdview = new Segment(rp.x, rp.y, xp, yp);

                Point pt1, pt2;

                if (!view.Intersects(wall, out pt1, out pt2) && !view.Intersects(mirror, out pt1, out pt2))
                {
                    Console.WriteLine("YES");
                    return;
                }

                Point rpm1, rpm2;
                if (rview.Intersects(mirror, out rpm1, out rpm2))
                {
                    Segment s1 = new Segment(v, rpm1);
                    Segment s2 = new Segment(rpm1, p);
                    if (!s1.Intersects(wall, out pt1, out pt2) && !s2.Intersects(wall, out pt1, out pt2))
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }
                Console.WriteLine("NO");
            }
        }

        public class GeometryUtils
        {
            public const double EPS = 10e-12;

            public static double SqrDist(double x1, double y1, double x2, double y2)
            {
                return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
            }

            public static double Dist(double x1, double x2)
            {
                return Math.Abs(x1 - x2);
            }

            public static double Dist(double x1, double y1, double x2, double y2)
            {
                return Math.Sqrt(SqrDist(x1, y1, x2, y2));
            }

            public static double Determinant(
                double a11, double a12,
                double a21, double a22)
            {
                return a11 * a22 - a21 * a12;
            }

            public static double Determinant(
                double a11, double a12, double a13,
                double a21, double a22, double a23,
                double a31, double a32, double a33
                )
            {
                return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);
            }

            public static int Sign(double val)
            {
                if (Math.Abs(val) <= EPS)
                    return 0;

                if (val > EPS)
                    return 1;

                return -1;
            }

        }

        public class Point
        {
            public double x;
            public double y;

            #region Constructors

            public Point()
            {
            }

            public Point(double _x, double _y)
            {
                x = _x;
                y = _y;
            }

            #endregion

            #region Public Methods

            public Vector ToVector()
            {
                return new Vector(x, y);
            }

            public int Orientation(Point q, Point r)
            {
                return Orientation(this, q, r);
            }

            public double Area(Point q, Point r)
            {
                return Area(this, q, r);
            }

            public double SqrDist(Point q)
            {
                return GeometryUtils.SqrDist(x, y, q.x, q.y);
            }

            public double Distance()
            {
                return GeometryUtils.Dist(x, y, 0, 0);
            }

            public double Distance(Point q)
            {
                return GeometryUtils.Dist(x, y, q.x, q.y);
            }

            public double XDist(Point q)
            {
                return GeometryUtils.Dist(x, q.x);
            }

            public double YDist(Point q)
            {
                return GeometryUtils.Dist(y, q.y);
            }

            public Point Translate(double _x, double _y)
            {
                return new Point(x + _x, y + _y);
            }

            public Point Translate(Vector v)
            {
                return new Point(x + v.x, y + v.y);
            }

            // Находит проекцию точки на прямую
            public Point Project(Line line)
            {
                Line ort = new Line(this, line.NormalVector);
                Point pt;
                line.Intersects(ort, out pt);
                return pt;
            }

            public Point Reflect(Line line)
            {
                Point pr = Project(line);
                Vector v = (pr - this).Scale(2);
                return this.Translate(v);
            }

            #endregion

            #region Static Members

            public static Vector operator -(Point p1, Point p2)
            {
                return new Vector(p1.x - p2.x, p1.y - p2.y);
            }

            public static int Orientation(Point p, Point q, Point r)
            {
                double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);
                if (det > 0) return 1;
                if (det < 0) return -1;
                return 0;
            }

            public static double Area(Point p, Point q, Point r)
            {
                return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);
            }

            #endregion
        }

        public class Vector
        {
            public double x;
            public double y;

            public Vector()
            {
            }

            public Vector(double _x, double _y)
            {
                x = _x;
                y = _y;
            }

            public Vector Translate(double a, double b)
            {
                return new Vector(x + a, y + b);
            }

            public Vector Translate(Vector v)
            {
                return new Vector(x + v.x, y + v.y);
            }

            public Vector Scale(double d)
            {
                return new Vector(x * d, y * d);
            }
        }

        public class Segment
        {
            private Point start;
            private Point end;

            #region Constructors

            public Segment()
                : this(new Point(), new Point())
            {
            }

            public Segment(Point s, Point e)
            {
                start = s;
                end = e;
            }

            public Segment(double x1, double y1, double x2, double y2)
                : this(new Point(x1, y1), new Point(x2, y2))
            {
            }

            #endregion

            #region Public Properties

            public Point Start
            {
                get { return start; }
                set { start = value; }
            }

            public Point End
            {
                get { return end; }
                set { end = value; }
            }

            public double x1
            {
                get { return start.x; }
                set { start.x = value; }
            }

            public double y1
            {
                get { return start.y; }
                set { start.y = value; }
            }

            public double x2
            {
                get { return end.x; }
                set { end.x = value; }
            }

            public double y2
            {
                get { return end.y; }
                set { end.y = value; }
            }

            public Vector Direction
            {
                get { return End - Start; }
            }

            #endregion

            #region Public Methods

            public Line ToLine()
            {
                return new Line(this);
            }

            public bool Intersects(Segment seg, out Point p1, out Point p2)
            {
                p1 = new Point();
                p2 = new Point();

                double minx1 = Math.Min(Start.x, End.x);
                double maxx1 = Math.Max(Start.x, End.x);
                double miny1 = Math.Min(Start.y, End.y);
                double maxy1 = Math.Max(Start.y, End.y);

                double minx2 = Math.Min(seg.Start.x, seg.End.x);
                double maxx2 = Math.Max(seg.Start.x, seg.End.x);
                double miny2 = Math.Min(seg.Start.y, seg.End.y);
                double maxy2 = Math.Max(seg.Start.y, seg.End.y);

                if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)
                    return false;  // boundary rectangles not intersected

                Line this_line = this.ToLine();
                Line seg_line = seg.ToLine();

                if (this_line.Parallel(seg_line))
                {
                    if (this_line.Equivalent(seg_line))
                    {
                        p1.x = Math.Max(minx1, minx2);
                        p1.y = Math.Max(miny1, miny2);
                        p2.x = Math.Min(maxx1, maxx2);
                        p2.y = Math.Min(miny1, miny2);
                        return true; // intersection by segment
                    }
                    else
                        return false; // parallel
                }

                Point pt;
                if (!this_line.Intersects(seg_line, out pt))
                    return false;

                if (pt.x >= minx1 && pt.x <= maxx1 &&
                    pt.y >= miny1 && pt.y <= maxy1 &&
                    pt.x >= minx2 && pt.x <= maxx2 &&
                    pt.y >= miny2 && pt.y <= maxy2)
                {
                    p1.x = pt.x;
                    p1.y = pt.y;
                    p2.x = pt.x;
                    p2.y = pt.y;
                    return true; // in one point
                }

                return false;
            }

            public double Distance(Point p)
            {
                Line line = this.ToLine();
                double[] cc = line.Coeffs;
                double A = cc[0];
                double B = cc[1];
                double C = cc[2];

                double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);
                d = Math.Min(d, p.Distance(Start));
                d = Math.Min(d, p.Distance(End));
                return d;
            }

            #endregion

        }

        public class Line
        {
            #region Private Members

            private Point bp;
            private Vector dir;

            #endregion

            #region Constructors

            public Line()
                : this(new Point(), new Vector(1, 0))
            {
            }

            public Line(Point p, Vector v)
            {
                bp = p;
                dir = v;
            }

            public Line(Point p1, Point p2)
                : this(p1, p2 - p1)
            {

            }

            public Line(double x1, double y1, double x2, double y2) :
                this(new Point(x1, y1), new Point(x2, y2))
            {
            }

            public Line(Segment s) :
                this(s.Start, s.Direction)
            {

            }

            #endregion

            #region Public Properties

            public Point BasePoint { get { return bp; } }
            public Vector Direction { get { return dir; } }
            public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }
            public double[] Coeffs
            {
                get
                {
                    return new double[3]
                {
                    dir.y,
                    -dir.x,
                    dir.x * bp.y - dir.y * bp.x
                };
                }
            }

            public double A { get { return dir.y; } }
            public double B { get { return -dir.x; } }
            public double C { get { return dir.x * bp.y - dir.y * bp.x; } }

            #endregion

            #region Public Methods

            public bool Intersects(Line line, out Point pt)
            {
                pt = new Point();

                double d = GeometryUtils.Determinant(A, B, line.A, line.B);
                if (GeometryUtils.Sign(d) == 0)
                    return false;

                pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;
                pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;

                return true;
            }

            public bool Parallel(Line line)
            {
                double d = GeometryUtils.Determinant(A, B, line.A, line.B);
                return GeometryUtils.Sign(d) == 0;
            }

            public bool Equivalent(Line line)
            {
                double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);
                double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);
                double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);

                return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;
            }

            public double Distance(Point p)
            {
                return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);
            }

            #endregion
        }

    }
}


using System;
using System.IO;

namespace CF_R257
{
    public class Task_C
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new StreamReader(@"c_input.txt"));
#endif
            new Task_C().Solve();
        }

        long n;
        long m;
        long k;
        long maxArea;

        private void Solve()
        {
            var parts = Console.ReadLine().Split();
            n = long.Parse(parts[0]);
            m = long.Parse(parts[1]);
            k = long.Parse(parts[2]);

            long nsq = ((int)Math.Sqrt(n) + 1);
            long msq = ((int)Math.Sqrt(n) + 1);
            maxArea = -1;

            for (int i = 1; i <= nsq; i++)
            {
                Test(i, n / i, m);
                Test(n / i, i, m);
            }

            for (int i = 1; i <= msq; i++)
            {
                Test(i, m / i, n);
                Test(m / i, i, n);
            }

            Console.WriteLine(maxArea);
        }

        private void Test(long w1, long count1, long dim2)
        {
            long k1 = count1 - 1;
            long k2 = k - k1;

            if (w1 <= 0 || k1 < 0 || k2 < 0)
                return;

            long w2 = dim2 / (k2 + 1);
            if (w2 <= 0)
                return;

            var area = w1 * w2;
            if (area > maxArea)
            {
                maxArea = area;
            }
        }
    }
}


using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

class cf734
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static void Main()
    {
        var t = NN;
        var res = new List<bool>();
        for (var _ = 0; _ < t; ++_)
        {
            var c = NList;
            if (c[0] == 1) res.Add(c[2] == c[1] / 2);
            else if (c[1] == 1) res.Add(c[2] == 0);
            else
            {
                var lvbs = c[1] / 2;
                var lsqs = (c[0] / 2) * lvbs;
                var min = c[0] % 2 == 0 ? 0 : lvbs;
                var max = min + lsqs * 2;
                res.Add(c[2] >= min && c[2] <= max && (c[2] - min) % 2 == 0);
            }
        }
        WriteLine(string.Join("\n", res.Select(r => r ? "YES" : "NO")));
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Numerics;
using E = System.Linq.Enumerable;

namespace ProbA {
    class Program {
        protected IOHelper io;

        long F(long x) {
            return x * (x + 1) / 2;
        }

        public Program(string inputFile, string outputFile) {
            io = new IOHelper(inputFile, outputFile, Encoding.Default);

            long n = long.Parse(io.NextToken());

            int mid, left = 1, right = 1000000000;
            while(left <= right){
                mid = (left + right) >> 1;
                if(F(mid) >= n) right = mid - 1;
                else left = mid + 1;
            }
            io.WriteLine(n-F(left-1));

            /*
            io.WriteLine(
                (from i in E.Range(0,15000002)
                    let x=n-(long)i*(long)(i+1)/2
                    where x>0
                    select x).Min()
                );*/
            io.Dispose();
        }

        static void Main(string[] args) {
            Program myProgram = new Program(null, null);
        }
    }

    class IOHelper : IDisposable {
        public StreamReader reader;
        public StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding) {
            if (inputFile == null)
                reader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                reader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                writer = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                writer = new StreamWriter(outputFile, false, encoding);

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public bool hasNext() {
            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;
            }

            return curTokenIdx < curLine.Length;
        }

        public string NextToken() {
            return hasNext() ? curLine[curTokenIdx++] : null;
        }

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

        public double NextDouble() {
            string tkn = NextToken();
            return double.Parse(tkn, System.Globalization.CultureInfo.InvariantCulture);
        }

        public void Write(double val, int precision) {
            writer.Write(val.ToString("F" + precision, System.Globalization.CultureInfo.InvariantCulture));
        }

        public void Write(object stringToWrite) {
            writer.Write(stringToWrite);
        }

        public void WriteLine(double val, int precision) {
            writer.WriteLine(val.ToString("F" + precision, System.Globalization.CultureInfo.InvariantCulture));
        }

        public void WriteLine(object stringToWrite) {
            writer.WriteLine(stringToWrite);
        }

        public void Dispose() {
            try {
                if (reader != null) {
                    reader.Dispose();
                }
                if (writer != null) {
                    writer.Flush();
                    writer.Dispose();
                }
            } catch { };
        }

        public void Flush() {
            if (writer != null) {
                writer.Flush();
            }
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] t1 = Console.ReadLine().Split();
            int n = int.Parse(t1[0]); // КОЛЛИЧЕСТВО ПАПОК
            int m = int.Parse(t1[1]); // ПАПОК ПО ГОРИЗОНТАЛИ
            int a = int.Parse(t1[2]); // ОТ А
            int b = int.Parse(t1[3]); // ДО Б

            int kstrok = n / m + 1; // koll strok

            int[] array = new int[kstrok + 1];
            for (int i = 2; i < kstrok + 1; i++) //massiv zapominaet nachalo strok
                array[i] = m * i - m + 1;

            array[1] = 1;

            int[] myarray = new int[kstrok + 1];
            for (int i = 1; i < kstrok + 1; i++) //massiv zapominaet konez strok
                myarray[i] = m * i;

            int strokaa = 1;
            int strokab = 1;

            for (int i = 1; i < kstrok + 1; i++)
                if (a > myarray[i])
                    strokaa = strokaa + 1; //наход строки а

            for (int i = 1; i < kstrok + 1; i++)
                if (b > myarray[i])//наход строки б
                    strokab = strokab + 1;

            int proverkaa1 = 0;
            int proverkab1 = 0;

            for (int i = 1; i < kstrok; i++)
                if (a == array[i]) //esli a v nachale stroki
                    proverkaa1 = proverkaa1 + 1;

            for (int i = 1; i < kstrok; i++)
                if (b == myarray[i])// esli b v konze stroki
                    proverkab1 = proverkab1 + 1;

            if (proverkaa1 + proverkab1 == 2)
                Console.WriteLine(1);

            int o = 0;
                if (strokaa == strokab && proverkaa1 + proverkab1 != 2)
                {
                    Console.WriteLine(1); // esli v odnoi stroke a i b
                    o = 1;
                }

            int proverkaa2 = 0; //Нашлась ли а не по кроям строки?
            int proverkab2 = 0; //Нашлась ли б не по кроям строки?

            for (int i = 1; i < kstrok + 1; i++)
                if (a > array[i] && a <= myarray[i])
                    proverkaa2 = proverkaa2 + 1; //Нашлась ли а не по кроям строки?

            for (int i = 1; i < kstrok + 1; i++)
                if (b >= array[i] && b < myarray[i])
                    proverkab2 = proverkab2 + 1; //Нашлась ли а не по кроям строки?
            int q = 0;
            if (o == 0)
            {
                if (proverkaa2 + proverkab2 == 2 && strokaa + 1 < strokab)
                    if ((a - 1) % m == b % m)
                    {
                        Console.WriteLine(2);
                        q = 1;
                    }

                if (proverkaa2 + proverkab2 == 2 && strokaa + 1 < strokab)
                    if (b != n && q != 1)
                    Console.WriteLine(3); //если а и б находятся не по краям и расстояние > m
                    else if (q != 1)
                    Console.WriteLine(2);

                if (proverkaa2 + proverkab2 == 2 && strokaa + 1 == strokab)
                    Console.WriteLine(2); //если а и б находятся не по краям и расстояние <= m

                if (proverkaa1 + proverkab2 == 2)
                    if (b != n)
                    Console.WriteLine(2); //если а с краю, а б нет
                    else Console.WriteLine(1);

                if (proverkaa2 + proverkab1 == 2)
                Console.WriteLine(2); //если б с краю, а а неt
            }
        }
    }
}


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

using E = System.Linq.Enumerable;
using System.Threading;

internal partial class Solver {

    public static bool UpdateMin<T>(ref T x, T newValue) where T : IComparable<T> {
        if (x.CompareTo(newValue) > 0) { x = newValue; return true; }
        return false;
    }
    public static bool UpdateMax<T>(ref T x, T newValue) where T : IComparable<T> {
        if (x.CompareTo(newValue) < 0) { x = newValue; return true; }
        return false;
    }

    public void Run() {
        var n = ni();
        var k = ni();
        var s = ns();
        var t = ns();
        long ans = 0;
        if (t[0] == t[1]) {
            long count = s.Count(c => c == t[0]);
            count += k;
            if (count > s.Length) count = s.Length;
            ans = count * (count - 1) / 2;
        } else {
            var c1 = t[0];
            var c2 = t[1];
            var memo = new long?[s.Length, k + 1, n + 1]; // (changeNum, occurrence of c1)

            Func<int, int, int, long> dfs = null;

            dfs = (int pos, int changeNum, int c1Num) => {
                if (pos == s.Length) return 0;
                ref var ret = ref memo[pos, changeNum, c1Num];
                if (!ret.HasValue) {
                    long val = 0;
                    var c = s[pos];
                    if (c == c1) {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num + 1));
                    } else {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num));
                        if (changeNum < k) {
                            val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num + 1));
                        }
                    }
                    if (c == c2) {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num) + c1Num);
                    } else {
                        if (changeNum < k) {
                            val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num) + c1Num);
                        }
                    }
                    ret = val;
                }
                return ret.Value;
            };
            ans = dfs(0, 0, 0);
        }
        cout.WriteLine(ans);
    }

    public static void Fill<T>(T[,] array, T value) {
        int height = array.GetLength(0);
        int width = array.GetLength(1);
        for (int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++) {
                array[i, j] = value;
            }
        }
    }

}

// PREWRITEN CODE BEGINS FROM HERE

static public class StringExtensions {
    static public string JoinToString<T>(this IEnumerable<T> source, string separator = " ") {
        return string.Join(separator, source);
    }
}

internal partial class Solver : Scanner {
    static readonly int? StackSizeInMebiByte = null; //50;
    public static void StartAndJoin(Action action, int maxStackSize) {
        var thread = new Thread(new ThreadStart(action), maxStackSize);
        thread.Start();
        thread.Join();
    }

    public static void Main() {
#if LOCAL
        byte[] inputBuffer = new byte[1000000];
        var inputStream = Console.OpenStandardInput(inputBuffer.Length);
        using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {
            Console.SetIn(reader);
            new Solver(Console.In, Console.Out).Run();
        }
#else
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        if (StackSizeInMebiByte.HasValue) {
            StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);
        } else {
            new Solver(Console.In, Console.Out).Run();
        }
        Console.Out.Flush();
#endif
    }

#pragma warning disable IDE0052
    private readonly TextReader cin;
    private readonly TextWriter cout;
    private readonly TextWriter cerr;
#pragma warning restore IDE0052

    public Solver(TextReader reader, TextWriter writer)
        : base(reader) {
        cin = reader;
        cout = writer;
        cerr = Console.Error;
    }

    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer) {
    }

#pragma warning disable IDE1006
#pragma warning disable IDE0051
    private int ni() { return NextInt(); }
    private int[] ni(int n) { return NextIntArray(n); }
    private long nl() { return NextLong(); }
    private long[] nl(int n) { return NextLongArray(n); }
    private double nd() { return NextDouble(); }
    private double[] nd(int n) { return NextDoubleArray(n); }
    private string ns() { return Next(); }
    private string[] ns(int n) { return NextArray(n); }
#pragma warning restore IDE1006
#pragma warning restore IDE0051
}

#if DEBUG
internal static class LinqPadExtension {
    public static string TextDump<T>(this T obj) {
        if (obj is IEnumerable) return (obj as IEnumerable).Cast<object>().JoinToString().Dump();
        else return obj.ToString().Dump();
    }
    public static T Dump<T>(this T obj) {
        return LINQPad.Extensions.Dump(obj);
    }
}
#endif

public class Scanner {
    private readonly TextReader Reader;
    private readonly CultureInfo ci = CultureInfo.InvariantCulture;

    private readonly char[] buffer = new char[2 * 1024];
    private int cursor = 0, length = 0;
    private string Token;
    private readonly StringBuilder sb = new StringBuilder(1024);

    public Scanner()
        : this(Console.In) {
    }

    public Scanner(TextReader reader) {
        Reader = reader;
    }

    public int NextInt() { return checked((int)NextLong()); }
    public long NextLong() {
        var s = Next();
        long r = 0;
        int i = 0;
        bool negative = false;
        if (s[i] == '-') {
            negative = true;
            i++;
        }
        for (; i < s.Length; i++) {
            r = r * 10 + (s[i] - '0');
#if DEBUG
            if (!char.IsDigit(s[i])) throw new FormatException();
#endif
        }
        return negative ? -r : r;
    }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size) {
        string[] array = new string[size];
        for (int i = 0; i < size; i++) {
            array[i] = Next();
        }

        return array;
    }
    public int[] NextIntArray(int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextInt();
        }

        return array;
    }

    public long[] NextLongArray(int size) {
        long[] array = new long[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextLong();
        }

        return array;
    }

    public double[] NextDoubleArray(int size) {
        double[] array = new double[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextDouble();
        }

        return array;
    }

    public string Next() {
        if (Token == null) {
            if (!StockToken()) {
                throw new Exception();
            }
        }
        var token = Token;
        Token = null;
        return token;
    }

    public bool HasNext() {
        if (Token != null) {
            return true;
        }

        return StockToken();
    }

    private bool StockToken() {
        while (true) {
            sb.Clear();
            while (true) {
                if (cursor >= length) {
                    cursor = 0;
                    if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {
                        break;
                    }
                }
                var c = buffer[cursor++];
                if (33 <= c && c <= 126) {
                    sb.Append(c);
                } else {
                    if (sb.Length > 0) break;
                }
            }

            if (sb.Length > 0) {
                Token = sb.ToString();
                return true;
            }

            return false;
        }
    }
}