using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FINDBESTHOUSE
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] SplitedInfo = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            int AmoutofHouse = SplitedInfo[0];
            int GFLocation = SplitedInfo[1] - 1;
            int YourMoney = SplitedInfo[2];
            int[] Finding = new int[AmoutofHouse];
            for (var j = 0; j < AmoutofHouse; j++)
            {
                int test = SplitedInfo[3 + j];
                if (test == 0)
                {
                    Finding[j] = 0;
                }
                else if (YourMoney > test)
                {
                    Finding[j] = 1;
                }
                else
                {
                    Finding[j] = 0;
                }
            }
            int Checker = 1;
            int get1 = 1, get2 = 1;
            int i = 0;
            do
            {
                i++;
                try
                {
                    if (Finding[GFLocation - i] == 0)
                    {
                        continue;
                    }
                    else if (Finding[GFLocation - i] == 1)
                    {
                        get1 = i;
                        break;
                    }
                    else
                    {
                        get1 = 0;
                    }
                }
                catch
                {
                    get1 = 0;
                    break;
                }
            }
            while (Checker == 1);
            Checker = 1;
            i = 0;
            do
            {
                i++;
                try
                {
                    if (Finding[GFLocation + i] == 0)
                    {
                        continue;
                    }
                    else if (Finding[GFLocation + i] == 1)
                    {
                        get2 = i;
                        break;
                    }
                    else
                    {
                        get2 = 0;
                    }
                }
                catch
                {
                    get2 = 0;
                    break;
                }
            }
            int result = 0;
            while (Checker == 1);
            if (get1 == 0)
            {
                result = get2;
            }
            else if (get2 == 0)
            {
                result = get1;
            }
            else
            {
                result = get1 > get2 ? get2 : get1;
            }
            Console.WriteLine(result * 10);

        }
    }
}


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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            var j = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            int a = j.ElementAt(0);
            int b = j.ElementAt(1);
            int c = j.ElementAt(2);
            int ans = a / 3 + b / 3 + c / 3;
            if ((a > 0) && (b > 0) && (c > 0))
            {
                ans=Math.Max(ans,(a-1)/3+(b-1)/3+(c-1)/3)+1);
            }
            if ((a > 1) && (b > 1) && (c > 1))
            {
                ans=Math.Max(ans,(a-2)/3+(b-2)/3+(c-2)/3)+2);
            }
            Console.WriteLine(ans);

        }
    }
}


static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int i = 2;
            int f = n;
            int c = 1;
            int l = n;

            while (f > 1) {
                f = (n - n % i) / i;
                if (l != f)
                {
                    l = f;
                    c++;
                }
                i++;
            }

            Console.WriteLine(c);
        }


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

namespace ConsoleApp1
{

    class Program
    {
        struct Point
        {
            public int l;
            public int r;
            public Point(int l, int r)
            {
                this.l = l;
                this.r = r;
            }
        }
        static void Main(string[] args)
        {
            long[] n = ((Console.ReadLine().Split(' ')).Select(long.Parse)).ToArray();
            int s = 0;
            int i = 0;
            while (s < n[0])
            {
                i++;
                s += i;
            }
            if (s - n[0] == 1 && n > 2)
                Console.WriteLine(i - 1);
            else
                Console.Write(i);
            Console.ReadLine();
        }
        static string FindSecondMax(List<Point> list)
        {
            Point point = new Point(int.MaxValue, int.MaxValue);
            Point maxpoint = new Point(int.MaxValue, int.MaxValue);
            foreach (Point p in list)
            {
                if (Rast(p) >= Rast(point))
                {
                    maxpoint = point;
                    point = p;
                }
                else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }
            }
            return $"{maxpoint.l} {maxpoint.r}";
        }

        private static int Rast(Point point)
        {
            return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));
        }

        private static long S(long v)
        {
            long sum = 0;
            while (v != 0)
            {
                sum += v % 10;
                v /= 10;
            }
            return sum;
        }
    }
}


using System;

namespace ajaira
{
    class Main
    {
        static bool AllDiff(int n)
        {
            int []ar = new int[10];

            while (n > 0)
            {
                if (ar[n % 10] != 0)
                    return false;
                ar[n % 10]++;
                n /= 10;
            }

            return true;
        }

        static void Main(string[] args)
        {
            int l, r;
            string line = Console.ReadLine();
            string[] inputs = line.Split();
            l = int.Parse(inputs[0]);
            r = int.Parse(inputs[1]);

            for (int i = l; i <= r; i++)
            {
                if (AllDiff(i))
                {
                    Console.WriteLine(i);
                    return;
                }
            }

            Console.WriteLine(-1);
        }
    }
}


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

namespace DistincDigitsA
{
    class Program
    {
        public static bool NumContainsDuplicates(int num)
        {
            var strNum = num.ToString();
            var nums = new HashSet<char>();

            foreach (var cc in strNum)
            {
                if (nums.Contains(cc))
                {
                    return true;
                }
                else
                {
                    nums.Add(cc);
                }
            }

            return false;
        }

        static void Main(string[] args)
        {
            var Ints = Array.ConvertAll(Console.ReadLine().Split(" "), int.Parse);

            for (int atNum = Ints[0]; atNum < Ints[1]; atNum++)
            {
                if (!NumContainsDuplicates(atNum))
                {
                    Console.WriteLine(atNum);
                    Environment.Exit(0);
                }
            }

            Console.WriteLine("-1");
        }
    }
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string maincard = Console.ReadLine();
            string othercards = Console.ReadLine();
            bool yes = false;
            for (int i = 0; i < 14; i++)
            {
                if (othercards[i] == 32)
                {

                }
                else if (i % 3 == 0)
                {
                    if (othercards[i] == maincard[0])
                    {
                        Console.WriteLine("YES");
                        yes = true;
                        break;
                    }

                }
                else if ((i % 3)-1 == 0) {
                    if (true)
                    {
                        if (othercards[i] == maincard[1])
                        {
                            Console.WriteLine("YES");
                            yes = true;
                            break;
                        }
                    }

                }
            }

            if (yes == false)
            {
                Console.WriteLine("NO");
            }
            Console.ReadLine();

        }
    }
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Net.Http;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string maincard = Console.ReadLine();
            string othercards = Console.ReadLine();
            bool yes = false;
            for (int i = 0; i < 14; i++)
            {
                if (othercards[i] == 32)
                {

                }
                else if (i % 3 == 0)
                {
                    if (othercards[i] == maincard[0])
                    {
                        Console.WriteLine("YES");
                        yes = true;
                        break;
                    }

                }
                else if ((i % 3)-1 == 0) {
                    if (true)
                    {
                        if (othercards[i] == maincard[1])
                        {
                            Console.WriteLine("YES");
                            yes = true;
                            break;
                        }
                    }

                }
            }
            if (yes == false)
            {
                Console.WriteLine("NO");
            }
            Console.ReadLine();

        }
    }
}


using System;

namespace CodeForces_1097A_
{
    class Program
    {
        static void Main(string[] args)
        {
            string drop = Console.ReadLine();
            string hand = Console.ReadLine();
            if(hand.Contains(drop[0]) | hand.Contains(drop[1]))
            {
                Console.WriteLine("YES");
            }
            else { Console.WriteLine("NO"); }
        }
    }
}


using System;
    sealed class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var ss = Console.ReadLine();
            Console.WriteLine(ss.Contains(s[0]) || ss.Contains(s[1]) ? "YES" : "NO");
        }
    }


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Net.Http;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string maincard = Console.ReadLine();
            string othercards = Console.ReadLine();
            bool yes = false;
            for (int i = 0; i < 14; i++)
            {
                if (othercards[i] == 32)
                {

                }
                else if (i % 3 == 0)
                {
                    if (othercards[i] == maincard[0])
                    {
                        Console.WriteLine("YES");
                        yes = true;
                        break;
                    }

                }
                else if ((i % 3)-1 == 0) {
                    if (true)
                    {
                        if (othercards[i] == maincard[1])
                        {
                            Console.WriteLine("YES");
                            yes = true;
                            break;
                        }
                    }

                }
            }

            if (yes == false)
            {
                Console.WriteLine("NO");
            }

        }
    }
}


using System;

namespace _200501_GennadyAndACardGame
{
    class Program
    {
        static void Main(string[] args)
        {
            string table = Console.ReadLine();
            string[] hand = Console.ReadLine().Split(' ');

            for (int i = 0; i < hand.Length; i++)
            {

                if (hand[i].Contains(table[0]) || hand[i].Contains(table[1]))
                {
                    Console.WriteLine("YES");
                    return;
                }

            }

            Console.WriteLine("NO");

        }
    }
}


using System;

namespace CF_1097A
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string values = Console.ReadLine();

            int flag = 0;

            for(int i=0; i<input.Length; i++)
            {
                if(values.Contains(input[i]))
                {
                    flag = 1;
                    break;
                }
            }

            if(flag == 1)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{70ADB980-9528-4E57-BA4F-42243ED6D468}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{70ADB980-9528-4E57-BA4F-42243ED6D468}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


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

namespace _1040A
{
    class Program
    {
        static void Main(string[] args)
        {
            IEnumerable<int> container = Console.ReadLine().Split().Select(int.Parse);
            int n = container.ElementAt(0), whiteCost = container.ElementAt(1), blackCost=container.ElementAt(2);
            List<int> colorslist = Console.ReadLine().Split().Select(int.Parse).ToList();
            int minCost = 0;
            if (n == 1 || !colorslist.Contains(2)) Console.WriteLine(0);
            else if (!CheckPalin(colorslist, n)) Console.WriteLine(-1);
            else
            {
                for (int i = 0; i < n / 2; i++)
                {
                    if (colorslist[i] == 1 && colorslist[n - 1] == 2 || colorslist[i] == 2 && colorslist[n - 1] == 1)
                        minCost += blackCost;
                    else if (colorslist[i] == 0 && colorslist[n - 1] == 2 || colorslist[i] == 2 && colorslist[n - 1] == 0)
                        minCost += whiteCost;
                    else
                    {
                        minCost += (Math.Min(whiteCost, blackCost)) * 2;
                    }
                }
                if (n % 2 == 1 && colorslist[n / 2 + 1] == 2) minCost += Math.Min(whiteCost, blackCost);
                Console.WriteLine(minCost);
            }
        }
        public static bool CheckPalin(List<int> colorslist,int n)
        {
            bool answer = true;
            for(int i=0;i<(n/2);i++)
            {
                if(colorslist[i]!=colorslist[n-1] && (colorslist[i]!=2 && colorslist[n-1]!=2))
                {
                    answer = false;
                    break;
                }
            }
            return answer;
        }
    }
}

        }
    }
}


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

namespace ConsoleApp1
{

    class Program
    {
        static void Main(string[] args)
        {
            int[] n = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();
            int [] array = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();
            int sum = 0;
            int prev = -1;
            for (int i = 0; i < n[0]/2; i++)
            {
                if (array[i] != array[n[0] - 1 - i])
                {
                    int s = array[i] + array[n[0] - 1 - i];
                    if (s == 1)
                    {
                        sum = -1;
                        break;
                    }
                    else
                    if (s == 2)
                    {
                      prev = 0;
                        sum += n[1];
                    }
                    else
                    {
                      prev = 1;
                        sum += n[2];
                    }
                }
                else if(array[i] == 2)
                {
                  if(prev == 1) sum += n[1];
                  else if(prev == 0) sum += n[2];
                  else if(n[1] < n2)
                  {
                    prev = 0;
                    sum += n[1];
                  }
                  else{ prev = 1; sum += n[2];}
                }
            }
            if (sum >= 0 && array[n[0] / 2] == 2)
                sum += n[0]%2==0 ?  2*  (int)Math.Min(n[1], n[2]) : (int)Math.Min(n[1], n[2]);
            Console.WriteLine(sum);
            Console.ReadLine();
        }

    }
}


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

namespace PracticeCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int h, m, s, t1, t2;
            string[] str = Console.ReadLine().Split(' ');
            h = int.Parse(str[0]) * 5;
            m = int.Parse(str[1]);
            s = int.Parse(str[2]);
            t1 = int.Parse(str[3]) * 5;
            t2 = int.Parse(str[4]) * 5;

            int t = ((t2 - t1) + 60) % 60;
            int th = ((t2 - h) + 60) % 60;
            int tm = ((t2 - m) + 60) % 60;
            int ts = ((t2 - s) + 60) % 60;

            if ((t <= th && t <= tm && t <= ts) || (t >= th && t >= tm && t >= ts))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Grade
{
    class Program
    {
        /* Driver program to test above functions */
        public static void Main(String[] args)
        {
            var games = int.Parse(Console.ReadLine());

            if (games <= 1)
            {
                Console.WriteLine(true);
                return;
            }

            var queue = new Queue<int>();
            var winning = int.Parse(Console.ReadLine());
            queue.Enqueue(3);
            queue.Enqueue(3 - winning);

            while (--games > 0)
            {
                var challenger = queue.Dequeue();
                var number = int.Parse(Console.ReadLine());
                if (number == challenger)
                {
                    queue.Enqueue(winning);
                    winning = challenger;
                } else if(number == winning) {
                    queue.Enqueue(challenger);
                } else {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");
        }

        static List<int> factorize(int n)
        {
            var res = new List<int>();
            for (int i = 2; i * i <= n; ++i)
            {
                while (n % i != 0)
                {
                    res.Add(i);
                    n /= i;
                }
            }
            return res;
        }

        // 3^10 - x = 3, n = 10, result = 1
        // x = 3*3 = 9, n = 10/2 = 5, result = 1
        // n is now odd, result = 1*9 = 9, x = 9*9 = 81, n = 5/2 = 2
        // x = 81*81 = 6561, n = 2/1 = 1, result = 9
        // n is now odd, result = 9 * 6561 = 59049, x = 6561*6561, n = 0
        // return result aka 59049
        public static double pow(double x, int n) // O(log N)
        {
            double result = 1;
            while (n > 0)
            {
                if (n % 2 == 1) result *= x;
                x *= x;
                n /= 2;
            }
            return result;
        }

        // a = 16, b = 10
        // r = 16%10 = 6, a = 10, b = 6
        // r = 10%6 = 4, a = 6, b = 4
        // r = 6%4 = 2, a = 4, b = 2
        // r = 4%2 = 0, a = 2, b = 0
        // return 0
        public static int gcd(int a, int b) // O(log A+B)
        {
            while (b > 0)
            {
                int r = a % b;
                a = b;
                b = r;
            }
            return a;
        }

        public static double Fib(int n)
        {
            return 1 / Math.Sqrt(5) * (Math.Pow(((1 + Math.Sqrt(5)) / 2), n) - Math.Pow(((1 - Math.Sqrt(5)) / 2), n));
        }

        public static bool isPrime(int n) // O(log N)
        {
            for (int i = 2; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

    }

}


using System;
 public class Program
    {
        public static void Main(string[] args)
        {
            int[] aClassCounter, bClassCounter;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { '\r', '\n', ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                aClassCounter = new int[6];
                bClassCounter = new int[6];
                for(int i = 1, j = int.Parse(input[0])+1; j<input.Length; ++i, ++j)
                {
                    aClassCounter[int.Parse(input[i])]++;
                    bClassCounter[int.Parse(input[j])]++;
                }
            }
            for(int i = 1; i<6; ++i)
            {
                if (aClassCounter[i] == bClassCounter[i])
                    continue;
                if(aClassCounter[i]>bClassCounter[i])
                {
                    if ((aClassCounter[i] - bClassCounter[i]) % 2 == 0)
                        aClassCounter[0] += (aClassCounter[i] - bClassCounter[i]) / 2;
                    else { aClassCounter[0]=-1; break; }
                }
                else
                {
                    if ((bClassCounter[i] - aClassCounter[i]) % 2 ==1)
                    { aClassCounter[0] = -1; break;}
                }
            }
            Console.WriteLine(aClassCounter[0]);
        }


public static int[] RemoveDuplicates(int size, int[] inputArr)
        {
            Dictionary<int,int> dict = new Dictionary<int,int>();
            HashSet<int> hsh = new HashSet<int>();
            List<int> outputList = new List<int>();
            for(int i=0;i<size;i++)
            {
                int currNum = inputArr[i];
                if(dict.ContainsKey(currNum))
                {
                    int prevPos = dict[currNum];
                    hsh.Add(prevPos);
                }
                dict[currNum] = i;
            }
            for(int i=0;i<size;i++)
            {
                if(!hsh.Contains(i))
                    outputList.Add(inputArr[i]);
            }
            return outputList.ToArray();
        }


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

namespace Practice
{
    public class Program
    {
        public static void Main()
        {
            A978();
            //Console.ReadKey();
        }

        public static void A978()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            Boolean[] seen = new Boolean[1001];
            Stack<int> stack = new Stack<int>();

            String[] num = Console.ReadLine().Split();
            for(int i = n-1; i>=0 ; i--)
            {
                int x = int.Parse(num[i]);
                if(!seen[x])
                {
                    stack.Push(x);
                    seen[x] = true;
                }
            }

            StringBuilder output = new StringBuilder();
            output.Append(stack.Count + "\n");

            while (stack.Count != 0)
            {
                output.Append(stack.Pop() + " ");
            }

            Console.WriteLine(output.ToString());

        }
    }

}


#include<bits/stdc++.h>
using namespace std;

int main() {
    cin.sync_with_stdio(false);
    int n, num[N];
    while (cin >> n) {
        for (int i = 0; i < n; i++) {
            cin >> num[i];
        }
        if (num[0] % 2 == 1 && num[n - 1] % 2 == 1 && n % 2 == 1) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }
    return 0;
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{05C93F62-5FEB-405E-A6A6-8DA166CFDD88}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Игрушечные_армии</RootNamespace>
    <AssemblyName>Игрушечные армии</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


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

namespace soldier_games
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //int max = 0;
            //int killed = 0;
            //int i, j, k = 0;

            //for (i = 1; i <= n/2; i++)
            //{
            //    killed += i;
            //    for (j = 1; j <= n - i; j++)
            //    {
            //        killed += j;
            //        for (k = 1; k <= n - j && k <= n - i; k++)
            //        {

            //            killed += k;
            //            if (killed > max)
            //            {
            //                max = killed;
            //            }
            //            killed -= k;
            //        }
            //        killed -= j;
            //    }
            //    killed -= i;
            }
            Console.WriteLine(n/2*3);
        }
    }
}
//        static int getmax(int n)
//        {
//            int max = 0;
//            int killed = 0;
//            int i, j, k = 0;

//            for ( i = 1; i <=n; i++)
//            {
//                killed += i;
//                for ( j = 1; j <= n - i ; j++)
//                {
//                    killed +=  j;
//                    for ( k = 1; k <= n - j &&k<=n-i ; k++)
//                    {

//                        killed += k;
//                        if (killed > max)
//                        {
//                            max = killed;
//                        }
//                        killed -= k;
//                    }
//                    killed -= j;
//                }
//                killed -=i ;
//            }
//            return max;
//        }

//    }
//}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();         // boje papira na nakitu
            int br = 0;
            int brr = 0;
            string sm = string.Format("{0:00}", s.Substring(s.Length - 2));
            string sh = string.Format("{0:00}", s.Substring(0,2));

            for (int i = Int32.Parse(sh, NumberStyles.Any); i < 24; i++)
            {

                brr++;
                if (brr > 1)
                    sm = "00";

                var h = string.Format("{0:00}", i);
                for (int j = Int32.Parse(sm, NumberStyles.Any); j < 60; j++)
                {
                    var m = string.Format("{0:00}", j);
                    char[] arr = h.ToCharArray();
                    char[] arr1 = m.ToCharArray();
                    Array.Reverse(arr);
                    br++;
                    string s0 = new string(arr);
                    string s1 = new string(arr1);
                    if (i == 23)
                    {
                     i= -1;
                    }
                    if (s0 == s1)
                    {
                        Console.WriteLine(br-1);
                        goto Foo;
                    }

                }
            }

            Foo:

        }
    }

}


class Program
    {

        private static Dictionary<char, Action<Coord>> Dick = new Dictionary<char, Action<Coord>>
        {
            { 'U',U },
            { 'D',D },
            { 'L',L },
            { 'R',R },
        };

        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var coord = new Coord(0, 0);

            for (int i = 0; i < input.Length; i++)
            {
                Dick.TryGetValue(input[i], out Action<Coord> action);

                action.Invoke(coord);
            }

            Console.WriteLine(coord.GetModeul());
        }

        private static void U(Coord cord)
        {
            cord.y += 1;
        }
        private static void D(Coord cord)
        {
            cord.y -= 1;
        }
        private static void L(Coord cord)
        {
            cord.x -= 1;
        }
        private static void R(Coord cord)
        {
            cord.x += 1;
        }

        public class Coord
        {
            public int x { get; set; }
            public int y { get; set; }

            public Coord(int x, int y)
            {
                this.x = x;
                this.y = y;
            }
public int GetModeul()
            {
                return Math.Abs(x + y);
            }
        }

    }


using System;
using System.Collections.Generic;
class Program
    {

        private static Dictionary<char, Action<Coord>> Dick = new Dictionary<char, Action<Coord>>
        {
            { 'U',U },
            { 'D',D },
            { 'L',L },
            { 'R',R },
        };

        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var coord = new Coord(0, 0);

            for (int i = 0; i < input.Length; i++)
            {
                Dick.TryGetValue(input[i], out Action<Coord> action);

                action.Invoke(coord);
            }

            Console.WriteLine(coord.GetModeul());
        }

        private static void U(Coord cord)
        {
            cord.y += 1;
        }
        private static void D(Coord cord)
        {
            cord.y -= 1;
        }
        private static void L(Coord cord)
        {
            cord.x -= 1;
        }
        private static void R(Coord cord)
        {
            cord.x += 1;
        }

        public class Coord
        {
            public int x { get; set; }
            public int y { get; set; }

            public Coord(int x, int y)
            {
                this.x = x;
                this.y = y;
            }
public int GetModeul()
            {
                return Math.Abs(x + y);
            }
        }

    }


using System;
using System.Collections.Generic;
class Program
    {

        private static Dictionary<char, Action<Coord>> Dick = new Dictionary<char, Action<Coord>>
        {
            { 'U',U },
            { 'D',D },
            { 'L',L },
            { 'R',R },
        };

        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var coord = new Coord(0, 0);

            for (int i = 0; i < input.Length; i++)
            {
                Dick.TryGetValue(input[i], out Action<Coord> action);

                action.Invoke(coord);
            }

            Console.WriteLine(coord.GetModeul());
        }

        private static void U(Coord cord)
        {
            cord.y += 1;
        }
        private static void D(Coord cord)
        {
            cord.y -= 1;
        }
        private static void L(Coord cord)
        {
            cord.x -= 1;
        }
        private static void R(Coord cord)
        {
            cord.x += 1;
        }

        class Coord
        {
            public int x { get; set; }
            public int y { get; set; }

            public Coord(int x, int y)
            {
                this.x = x;
                this.y = y;
            }
public int GetModeul()
            {
                return Math.Abs(x + y);
            }
        }

    }


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <ctime>
#include <cmath>
#include <set>

using namespace std;

#define SZ(x) (int) (x).size()

const int INF = (int) 1e9;

int ans = INF;
int n, xs, ys;
bool used[30];
int x[30], y[30];
int dp[(1 << 25)], t[30];
pair <int, int> parent[(1 << 25)];

int dist(int _x1, int _y1, int _x2, int _y2)
{
	return (_x1 - _x2) * (_x1 - _x2) + (_y1 - _y2) * (_y1 - _y2);
}

int solve(int mask, int len)
{

	if (len == n)
		return 0;
	if (dp[mask] != -1)
		return dp[mask];
	dp[mask] = INF;
	for (int i = 0; i < n; ++i)
		if ((mask | t[i]) != mask)
		{
			int cur = solve(mask | t[i], len + 1) + 2 * dist(xs, ys, x[i], y[i]);
			if (dp[mask] > cur)
			{
				dp[mask] = cur;
				parent[mask].first = i;
				parent[mask].second = i;
			}

			for (int j = i + 1; j < n; ++j)
				if ((mask | t[j]) != mask)
				{
					int d = dist(xs, ys, x[i], y[i]) + dist(x[i], y[i], x[j], y[j]) + dist(xs, ys, x[j], y[j]);
					int cur = solve(mask | t[i] | t[j], len + 2) + d;
					if (dp[mask] > cur)
					{
						dp[mask] = cur;
						parent[mask].first = i;
						parent[mask].second = j;
					}
				}
			break;
		}
	return dp[mask];
}

int main()
{
	scanf("%d%d%d", &xs, &ys, &n);
	for (int i = 0; i < n; ++i)
		scanf("%d%d", &x[i], &y[i]);
	t[0] = 1;
	for (int i = 1; i < 30; ++i)
		t[i] = t[i - 1] * 2;
	memset(dp, -1, sizeof(dp));
	cout << solve(0, 0) << endl;
	int mask = 0;
	int len = 0;
	while (len < n)
	{
		int i = parent[mask].first + 1;
		int j = parent[mask].second + 1;
		len++;
		printf("0 %d ", i);
		if (i != j)
		{
			len++;
			printf("%d ", j);
		}
		mask = (mask | t[i - 1] | t[j - 1]);
	}

	return 0;
}


using System;

namespace Codeforces_Round_476
{
    class Program
    {
        static void Main(string[] args)
        {
            int k, n, s, p;
            var varsArr = Console.ReadLine().Split(" ");
            k = int.Parse(varsArr[0]);
            n = int.Parse(varsArr[1]);
            s = int.Parse(varsArr[2]);
            p = int.Parse(varsArr[3]);
            //Console.WriteLine("{0} {1} {2} {3}", k, n, s, p);
            var listsNeeded = ListsNeeded(k, n, s);
            var packsNeeded = PacksNeeded(listsNeeded, p);
            Console.WriteLine(packsNeeded);
        }

        static int ListsNeeded(int k, int n, int s)
        {
            var oneManNeedLists = n / s + (n % s != 0 ? 1 : 0);
            var allMensNeedLists = oneManNeedLists * k;
            return allMensNeedLists;
        }

        static int PacksNeeded(int listsNeeded, int p)
        {
            var packsNeeded = listsNeeded / p;
            if (listsNeeded % p != 0) packsNeeded++;
            return packsNeeded;
        }
    }
}


using System;

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(" ");
            foreach(string i in input)
            {
                Console.WriteLine(i);
            }
            int numPeople = Convert.ToInt32(input[0]);
            int airplanesPerPerson = Convert.ToInt32(input[1]);
            int airplanesFromSheet = Convert.ToInt32(input[2]);
            int sheetsInPack = Convert.ToInt32(input[3]);

            int sheets;
            if(airplanesPerPerson % airplanesFromSheet == 0)
            {
                sheets = airplanesPerPerson / airplanesFromSheet;
            }
            else
            {
                sheets = airplanesPerPerson / airplanesFromSheet + 1;
            }

            sheets *= numPeople;

            if (sheets % sheetsInPack == 0)
            {
                Console.WriteLine(sheets / sheetsInPack);
            }
            else
            {
                Console.WriteLine(sheets / sheetsInPack + 1);
            }
        }
    }
}


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

            var k = rl;
            var n = rl;
            var s = rl;
            var p = rl;

            var X = (n + s - 1) / s;
            var Y = (X * k + p - 1) / p;
            Console.WriteLine (Y);
        }
        const long INF = 1L << 60;
        //static int[] dx = { -1, 0, 1, 0 };
        //static int[] dy = { 0, 1, 0, -1 };

        int ri { get { return sc.Integer (); } }
        long rl { get { return sc.Long (); } }
        double rd { get { return sc.Double (); } }
        string rs { get { return sc.Scan (); } }
        public IO.StreamScanner sc = new IO.StreamScanner (Console.OpenStandardInput ());

        static T[] Enumerate<T> (int n, Func<int, T> f) {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f (i);
            return a;
        }
        static public void Swap<T> (ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}
#region main
static class Ex {
    static public string AsString (this IEnumerable<char> ie) { return new string (ie.ToArray ()); }
    static public string AsJoinedString<T> (this IEnumerable<T> ie, string st = " ") {
        return string.Join (st, ie);
    }
    static public void Main () {
        Console.SetOut (new Program.IO.Printer (Console.OpenStandardOutput ()) { AutoFlush = false });
        var solver = new Program.Solver ();
        try {
            solver.Solve ();
            Console.Out.Flush ();
        } catch { }
    }
}
#endregion
#region Ex


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

namespace Runner
{
    class Program
    {
        static void Main(string[] args)
        {
            //AVLTree<int> avlTree = new AVLTree<int>(97,
            //    new AVLTree<int>(49,
            //        new AVLTree<int>(37),
            //        new AVLTree<int>(81)),
            //    new AVLTree<int>(917));

            //avlTree.Traverse();

            string[] firstLineArgs = Console.ReadLine().Split(new char[] { ' ' });
            string[] secondLineArgs = Console.ReadLine().Split(new char[] { ' ' });
            string[] thirdLineArgs = Console.ReadLine().Split(new char[] { ' ' });

            int w = int.Parse(firstLineArgs[0]);
            int h = int.Parse(firstLineArgs[1]);

            int u1 = int.Parse(secondLineArgs[0]);
            int d1 = int.Parse(secondLineArgs[1]);

            int u2 = int.Parse(thirdLineArgs[0]);
            int d2 = int.Parse(thirdLineArgs[1]);

            if (d1 == d2)
            {
                throw new Exception();
            }

            Console.WriteLine(PushSnowball(w, h, u1, d1, u2, d2));

        }

        public static int PushSnowball(int w, int h, int u1, int d1, int u2, int d2)
        {
            int snowballSize = w;

            for (int i = h; i > 0; i--)
            {
                snowballSize += i;

                if (i == d1)
                {
                    snowballSize -= u1;
                }
                else if (i == d2)
                {
                    snowballSize -= u2;
                }

                if (snowballSize < 0)
                {
                    snowballSize = 0;
                }
            }

            return snowballSize;
        }
    }
}


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)

            long 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;
        }
    }
}


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;

// C# 7.2
public static class UpdateExtension {
    public static bool UpdateMin<T>(this ref T x, T newValue) where T : struct, IComparable<T> {
        if (x.CompareTo(newValue) > 0) { x = newValue; return true; }
        return false;
    }
    public static bool UpdateMax<T>(this ref T x, T newValue) where T : struct, IComparable<T> {
        if (x.CompareTo(newValue) < 0) { x = newValue; return true; }
        return false;
    }
}

internal partial class Solver {
    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 dp = new long[k + 1, n + 1]; // (changeNum, occurrence of c1)
            Fill(dp, -(1 << 50));
            dp[0, 0] = 0;
            foreach (var c in s) {
                var next = new long[k + 1, n + 1];
                Fill(next, -(1 << 50));
                next[0, 0] = 0;
                for (int i = 0; i <= k; i++) {
                    for (int j = 0; j <= n; j++) {
                        next[i, j].UpdateMax(dp[i, j]);
                        if (j - 1 >= 0) {
                            if (c == c1) {
                                next[i, j].UpdateMax(dp[i, j - 1]);
                            } else if (i - 1 >= 0) {
                                next[i, j].UpdateMax(dp[i - 1, j - 1]);
                            }
                        }
                        if (c == c2) {
                            next[i, j].UpdateMax(dp[i, j] + j);
                        } else if (i - 1 >= 0) {
                            next[i, j].UpdateMax(dp[i - 1, j] + j);
                        }
                    }
                }
                dp = next;
            }
            ans = dp.Cast<long>().Max();
        }
        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;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Numerics;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Diagnostics;
using static System.Math;
using static System.Array;
using static AtCoder.Cout;
using static AtCoder.Tool;
using static AtCoder.ModInt;
namespace AtCoder
{
    class AC
    {
        const int MOD = 1000000007;
        //const int MOD = 998244353;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 3;
        const double EPS = 1e-8;
        static readonly int[] dI = { 0, 1, 0, -1, 1, -1, -1, 1 };
        static readonly int[] dJ = { 1, 0, -1, 0, 1, 1, -1, -1 };
        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw);

            var th = new Thread(Run, 1 << 26);
            th.Start();
            th.Join();

            //Run();
            Console.Out.Flush();
        }
        static void Run()
        {
            int Testcase = 1;
            //Testcase = Cin.Int;
            for (var _ = 0; _ < Testcase; _++) Solve();
        }
        static void Solve()
        {
            int n, k;
            Cin.Scanf(out n, out k);
            var s = Cin.Str.ToCharArray();
            var t = Cin.Str;
            if (t[0] == t[1])
            {
                for(var i = 0; i < n && k > 0; i++)
                {
                    if (s[i] != t[0])
                    {
                        s[i] = t[0];
                        k--;
                    }
                }
                long l = s.Count(x => x == t[0]);
                OutL(l * (l - 1) / 2);
            }
            else
            {
                var dp = new long[n + 1, k + 1, n + 1];
                for (var i = 0; i <= n; i++) for (var j = 0; j <= k; j++) for (var l = 0; l <= n; l++)
                            dp[i, j, l] = -SINF;
                dp[0, 0, 0] = 0;
                for(var i = 0; i < n; i++)
                {
                    for(var j = 0; j <= k; j++)
                    {
                        for(var l = 0; l <= i; l++)
                        {
                            if (s[i] == t[0])
                            {
                                dp[i + 1, j, l + 1] = Max(dp[i + 1, j, l + 1], dp[i, j, l]);
                                if (j + 1 <= k) dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);
                            }
                            else if (s[i] == t[1])
                            {
                                dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l] + l);
                                if (j + 1 <= k) dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);
                            }
                            else
                            {
                                dp[i + 1, j, l] = Max(dp[i + 1, j, l], dp[i, j, l]);
                                if (j + 1 <= k)
                                {
                                    dp[i + 1, j + 1, l + 1] = Max(dp[i + 1, j + 1, l + 1], dp[i, j, l]);
                                    dp[i + 1, j + 1, l] = Max(dp[i + 1, j + 1, l], dp[i, j, l] + l);
                                }
                            }
                        }
                    }
                }
                long ans = 0;
                for(var i = 0; i <= k; i++)
                {
                    for(var j = 0; j <= n; j++)
                    {
                        ans = Max(ans, dp[n, i, j]);
                    }
                }
                OutL(ans);
            }
        }

        public struct Edge
        {
            public int from;

            public int to;
            public long dist;

            public Edge(int t, long c)
            {
                from = -1;
                to = t;
                dist = c;
            }
            public Edge(int f, int t, long c)
            {
                from = f;
                to = t;
                dist = c;
            }
        }
    }
    struct ModInt
    {
        public long value;
        private const int MOD = 1000000007;
        //private const int MOD = 998244353;
        public ModInt(long value) { this.value = value; }
        public static implicit operator ModInt(long a)
        {
            var ret = a % MOD;
            return new ModInt(ret < 0 ? (ret + MOD) : ret);
        }
        public static ModInt operator +(ModInt a, ModInt b) => (a.value + b.value);
        public static ModInt operator -(ModInt a, ModInt b) => (a.value - b.value);
        public static ModInt operator *(ModInt a, ModInt b) => (a.value * b.value);
        public static ModInt operator /(ModInt a, ModInt b) => a * Modpow(b, MOD - 2);

        public static ModInt operator <<(ModInt a, int n) => (a.value << n);
        public static ModInt operator >>(ModInt a, int n) => (a.value >> n);
        public static ModInt operator ++(ModInt a) => a.value + 1;
        public static ModInt operator --(ModInt a) => a.value - 1;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt Modpow(ModInt a, long n)
        {
            if (n < 0) return Modpow(Modpow(a, -n), MOD - 2);
            var k = a;
            ModInt ret = 1;
            while (n > 0)
            {
                if ((n & 1) != 0) ret *= k;
                k *= k;
                n >>= 1;
            }
            return ret;
        }
        private static readonly List<long> Factorials = new List<long>() { 1 };
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt Fac(long n)
        {
            for (var i = Factorials.Count(); i <= n; i++)
            {
                Factorials.Add((Factorials[i - 1] * i) % MOD);
            }
            return Factorials[(int)n];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ModInt nCr(long n, long r)
        {
            if (n < 0 || r < 0) return 0;
            return n < r ? 0 : Fac(n) / (Fac(r) * Fac(n - r));
        }
        public static explicit operator int(ModInt a) => (int)a.value;
    }
    public class Rolling_Hash
    {
        const ulong m30 = (1UL << 30) - 1;
        const ulong m31 = (1UL << 31) - 1;
        const ulong MOD = (1UL << 61) - 1;
        const ulong Pl = (MOD << 1) << 1;
        private uint B;
        private string S;
        ulong[] hash;
        ulong[] pw;

        public Rolling_Hash(string str)
        {
            S = str;
            B = (uint)new Random().Next(1 << 12 + 1, int.MaxValue);
            int L = S.Length;
            hash = new ulong[L + 1];
            pw = new ulong[L + 1];
            hash[0] = 0;
            pw[0] = 1;
            for (var i = 0; i < L; i++)
            {
                hash[i + 1] = CalcMod(Mul(hash[i], B) + S[i]);
                pw[i + 1] = CalcMod(Mul(pw[i], B));
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ulong GetHashValue(int idx) => hash[idx];
        [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment [l,r]
        public ulong Hash_fold(int l, int r) => CalcMod(Pl + hash[r + 1] - Mul(hash[l], pw[r - l + 1]));
        [MethodImpl(MethodImplOptions.AggressiveInlining)]//segment[start,start+len-1]
        public ulong Hash_sub(int start, int len) => CalcMod(Pl + hash[start + len] - Mul(hash[start], pw[len]));
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ulong[] GetHashArray() => hash;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        ulong Mul(ulong a, ulong b)
        {
            ulong au = a >> 31;
            ulong ad = a & m31;
            ulong bu = b >> 31;
            ulong bd = b & m31;
            ulong mid = ad * bu + au * bd;
            ulong midu = mid >> 30;
            ulong midd = mid & m30;
            return au * bu * 2 + midu + (midd << 31) + ad * bd;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        ulong CalcMod(ulong x)
        {
            ulong xu = x >> 61;
            ulong xd = x & MOD;
            ulong res = xu + xd;
            if (res >= MOD) res -= MOD;
            return res;
        }
    }
    public class Priority_Queue<T>
    {
        private List<T> Q;
        private readonly Comparison<T> Func_Compare;
        public Priority_Queue(Comparison<T> comp)
        {
            Func_Compare = comp;
            Q = new List<T>();
        }
        private void PushHeap(List<T> list, T item)
        {
            int n = list.Count();
            list.Add(item);

            while (n != 0)
            {
                int pIndex = (n - 1) / 2;

                if (Func_Compare(list[n], list[pIndex]) < 0)
                {
                    Swap(Q, n, pIndex);
                }
                else { break; }

                n = pIndex;
            }
        }
        private void PopHeap(List<T> list)
        {
            int n = list.Count() - 1;
            list[0] = list[n];
            list.RemoveAt(n);

            int cur = 0;
            int comp;

            while (2 * cur + 1 <= n - 1)
            {
                int c1 = 2 * cur + 1;
                int c2 = 2 * (cur + 1);
                if (c1 == n - 1)
                {
                    comp = c1;
                }
                else
                {

                    comp = Func_Compare(list[c1], list[c2]) < 0 ? c1 : c2;
                }

                if (Func_Compare(list[cur], list[comp]) > 0)
                {
                    Swap(Q, cur, comp);
                }
                else { break; }

                cur = comp;
            }
        }
        private void Swap(List<T> list, int a, int b)
        {
            T keep = list[a];
            list[a] = list[b];
            list[b] = keep;
        }

        public void Enqueue(T value)
        {
            PushHeap(Q, value);
        }

        public T Dequeue()
        {
            T ret = Q[0];
            PopHeap(Q);
            return ret;
        }

        public T Peek()
        {
            return Q[0];
        }

        public int Count()
        {
            return Q.Count();
        }
        public bool Any()
        {
            return Q.Any();
        }
    }
    public class SegmentTree<T>
    {
        //1-indexed type
        int n;
        T[] Tree;
        Func<T, T, T> f;
        T ex;
        int L;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public SegmentTree(int size, Func<T, T, T> fun, T exvalue)
        {
            ex = exvalue;
            f = fun;
            n = 1;
            while (n < size) n <<= 1;
            Tree = new T[n << 1];
            L = (n << 1) - 1;
            for (var i = 0; i <= L; i++) Tree[i] = ex;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public SegmentTree(int size, Func<T, T, T> fun, T exvalue, T[] initial)
        {
            ex = exvalue;
            n = 1; while (n < size) n <<= 1;
            f = fun;
            Tree = new T[n << 1];
            L = (n << 1) - 1;
            for (var i = 0; i <= L; i++) Tree[i] = (n <= i && i <= n + initial.Length - 1) ? initial[i - n] : ex;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Set_All()
        {
            for (var i = n - 1; i >= 1; i--) Tree[i] = f(Tree[i << 1], Tree[(i << 1) | 1]);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Assign(int idx, T nxt) => Tree[idx + n] = nxt;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Update(int idx)
        {
            int now = idx + n;
            while (now > 1)
            {
                now >>= 1;
                Tree[now] = f(Tree[now << 1], Tree[now << 1 | 1]);
            }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Query_Update(int idx, T nxt)
        {
            Assign(idx, nxt); Update(idx);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Query_Update_func(int idx, T y)
        {
            Assign(idx, f(Peek(idx), y)); Update(idx);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public T Query_Fold(int l, int r)
        {
            int L = n + l;
            int R = n + r;
            T vL = ex, vR = ex;
            while (L < R)
            {
                if (L % 2 == 1)
                {
                    vL = f(vL, Tree[L]);
                    L++;
                }
                if (R % 2 == 1)
                {
                    vR = f(Tree[R - 1], vR);
                    R--;
                }
                L >>= 1;
                R >>= 1;
            }
            return f(vL, vR);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public T Peek(int idx) => Tree[idx + n];
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Display(int len)
        {
            for (var i = 0; i < len; i++) Console.Write($"{Tree[i + n]} ");
            Console.WriteLine();
        }
    }
    public class UnionFind
    {
        private int[] parent;
        private int[] rank;
        private int[] size;
        public UnionFind(int n)
        {
            parent = new int[n];
            rank = new int[n];
            size = new int[n];
            for (var i = 0; i < n; i++)
            {
                parent[i] = i;
                rank[i] = 0;
                size[i] = 1;
            }
        }

        public int Root(int x)
        {
            return parent[x] == x ? x : parent[x] = Root(parent[x]);
        }

        public bool SameRoot(int x, int y)
        {
            return Root(x) == Root(y);
        }

        public void Unite(int x, int y)
        {
            x = Root(x);
            y = Root(y);
            if (x == y) { return; }

            if (rank[x] < rank[y])
            {
                parent[x] = y;
                size[y] += size[x];
                size[x] = 0;
            }
            else
            {
                parent[y] = x;
                if (rank[x] == rank[y]) { rank[x]++; }
                size[x] += size[y];
                size[y] = 0;
            }
        }

        public int SizeOf(int x)
        {
            return size[Root(x)];
        }

    }
    static class Cin
    {
        public static string[] ReadSplit => Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
        public static int[] ReadSplitInt => ConvertAll(ReadSplit, int.Parse);
        public static long[] ReadSplitLong => ConvertAll(ReadSplit, long.Parse);
        public static double[] ReadSplit_Double => ConvertAll(ReadSplit, double.Parse);
        public static string Str => Console.ReadLine();
        public static int Int => int.Parse(Console.ReadLine());
        public static long Long => long.Parse(Console.ReadLine());
        public static double Double => double.Parse(Console.ReadLine());
        public static T Conv<T>(string input)
        {
            if (typeof(T).Equals(typeof(ModInt)))
            {
                return (T)(dynamic)(long.Parse(input));
            }
            return (T)Convert.ChangeType(input, typeof(T));
        }
        public static void Scanf<T>(out T a) => a = Conv<T>(Console.ReadLine());
        public static void Scanf<T, U>(out T a, out U b)
        { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); }
        public static void Scanf<T, U, V>(out T a, out U b, out V c)
        { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); }
        public static void Scanf<T, U, V, W>(out T a, out U b, out V c, out W d)
        { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); d = Conv<W>(q[3]); }
        public static void Scanf<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e)
        { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); d = Conv<W>(q[3]); e = Conv<X>(q[4]); }
    }
    static class Cout
    {
        public static void OutL(object s) => Console.WriteLine(s);
        public static void Out_Sep<T>(IEnumerable<T> s) => Console.WriteLine(string.Join(" ", s));
        public static void Out_Sep<T>(IEnumerable<T> s, string sep) => Console.WriteLine(string.Join($"{sep}", s));
        public static void Out_Sep(params object[] s) => Console.WriteLine(string.Join(" ", s));
        public static void Out_One(object s) => Console.Write($"{s} ");
        public static void Out_One(object s, string sep) => Console.Write($"{s}{sep}");
        public static void Endl() => Console.WriteLine();
    }
    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            array = ConvertAll(array, x => initialvalue);
        }
        static public void Swap<T>(ref T a, ref T b)
        {
            T keep = a;
            a = b;
            b = keep;
        }
        static public void Display<T>(T[,] array2d, int n, int m)
        {
            for (var i = 0; i < n; i++)
            {
                for (var j = 0; j < m; j++)
                {
                    Console.Write($"{array2d[i, j]} ");
                }
                Console.WriteLine();
            }
        }
        static public long Gcd(long a, long b)
        {
            if (a == 0 || b == 0) return Max(a, b);
            return a % b == 0 ? b : Gcd(b, a % b);
        }
        static public long LPow(int a, int b) => (long)Pow(a, b);
        static public bool Bit(long x, int dig) => ((1L << dig) & x) != 0;
        static public int Sig(long a) => a == 0 ? 0 : (int)(a / Abs(a));
    }
}


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;
        }
    }
}