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

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

        var n = RI();
        var k = RI();

        var c4 = n;
        var c2 = n + n;
        var c1 = 0;

        for (int i = 0; i < k; i++)
        {
            var a = RI();
            if (a % 2 == 1)
            {
                c1++;
                a -= (a & 1);
            }

            c4 -= a / 4;
            c2 -= (a % 4) / 2;
        }

        if (c4 < 0)
        {
            c2 -= Math.Abs(c4) * 2;
            c4 = 0;
        }

        if (c4 > 0)
        {
            c2 += c4;
            c1 -= c4;
            c4 = 0;
        }

        if (c1 > 0 && c2 > 0)
        {
            c1 -= c2;
            c2 = 0;
        }

        if (c2 < 0 && c1 < 0)
        {
            c1 += Math.Abs(c2) * 2;
            c2 = 0;
        }

        Console.WriteLine((c2 < 0 || c1 > 0) ? "NO" : "YES");
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

    private static int GCD(int a, int b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadTree(int n)
    {
        return ReadGraph(n, n - 1);
    }

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

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

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

        return matrix;
    }

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

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

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

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

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

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

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

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

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

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

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

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

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*')));

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

        return s.ToArray();
    }

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

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

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

        return s;
    }

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

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13 && ans != -1);

        return s.ToArray();
    }

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

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

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

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

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

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}


using System;
using System.Linq;
using MoreLinq;
class Program
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var bin = Enumerable.Range(1, 512).Select(i => Convert.ToString(i, 2)).Select(int.Parse).ToArray();
        var index = Array.IndexOf(bin, bin.MinBy(i => n > i));
        if (n == bin[index])
        {
            index++;
        }
        Console.WriteLine(index);
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{D76EAD0F-3DCA-4720-981A-A1CC8B957629}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>Algoritms</RootNamespace>
    <AssemblyName>Algoritms</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</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|AnyCPU' ">
    <PlatformTarget>AnyCPU</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.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>


Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Olimp2.1", "Olimp2.1\Olimp2.1.csproj", "{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|x86 = Debug|x86
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.Debug|x86.ActiveCfg = Debug|x86
		{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.Debug|x86.Build.0 = Debug|x86
		{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.Release|x86.ActiveCfg = Release|x86
		{EAE85B93-D01D-43CC-AA10-F9D36A0CC922}.Release|x86.Build.0 = Release|x86
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Global
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System.Collections.Generic;
using System.Linq;
namespace a988a
{
	class Program
	{
		public static void Main(string[] args)
		{
			int n  = int.Parse(Console.ReadLine());
        var array1 = Console.ReadLine().Split(' ');
        List<int> list = new List<int>();
        List<int> list1 = new List<int>();
        for(int i=0;i<n;++i)
        {
        	list.Add(int.Parse(array1[i]));
        }
        bool[] mark = new bool[list.Max()+1];
        for(int i=0;i<list.Max();++i)mark[i] = false;

        for(int i = 0;i<list.Count;++i)
        {
        	//Console.WriteLine(list[i]);
        	if(mark[list[i]] == false)
        	{
        		mark[list[i]] = true;
        		list1.Add(list[i]);
        	}
        }
        Console.WriteLine(list1.Count);
        foreach(var item in list1)
        {
        	Console.Write(item+" ");
        }
			//Console.ReadKey(true);
		}
	}
}


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

namespace csharp
{
    static class Solver
    {
        static void Main(string[] args)
        {
            var val = ReadInts().ToList();
            val.Sort();

            if (val[0] + val[1] > val[2] || val[1] + val[2] > val[3]) Console.WriteLine("TRIANGLE");
            else if (val[0] + val[1] < val[2] && val[1] + val[2] < val[3]) Console.WriteLine("IMPOSSIBLE");
            else Console.WriteLine("SEGMENT");
        }

        private static IEnumerable<int> ReadInts() => Console.ReadLine().Split(' ').Select(int.Parse);
        private static int ReadInt() => int.Parse(Console.ReadLine());
        private static void Print<T>(this IEnumerable<T> items, char separator) => Console.WriteLine(string.Join(separator, items));

        private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
        {
            public new TValue this[TKey key]
            {
                get { return base.TryGetValue(key, out var value) ? value : default(TValue); }
                set { base[key] = value; }
            }
        }
    }
}


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

namespace _04_01_12_1_
{
    class Program
    {
        static void Main(string[] args)
        {
            string a=Console.ReadLine();
            string[] am=Regex.Split(a, @"\s+");

            int n, R, r;
            ang=0;

            n = int.Parse(am[0]);
            R = int.Parse(am[1]);
            r = int.Parse(am[2]);

            if (R < r)
                ang = 10;
            if (R >= r && R < r * 2)
                ang = Math.PI;
            if (R==2*r)
                ang = Math.PI / 2;
            if (R>2*r)
            {
                int g = R - r;
                int k = r;
                ang = Math.Asin((double)k / (double)g);
            }
            if (ang * n <= Math.PI+0.0000000001)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
            //Console.ReadLine();
        }
    }
}


using System.Collections.Generic;
using System;
namespace ProblemToAlgorithms
{
class Solution
{
    public static void Swap(int s1, int s2)
    {

    }
    public static int arrayManipulation(List<int> list)
    {
        int sum = 0;
        for (int i = 0; i < list.Count; i++)
        {
            var next = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > next)
            {
                list[j + 1] = list[j];
                --j;
            }
            list[j + 1] = next;
        }
        for (int i = 0; i < list.Count; i += 2)
        {
            sum = sum + list[i + 1] - list[i];
        }
        return sum;
    }

    static void Main(string[] args)
    {
        List<int> list = new List<int>();
        do
        {
            var t = Console.ReadLine();
            var coll = t.Split(" ");
            foreach (var item in coll)
            {
                list.Add(Int32.Parse(item));
            }
        } while (list.Count % 2 != 0);

        var i = Solution.arrayManipulation(list);

        Console.WriteLine(i);
        Console.ReadKey();
    }
}

}


using System.Collections.Generic;
using System;
namespace ProblemToAlgorithms
{
class Solution
{

    public static int arrayManipulation(List<int> list)
    {
        int sum = 0;
        for (int i = 0; i < list.Count; i++)
        {
            var next = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > next)
            {
                list[j + 1] = list[j];
                --j;
            }
            list[j + 1] = next;
        }
        for (int i = 0; i < list.Count; i += 2)
        {
            sum = sum + list[i + 1] - list[i];
        }
        return sum;
    }

    static void Main(string[] args)
    {
        List<int> list = new List<int>();

            var t = Console.ReadLine();
            var coll = t.Split(" ");
            foreach (var item in coll)
            {
                list.Add(Int32.Parse(item));
            }

        var i = Solution.arrayManipulation(list);

        Console.WriteLine(i);

    }
}

}


using System.Collections.Generic;
using System;
namespace ProblemToAlgorithms
{
class Solution
{
    public static int arrayManipulation(List<int> list)
    {
        int sum = 0;
        for (int i = 0; i < list.Count; i++)
        {
            var next = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > next)
            {
                list[j + 1] = list[j];
                --j;
            }
            list[j + 1] = next;
        }
        for (int i = 0; i < list.Count; i += 2)
        {
            sum = sum + list[i + 1] - list[i];
        }
        return sum;
    }

    static void Main(string[] args)
    {
        List<int> list = new List<int>();
        int ll=Convert.ToInt32(Console.ReadLine());
            string t = Console.ReadLine();
            String []coll = t.Split(' ');
            for (int i=0 ;i<ll;i++)
            {
                list.Add(Int32.Parse(coll[i]));
            }
        var i = Solution.arrayManipulation(list);
        Console.WriteLine(i);

    }
}

}


using System;
class Program{
    public static void Main(string[] args){
        long n = long.Parse(Console.ReadLine());
        ulong res = 0;
        for(int i = 1; i <= n; i++)
            res += 6l * i;
        Console.WriteLine(res);
    }
}


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());

        }
    }

//}


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

public class CF_854A
{
    public string solve(int sum)
    {
        var l = sum / 2;
        var ra = 0; var rb = 0;
        for (int i = 1; i <= l; i++)
        {
            var a = i; var b = sum - a;
            if (are_coprime(a, b))
            {
                ra = a; rb = b;
            }
        }
        return ra + " " + rb;
    }

    public static int gcd(int a, int b)
    {
        while (b != 0)
        {
            var t = a % b;
            a = b;
            b = t;
        }
        return a;
    }

    public static bool are_coprime(int a, int b)
    {
        if (((a | b) & 1) == 0)
            return false;
        return 1 == gcd(a, b);
    }
}

#if !ONLINE_JUDGE
namespace CodeForces
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class Test_CF_854A
    {
        [TestMethod]
        public void Test1()
        {
            Assert.AreEqual("1 2", new CF_854A().solve(3));
        }

        [TestMethod]
        public void Test2()
        {
            Assert.AreEqual("1 3", new CF_854A().solve(4));
        }

        [TestMethod]
        public void Test3()
        {
            Assert.AreEqual("5 7", new CF_854A().solve(12));
        }

        [TestMethod]
        public void Test4()
        {
            Assert.AreEqual("499 501", new CF_854A().solve(1000));
        }
    }
}
#endif


using Sytem;
class Program{
    public static void Main(string[] args){
        int n = int.Parse(Console.ReadLine());
        int res = 2;
        for(int i = 2; i <= n; i++)
            res += i * 2;
        Console.WriteLine(res);
    }
}


            var countAndEvil = Console.ReadLine();
            var mex = int.Parse(countAndEvil.Split(' ')[1]);

            var numbers = Console.ReadLine().
                Split(' ').
                Select(x => int.Parse(x)).
                ToList();

            int lessCount = 0;
            int shouldBeDelete = 0;
            numbers.ForEach(x =>
            {
                if (x < mex) lessCount++;
                if (x == mex) shouldBeDelete++;
            });

            var k = mex - lessCount + shouldBeDelete;

            Console.WriteLine(Math.Min(k, numbers.Count));


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

namespace twoprob
{
    class Program
    {
        public static int binsearch(int[] x, int n, int l, int r)
        {

            if (x.Length == 0)
            {
                return -1;
            }
            else if (x[0] < n)
            {
                return -1;
            }
            else if (x[x.Length - 1] > n)
            {
                return -1;
            }
            int mid;
            while (l < r)
            {
                mid = l + (r - l) / 2;

                if (n >= x[mid])
                    r = mid;
                else
                    l = mid + 1;
            }
            if (x[r] == n)
            {
                return r;
            }
            else
            {
                return -1;
            }
        }
        static void Main(string[] args)
        {
            int x, t, a, b, da, db, i;
            string s=Console.ReadLine();
            string[] tmp=s.Split(' ');
            x = int.Parse(tmp[0]);
            t = int.Parse(tmp[1]);
            a = int.Parse(tmp[2]);
            b = int.Parse(tmp[3]);
            da = int.Parse(tmp[4]);
            db = int.Parse(tmp[5]);
            if (x == 0)
            {
                Console.WriteLine("YES");
                return;
            }
            Console.WriteLine();
            int[] ab = new int[t+1];
            int[] bb = new int[t+1];
            for (i = 0; i < t; i++)
            {
                ab[i] = a - da * i;
                bb[i] = b - db * i;
            }
            for (i=0; i<=t; i++)
                if (binsearch(ab, x - bb[i], 0, t) != -1)
                {
                    Console.WriteLine("YES");
                    return;
                }
            Console.WriteLine("NO");

        }
    }
}


using System;

namespace helloworld
{
    class Program
    {

        static void Main(string[] args)
        {
            string vowel = "aouie";
            var tr = Console.ReadLine();
            if(tr.Length==1 && (tr != "n" || tr!="N"))
            {
                Console.Write("NO");
                return;
            }

            if(vowel.Contains(tr[0]))
            {
                Console.Write("NO");
                return;
            }

            if(!vowel.Contains(tr[tr.Length-1]) && tr[tr.Length-1] != 'n')
            {
                Console.Write("NO");
                return;
            }

            for(int i = 1; i < tr.Length-1; i++)
            {
                if (vowel.Contains(tr[i]))
                {
                    if (vowel.Contains(tr[i - 1]))
                    {
                        Console.Write("NO");
                        return;
                    }
                    if (vowel.Contains(tr[i + 1]))
                    {
                        Console.Write("NO");
                        return;
                    }
                }
                if (!vowel.Contains(tr[i]) && tr[i]!='n')
                {
                    if (!vowel.Contains(tr[i - 1]) && tr[i-1] != 'n')
                    {
                        Console.Write("NO");
                        return;
                    }
                    if (!vowel.Contains(tr[i + 1]) && tr[i + 1] != 'n')
                    {
                        Console.Write("NO");
                        return;
                    }
                }
            }
            Console.Write("YES");
        }
    }
}


class Program
    {
        static void Main(string[] args)
        {
            char[] x = Console.ReadLine().ToArray();
            int size = x.Length;

            if (size < 100 && size > 1)
            {
                for (int i = 0; i < x.Length;)
                {
                    char c = x[i];
                    char s = x[i + 1];

                    if (c != 'n' || c != 'a' || c != 'e' || c != 'o' || c != 'u' || c != 'i')
                    {
                        if (s != 'a' || s != 'e' || s != 'o' || s != 'u' || s != 'i')
                        {
                            Console.WriteLine("NO");
                            return;
                        }
                        else
                        {
                            i += 2;
                        }
                    }
                    else if (c == 'n')
                    {
                        char y = x[i + 2];
                        if (s != 'n' || s != 'a' || s != 'e' || s != 'o' || s != 'u' || s != 'i')
                        {
                            if (y != 'n' || y != 'a' || y != 'e' || y != 'o' || y != 'u' || y != 'i')
                            {
                                Console.WriteLine("NO");
                                return;
                            }
                            else
                            {
                                i += 3;
                            }
                        }
                        else
                        {
                            i += 2;
                        }
                    }
                }
                Console.WriteLine("YES");
                return;
            }
        }
    }


using System;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        int n = Convert.ToInt32(s);
        s = Console.ReadLine();
        int[] arr = s.Split(' ').Select(x => Convert.ToInt32(x)).Distinct().OrderBy(x => x).ToArray();
        if (arr.Length == 3)
        {
            if (arr[2] - arr[1] == arr[1] - arr[0])
                Console.WriteLine(arr[2] - arr[1]);
            else
                Console.WriteLine(-1);
        }
        else
            if (arr.Length == 2)
            Console.WriteLine(arr[1] - (arr[0] + arr[1]) / 2);
        else
        if (arr.Length == 0)
            Console.WriteLine(0);
        else
            Console.WriteLine(-1);
    }
}


using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        Problem1154B();
    }

    static void Problem1154B()
    {
        string s = Console.ReadLine();
        int n = Convert.ToInt32(s);
        s = Console.ReadLine();
        var arr = s.Split(' ').Select(x => Convert.ToInt32(x));
        Console.WriteLine(Problem1154B(arr));
    }
    static int Problem1154B(IEnumerable<int> ar)
    {
        int[] arr = ar.Distinct().OrderBy(x => x).ToArray();
        if (arr.Length == 3)
        {
            if (arr[2] - arr[1] == arr[1] - arr[0])
                return arr[2] - arr[1];
            else
                return -1;
        }
        else
        {
            if (arr.Length == 2)
            {
                if ((arr[1] - arr[0]) % 2 == 0)
                    return (arr[1] - arr[0]) / 2;
                else
                    return arr[1] - arr[0];
            }
            else
            if (arr.Length == 1)
                return 0;
            else
                return -1;
        }
    }
}


using System;
using System.Text;

namespace CP
{
    class Program
    {
        static void Main(string[] args)
        {
            char dir = Convert.ToChar(Console.ReadLine());
            string message = Console.ReadLine();
            string keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./";
            StringBuilder sb = new StringBuilder();
            if(dir == 'L')
            {
                for(int i = 0 ; i<message.Length ; i++)
                {
                    for(int j = 0 ; j<keyboard.Length ; j++)
                    {
                        if(message[i]==keyboard[j])
                        sb.Append(keyboard[i-1]);
                    }
                }
            }
            else
            {
                for(int i = 0 ; i<message.Length ; i++)
                {
                    for(int j = 0 ; j<keyboard.Length ; j++)
                    {
                        if(message[i]==keyboard[j])
                        sb.Append(keyboard[i+1]);
                    }
                }
            }
            Console.WriteLine(sb);
            }

        }
    }
}


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            Int64 a, b, result = 1;
            string s = Console.ReadLine();
            string[] arr = s.Split(' ');
            Int64.TryParse(arr[0], out a);
            Int64.TryParse(arr[1], out b);
            char[] arr1 = arr[0].ToCharArray();
            char[] arr2 = arr[1].ToCharArray();
            //Console.WriteLine(arr1[arr1.Length-1]);
            //Console.WriteLine(arr2[arr2.Length-1]);
            //Console.WriteLine((arr2[arr2.Length - 1] - arr1[arr1.Length - 1]));
            double res = b - a;
            if ((((arr2[arr2.Length - 1] - arr1[arr1.Length - 1])) < 0) || (b % 100 == 0))
            {
                result = 0;
            }
            else
            {
                for (int i = 0; i < res; i++)
                    result *= ((b - i) % 10);
            }
            Console.WriteLine(result%10);
        }
    }
}


Sponsored by
In English По-русски
The_Shawshank | Logout

    Home
    Contests
    Gym
    Problemset
    Rating
    Help
    ABBYY Cup 3.0
    ACM-ICPC WF-2013
    Yandex.Algorithm 2013

Codeforces Round #190 (Div. 2)
Finished
Practice
Add to favourites

→ Practice
You are registered for practice. You can solve problems unofficially. Results can be found in the contest status and in the bottom of standings.

    Problems
    Submit
    My submissions
    Status
    Hacks
    Room
    Standings
    Custom test

My submissions

# 	When 	Who 	Problem 	Lang 	Verdict 	Time 	Memory
3992720 	Jun 29, 2013 8:26:45 PM 	The_Shawshank 	C - Ciel and Robot 	Mono C# 	Compilation error 	0 ms 	0 KB
3992707 	Jun 29, 2013 8:23:52 PM 	The_Shawshank 	C - Ciel and Robot 	Mono C# 	Wrong answer on test 13 	62 ms 	200 KB
3992703 	Jun 29, 2013 8:22:45 PM 	The_Shawshank 	C - Ciel and Robot 	Mono C# 	Compilation error 	0 ms 	0 KB
3991470 	Jun 29, 2013 4:22:09 PM 	The_Shawshank 	C - Ciel and Robot 	Mono C# 	Wrong answer on test 1 	31 ms 	0 KB
3990747 	Jun 29, 2013 2:07:35 PM 	The_Shawshank 	B - Ciel and Flowers 	Mono C# 	Wrong answer on test 6 	31 ms 	300 KB

My contest submissions

# 	When 	Who 	Problem 	Lang 	Verdict 	Time 	Memory
No items

Codeforces (c) Copyright 2010-2013 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: 06/29/2013 08:26PM.
By The_Shawshank, contest: Codeforces Round #190 (Div. 2), problem: (C) Ciel and Robot, Compilation error, #

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

public class NetworkXOneTimePad
{
    public static void Main()
    {
        string str = Console.ReadLine();
        string[] values = str.Split(' ');
        int a = int.Parse(values[0]);
        int b = int.Parse(values[1]);
        str = Console.ReadLine();
        int x=0,y=0;
        List<KeyValuePair<int, int>> lst = new List<KeyValuePair<int, int>>();
        lst.Add(new KeyValuePair<int,int>(0,0));

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == 'R')
            {
                x++;
            }
            else if (str[i] == 'L')
            {
                x--;
            }
            else if (str[i] == 'U')
            {
                y++;
            }
            else
            {
                y--;
            }
            lst.Add(new KeyValuePair<int,int>(x,y));
        }
        int px=x,py=y,ans=0;
        foreach (var kv in lst)
        {

            if(px!=0 && py!=0 && ((a-kv.Key)%px ==0) && ((b-kv.Value)%py==0) &&((a-kv.Key)/px ==(b-kv.Value)/py)&& (b-kv.Value)/py>=0)
            {
                ans=1;
                break;
            }
            else if (px == 0 && py == 0 && (a == kv.Key) && (b == kv.Value))
            {
               ans=1;
                break;
            }
            else if (px == 0 && (a == kv.Key) && ((b-kv.Value)%py ==0) && (b-kv.Value)/py>=0)
            {
                ans=1;
                break;
            }
            else if (py == 0 && (b == kv.Value) && ((a - kv.Key) % px == 0) &&(a-kv.Key)/px >=0)
            {
                ans=1;
                break;
            }
        }
        if(ans==0)Console.WriteLine("No");
else Console.WriteLine("Yes");
        Console.ReadLine();
    }
}


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

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

            if (n == 3)
                Console.WriteLine(0);
            else if (n % 4 == 0)
                    Console.WriteLine(0);
                else
                    Console.WriteLine(1);
                //Console.ReadKey();
        }
    }
}


namespace Test
{
    class Program
    {

        static void Main(string[] args)
        {
            var num1 = int.Parse(Console.ReadLine());
            var sum = (1 + num1) * num1 / 2;
            Console.WriteLine(sum - sum / 2 * 2);

        }

    }
}


using System;

class P {
  static void Main() {
    var n = int.Parse(Console.ReadLine());
    for (var d = 2 ; n != 1 && d <= n ; d++)
      Console.Write("{0} ", n);
      if (n % d == 0) { n /= d; d--; }
    }
    Console.Write(1);
  }
}


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

namespace mochila
{
    class Rick
    {
        public int Grito { get; set; }

        public Rick(int grito)
        {
            Grito = grito;
        }
    }

    class Program
    {
        static bool verificaGritos(int a, int b, int c, int d)
        {
            int SomaRick = a + b;
            int SomaMorty = c + d;
            int diferenca = 0;

            if (SomaRick > SomaMorty)
            {
                diferenca = SomaRick - SomaMorty;

                if (diferenca > c)
                    return false;
                else
                    return true;
            }
            else
            {
                diferenca = SomaMorty - SomaRick;

                if (diferenca > a)
                    return false;
                else
                    return true;
            }
        }

        static int comparaComRick(List<Rick> lista, int morty)
        {
            int igual = -1;

            for (int i = 0; i < lista.Count; i++)
            {
                if (lista[i].Grito == morty)
                {
                    igual = morty;
                }
            }

            return igual;
        }

        static void verificaGritosIguais(int a, int b, int c, int d)
        {
            List<Rick> lista = new List<Rick>();
            int cont = 1, rick = 0, morty = 0, igual = -1;   // Igual j� come�a com -1, caso n�o entre no if, j� sai -1 igual o problema pede

            if (verificaGritos(a, b, c, d))
            {
                do
                {
                    rick = b + (a * cont);        // sequ�ncia de gritos de Rick.
                    morty = c + (d * cont);       // sequ�ncia de gritos de Morty.

                    cont++;                       // contador da sequ�ncia.

                    lista.Add(new Rick(rick));    // Somente o grito do Rick � guardado

                    igual = comparaComRick(lista, morty);   // Vai comparar o grito do morty com os gritos guardados do Rick

                } while (igual != morty);         // Enquanto n�o gritarem ao mesmo tempo

                Console.WriteLine(igual);
            }
            else
            {
                Console.WriteLine(igual);
            }
        }

        static void Main(string[] args)
        {
            string R = Console.ReadLine();
            int a = int.Parse(r.split()[0]);
            int b = int.Parse(r.split()[1]);

            string M = Console.ReadLine();
            int c = int.Parse(r.split()[0]);
            int d = int.Parse(r.split()[1]);

            verificaGritosIguais(a, b, c, d);
        }
    }
}


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

namespace mochila
{
    class Rick
    {
        public int Grito { get; set; }

        public Rick(int grito)
        {
            Grito = grito;
        }
    }

    class Program
    {
        static bool verificaGritos(int a, int b, int c, int d)
        {
            int SomaRick = a + b;
            int SomaMorty = c + d;
            int diferenca = 0;

            if (SomaRick > SomaMorty)
            {
                diferenca = SomaRick - SomaMorty;

                if (diferenca > c)
                    return false;
                else
                    return true;
            }
            else
            {
                diferenca = SomaMorty - SomaRick;

                if (diferenca > a)
                    return false;
                else
                    return true;
            }
        }

        static int comparaComRick(List<Rick> lista, int morty)
        {
            int igual = -1;

            for (int i = 0; i < lista.Count; i++)
            {
                if (lista[i].Grito == morty)
                {
                    igual = morty;
                }
            }

            return igual;
        }

        static void verificaGritosIguais(int a, int b, int c, int d)
        {
            List<Rick> lista = new List<Rick>();
            int cont = 1, rick = 0, morty = 0, igual = -1;   // Igual j� come�a com -1, caso n�o entre no if, j� sai -1 igual o problema pede

            if (verificaGritos(a, b, c, d))
            {
                do
                {
                    rick = b + (a * cont);        // sequ�ncia de gritos de Rick.
                    morty = c + (d * cont);       // sequ�ncia de gritos de Morty.

                    cont++;                       // contador da sequ�ncia.

                    lista.Add(new Rick(rick));    // Somente o grito do Rick � guardado

                    igual = comparaComRick(lista, morty);   // Vai comparar o grito do morty com os gritos guardados do Rick

                } while (igual != morty);         // Enquanto n�o gritarem ao mesmo tempo

                Console.WriteLine(igual);
            }
            else
            {
                Console.WriteLine(igual);
            }
        }

        static void Main(string[] args)
        {
            string R = Console.ReadLine();
            int a = int.Parse(R.split("")[0]);
            int b = int.Parse(R.split("")[1]);

            string M = Console.ReadLine();
            int c = int.Parse(M.split("")[0]);
            int d = int.Parse(M.split("")[1]);

            verificaGritosIguais(a, b, c, d);
        }
    }
}


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

namespace Game
{
    class Card
    {
        public string ValueCard { get; set; }
        public string LearCard { get; set; }
        public bool Trump { get; set; }

        public static bool Calculation(Card card1, Card card2, string trump)
        {
            bool status = false;

            //присвоение статуса "козырь"
            if (card1.LearCard == trump)
                card1.Trump = true;
            if (card2.LearCard == trump)
                card2.Trump = true;

            //вариант 1
            //если первая козырь, а вторая нет, то
            if (card1.Trump == true && card2.Trump == false)
            {
                status = true;
            }
            //вариант 2
            //если вторая козырь, а первая нет, то
            if (card1.Trump == false && card2.Trump == true)
            {
                status = false;
            }

            //вариант 3
            //если карты не козыри, а первая другой масти

            if (card1.Trump == false && card2.Trump == false)
            {
                if (card1.LearCard != card2.LearCard)
                    status = false;
            }

            //если масти одинаковы
            if (card1.LearCard == card2.LearCard)
            {
                int ind1 = card1.GetCoefficient();
                int ind2 = card2.GetCoefficient();

                if (card1.GetCoefficient() > card2.GetCoefficient())
                {
                    status = true;
                }
            }
            return status;
        }

        public int GetCoefficient()
        {
            int coef = new int();
            switch (this.ValueCard)
            {
                case "6": coef = 1;
                    break;
                case "7": coef = 2;
                    break;
                case "8": coef = 3;
                    break;
                case "9": coef = 4;
                    break;
                case "10": coef = 5;
                    break;
                case "В": coef = 6;
                    break;
                case "Д": coef = 7;
                    break;
                case "К": coef = 8;
                    break;
                case "Т": coef = 9;
                    break;
                default:
                    break;
            }
            return coef;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            bool work = true;

            while (work == true)
            {

                // Console.Write("Введите масть козыря одной заглавной буквой.\r\nКрести, вини, черви, буби - К, В, Ч, Б - соответственно.\r\nКозырь: ");
                //масть

                string learTrump = Console.ReadLine();

                //Console.WriteLine("\r\nВведите достоинство карт.\r\nНапример, король червей - КЧ, восмёрка крестей - 8К");
                //Console.Write("Карта №1: ");

                string cards = Console.ReadLine();
                int indexProbel = cards.IndexOf(' ');
                int indexPospeProbela = cards.Length - indexProbel - 1;
                string strCard1 = cards.Substring(0, indexProbel);

                // Console.Write("Карта №2: ");
                string strCard2 = cards.Substring(indexProbel + 1, indexPospeProbela);

                Card card1;
                Card card2;

                if (strCard1.Length == 3)
                {
                    card1 = new Card { ValueCard = strCard1[0].ToString() +strCard1[1].ToString() , LearCard = strCard1[2].ToString() };
                }
                else
                {
                    card1 = new Card { ValueCard = strCard1[0].ToString(), LearCard = strCard1[1].ToString() };
                }

                if (strCard2.Length == 3)
                {
                    card2 = new Card { ValueCard = strCard2[0].ToString() + strCard2[1].ToString(), LearCard = strCard2[2].ToString() };
                }
                else
                {
                    card2 = new Card { ValueCard = strCard2[0].ToString(), LearCard = strCard2[1].ToString() };
                }

                bool result = Card.Calculation(card1, card2, learTrump);

                if (result)
                    Console.WriteLine("YES");
                else
                    Console.WriteLine("NO");

            }
        }


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

namespace ProgrammingContest.Codeforces.Round82 {
    class A {
        static void Mai() {
            char s = Console.ReadLine()[0];
            var xs = Console.ReadLine().Split(' ');

            Dictionary<char, int> dic = new Dictionary<char, int>();

            for (int i = 6; i < 10; i++)
                dic[(char)(i + '0')] = i;

            string str = "TJQKA";
            for (int i = 0; i < str.Length; i++)
                dic[str[i]] = i + 10;

            Console.WriteLine(
                s == xs[0][1] && s != xs[1][1] ||
                xs[0][1] == xs[1][1] && dic[xs[0][0]] > dic[xs[1][0]] ?
                "YES" : "NO");
        }
    }
}


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

namespace olimp
{
	public class HonoredGame2
	{
		public static void Main (string[] args)
		{
			int count;

			if (!int.TryParse (Console.ReadLine (), out count) || count < 2 || count > 100 || count % 2 != 0) {
				Console.WriteLine ("NO");
				return;
			}

			int number;
			int n1 = 0;
			int n2 = 0;
			int cnt = 0;

			while (int.TryParse (Console.ReadLine (), out number)) {
				if (number >= 1 && number <= 100) {
					if (i == 0) {
						n1 = number;
						cnt = 1;
						continue;
					}

					if (number != n1) {
						if (n2 == 0) n2 = number;

						continue;
					}

					cnt++;
				}
			}

			if (cnt != count / 2) {
				Console.WriteLine ("NO");
				return;
			}

			Console.WriteLine ("YES");
			Console.WriteLine (n1 + " " + n2);

			//Console.ReadKey ();
		}
	}
}


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

namespace olimp
{
	public class HonoredGame2
	{
		static int count;

		public static void Main (string[] args)
		{
			string s = Console.ReadLine ();

			if (!int.TryParse (s, out count) || count < 2 || count > 100 || count % 2 != 0) {
				Console.WriteLine ("NO");
				return;
			}

			int a = 0;
			int b = 0;

			int c1 = 0;
			int c2 = 0;

			for (int i = 0; i < count; i++) {
				int number;

				if (int.TryParse (Console.ReadLine (), out number) && number >= 1 && number <= 100) {
					if (i == 0) {
						a = number;
						c1 = 1;
						continue;
					}

					if (b == 0 && number != a) {
						b = number;
						c2 = 1;
						continue;
					}

					if (number == a) c1++; else c2++;
				}
			}

			if (c1 == 0 || c2 == 0 || c2 != c1) {
				Console.WriteLine ("NO");
				return;
			}

			Console.WriteLine ("YES");
			Console.WriteLine (a.Value + " " + b.Value);

			//Console.ReadKey ();
		}
	}
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedSet<int> set = new SortedSet<int>();
            int n;
            n=Int32.Parse(Console.ReadLine());
            string[] A = new string[n];
            for(int i=0;i<n;i++)
            {
                A[i] = Console.ReadLine();
            }
            var g = A.GroupBy(e => e);
            if(g.Count()==2 &&g.First().Count()==n/2)
            {
                Console.WriteLine("YES");
                Console.Write(g.First().Key + " "g.Last().Key);

            }
            else
            {
                Console.WriteLine("NO");

            }

        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static Reader;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using System.Text.RegularExpressions;

public static class P
{
    public static void Main()
    {
        var s = Console.ReadLine();
        Console.WriteLine(Regex.Matches(s, "(Danil|Olya|Slava|Ann|Nikita)").Count == 1 ? "Yes" : "No");
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;

namespace ConsoleApp1
{
    public static class PositionHelper
    {
        private static Dictionary<Program.Position, HashSet<Program.Position>> cache = new Dictionary<Program.Position, HashSet<Program.Position>>();

        public static HashSet<Program.Position> GetSurrondings(this Program.Position position)
        {
            if (!cache.ContainsKey(position))
            {
                cache.Add(position, new HashSet<Program.Position>
                {
                    position,
                    new Program.Position(position.X - 1, position.Y),
                    new Program.Position(position.X - 1, position.Y - 1),
                    new Program.Position(position.X - 1, position.Y + 1),
                    new Program.Position(position.X, position.Y - 1),
                    new Program.Position(position.X, position.Y + 1),
                    new Program.Position(position.X + 1, position.Y),
                    new Program.Position(position.X + 1, position.Y - 1),
                    new Program.Position(position.X + 1, position.Y + 1)
                });
            }
            return cache[position];
        }

    }

    public static class Program
    {
        public static void Main()
        {
            Console.WriteLine(HasAvailablePosition(ReadData()) ? "OTHER" : "CHECKMATE");
        }

        public static bool HasAvailablePosition(string positions)
        {
            var lines = positions.Split(' ');
            var l1Position = new Position(lines[0]);
            var l2Position = new Position(lines[1]);
            var kingPosition = new Position(lines[2]);
            var aimPosition = new Position(lines[3]);

            var positionsForCheck = aimPosition.GetSurrondings();

            foreach (var position in positionsForCheck)
            {
                if (IsAvailablePosition(position, aimPosition, l1Position, l2Position, kingPosition))
                {
                    return true;
                }
            }
            return false;
        }

        private static bool IsAvailablePosition(Position position, Position aimPosition, Position l1, Position l2, Position kingPosition)
        {
            if (position.X <= 0 || position.X > 8 || position.Y <= 0 || position.Y > 8)
                return false;

            if (kingPosition.GetSurrondings().Contains(position))
                return false;

            if (HasProblemsWithL(position, aimPosition, l1, l2, kingPosition))
                return false;

            if (HasProblemsWithL(position, aimPosition, l2, l1, kingPosition))
                return false;
            return true;
        }

        private static bool HasProblemsWithL(Position position, Position aimPosition, Position l1, Position l2, Position kingPosition)
        {
            if (position.X == l1.X || position.Y == l1.Y)
            {
                if (l1.X == l2.X || l1.Y == l2.Y)
                    return true;
                if (kingPosition.GetSurrondings().Contains(l1))
                    return true;
                if (!position.GetSurrondings().Contains(l1))
                    return true;
                if (!position.Equals(aimPosition) && !position.Equals(l1))
                    return true;
            }
            return false;
        }

        public class Position
        {

            private static readonly Dictionary<char, int> Positions = new Dictionary<char, int>
            {
                {'a', 1},
                {'b', 2},
                {'c', 3},
                {'d', 4},
                {'e', 5},
                {'f', 6},
                {'g', 7},
                {'h', 8}
            };

            public int X { get; }
            public int Y { get; }
            private char q;

            public Position(string position)
            {
                var splits = position.ToCharArray();
                X = Positions[splits[0]];
                Y = int.Parse(splits[1].ToString());
                q = splits[0];
            }

            public Position(int x, int y)
            {
                X = x;
                Y = y;
                q = Positions.FirstOrDefault(z => z.Value == x).Key;
            }

            protected bool Equals(Position other)
            {
                return X == other.X && Y == other.Y;
            }

            public override string ToString()
            {
                return $"{q}{Y}";
            }

            public override bool Equals(object obj)
            {
                if (ReferenceEquals(null, obj)) return false;
                if (ReferenceEquals(this, obj)) return true;
                if (obj.GetType() != this.GetType()) return false;
                return Equals((Position) obj);
            }

            public override int GetHashCode()
            {
                unchecked
                {
                    return (X * 397) ^ Y;
                }
            }
        }

        private static string ReadData()
        {
            //return File.ReadAllLines("1.txt").Single();
            return Console.ReadLine();
            //yield return Console.ReadLine();
        }

        //private static IEnumerable<string> ReadData()
        //{
        //    //return File.ReadAllLines("1.txt");
        //    while (true)
        //    {
        //        var line = Console.ReadLine();
        //        if (string.IsNullOrEmpty(line))
        //            yield break;
        //        yield return line;

        //    }
        //}
    }
}


#include <iostream>
#include <string>
using namespace std;

string convert_to_base4(string &s)
{
    const int size = s.size();
    const int constraint = size % 2 == 0 ? 0 : 1;
    string base4 = "";
    for (int i = size - 1; i >= constraint; i -= 2)
    {
        string tmp = to_string(s[i] - '0') + to_string(s[i - 1] - '0');
        if (tmp == "00")
            base4 = "0" + base4;
        else if (tmp == "01")
            base4 = "1" + base4;
        else if (tmp == "10")
            base4 = "2" + base4;
        else if (tmp == "11")
            base4 = "3" + base4;
    }

    if (constraint == 1)
        base4 = '1' + base4;

    return base4;
}

int max(string &base4)
{
    string tmp = "1";
    const int base4_size = base4.size() - 1;
    for (int i = 0; i < base4_size; ++i)
        tmp = '0' + tmp;

    if (base4 > tmp)
        return base4.size();
    else
        return base4.size() - 1;
}

int main()
{
    string s;
    cin >> s;

    string base4 = convert_to_base4(s);
    cout << max(base4) << endl;

    return 0;
}


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

namespace acm{
    class Program{
        static void Main(string[] args){
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
#if DEBUG
            open(file);
#endif
            string mainStr = RL();

            for (int i = mainStr.Length - 1; i > 1; i--) {
                for (int j = 0; j < mainStr.Length - i; j++) {
                    string subs = mainStr.Substring(j, i);
                    int tmp = KMP(mainStr, subs);
                    if (tmp >= 2) {
                        println(subs.Length);
                        close(file);
                        return;
                    }
                }
            }

            println(0);

#if DEBUG
                close(file);
#endif
        }

        static int KMP(string mainStr, string subs) {
            int count = 0;
            int[] fail = new int[subs.Length+1];

            fail[1] = 0;
            for(int i=2; i<=subs.Length; i++){
                int tmp=fail[i-1];
                while(tmp>0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];
                fail[i] = tmp + 1;
            }

            int posInText=0, posInSubs = 0;
            while (posInText < mainStr.Length) {
                if (posInSubs == 0 || mainStr[posInText] == subs[posInSubs])
                {
                    posInSubs++;
                    posInText++;
                } else {
                    posInSubs = fail[posInSubs];
                }

                if (posInSubs == subs.Length) {
                    count++;
                    posInText = posInText - posInSubs + 1;
                    posInSubs = 0;
                }
            }

            return count;
        }

#if DEBUG
        static bool file = true;
        static TextReader fin = new StreamReader("input.txt");
        static TextWriter fout = new StreamWriter("output.txt");
        static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }
        static void close(bool f) { if (f) fout.Close(); }
#endif
        struct pair<T1, T2> { public T1 first; public T2 second; }
        static void fill<T>(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }
        static void fill<T>(List<T> d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }
        static void swap<T>(List<T> l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }
        static void swap<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
        static int readInt() { return int.Parse(RL()); }
        static void print(object o) { Console.Write(o); }
        static void print(String f, params object[] o) { Console.Write(f, o); }
        static void println() { Console.WriteLine(); }
        static void println(object o) { Console.WriteLine(o); }
        static void println(String f, params object[] o) { Console.WriteLine(f, o); }
        static string RL() { return Console.ReadLine(); }
        static int RC() { return Console.Read(); }
    }
}


using System;
using System.Numerics;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Text.RegularExpressions;

namespace ProjectEuler
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = nums[0];
            int k = nums[1];
            int x = 0;
            int b = n / GCD(n, k);
            int a = n / b;
            int min = a * k + b;
            for (int i = 1; i <= n; i++)
            {
                if (n%i == 0)
                {
                    b = n / i;
                    a = n / b;
                    int tmp = a * k + b;
                    if (tmp%k != 0)
                    {
                        x = tmp;
                    }
                    else
                    {
                        x = min;
                    }
                }
                if (min > x)
                {
                    min = x;
                }
            }
            Console.WriteLine(min);
        }
    }
}


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

// ~

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

#if DEBUG
            TextReader reader = new StreamReader("../../input.txt");
            TextWriter writer = Console.Out;
#else
			TextReader reader = Console.In
            TextWriter writer = Console.Out;
#endif

            for (int i = 0; i < 8; i++) {
                var line = reader.ReadLine().ToCharArray();
                for (int j = 1; j < line.Length; j++) {
                    if (line[j - 1] == line[j]) {
                        writer.WriteLine("NO");
                        //writer.Close();
                        return;
                    }
                }
            }

            writer.WriteLine("YES");
            //writer.Close();
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}


using System;

namespace Calculator
{
	class Program
	{
		static void Main(string[] args)
		{
			int tamano = Convert.ToInt32(Console.ReadLine());
			string texto = Console.ReadLine();

			String final = new String("");
			int f = 1;

			for(int i = 1; (f - 1) < tamano; i++)
			{
				final += texto.Substring(f - 1, 1);
				f = f + i;
			}

			Console.WriteLine(final);
		}
	}
}


using System.Linq;
using System;

namespace cs
{
    class Program
    {
        static void Main(string[] args)
        {
          int n = Convert.ToInt32(Console.ReadLine());
          if(n % 2 == 0) {
            Console.WriteLine("Mahmoud")
          } else {
            Console.WriteLine("Ehab");
          }
        }
    }
}


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

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

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

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

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

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

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


class DimaAndGuards
{
    static void Main(string[] args)
    {
        string strM = Console.ReadLine();
        int m = int.Parse(strM);
        int[] post1 = new int[4];
        int[] post2 = new int[4];
        int[] post3 = new int[4];
        int[] post4 = new int[4];
        string[] input = Console.ReadLine().Split();
        for (int i = 0; i < 4; i++)
        {
            post1[i] = int.Parse(input[i]);
        }
        input = Console.ReadLine().Split();
        for (int i = 0; i < 4; i++)
        {
            post2[i] = int.Parse(input[i]);
        }
        input = Console.ReadLine().Split();
        for (int i = 0; i < 4; i++)
        {
            post3[i] = int.Parse(input[i]);
        }
        input = Console.ReadLine().Split();
        for (int i = 0; i < 4; i++)
        {
            post4[i] = int.Parse(input[i]);
        }
        findGuardpost(m, post1, post2, post3, post4);
        Console.ReadKey();
    }

    public void findGuardpost(int m, int[] post1, int[] post2, int[] post3, int[] post4)
    {
        bool found = false;
        int i = 0;
        int j = 0;
        int k = 2;
        int addend1 = 0;
        int addend2 = 0;
        int[] mArr = new int[4];
        for (i = 0; i < 4; i++)
        {
            if (i == 0)
            {
                mArr = post1;
            } else if (i == 1)
            {
                mArr = post2;
            } else if (i == 2)
            {
                mArr = post3;
            } else
            {
                mArr = post4;
            }
            for (j = 0; j <= 1; j++)
            {
                addend1 = mArr[j];
                for (k = 2; k <= 3; k++)
                {
                    addend2 = mArr[k];
                    if (addend1 + addend2 <= m)
                    {
                        if (addend1 + addend2 < m)
                        {
                            int diff = m - (addend1 + addend2);
                            if (addend1 > addend2)
                            {
                                addend2 += diff;
                            }
                            else
                            {
                                addend1 += diff;
                            }
                        }
                        found = true;
                        break;
                    }
                }
                if (found)
                {
                    break;
                }
            }
            if (found)
            {
                break;
            }
        }
        if (found)
        {
            Console.WriteLine((i + 1) + " " + addend1 + " " + addend2);
        }
        else
        {
            Console.WriteLine("-1");
        }
    }
}


using System;

class P {
  static void Main() {
    var s = Console.ReadLine();
    var bestSub = "";
    var bestNum = -1;
    for (var i = 0; i < s.Length; s++) {
      var isGood = true;
      for (var j = i ; j < s.Length && isGood; j++) {
        isGood = isGood && (s[j] == '4' || s[j] == '7');
        if (!isGood) break;
        var n = 1;
        for (var k = i + 1; k < s.Length - (j-i+1) {
          var isGoodAsWell = true;
          for (var l = 0 ; l <= j-i && isGoodAsWell ; l++)
            isGoodAsWell = isGoodAsWell && s[k+l] == s[i+l];
          if (isGoodAsWell) n++;
        }
        var s2 = s.SubString(i, j+1-i);
        if (n > bestNum || (n==bestNum && s2 < bestSub)) {
          bestNum = n; bestSub = s2;
        }
      }
    }
    Console.Write(bestNum == -1? "-1" : bestSub);
  }
}


using System;
using System.Collections.Generic;
using System.Numerics;

namespace LuckySubstring
{
    class Program
    {
        static bool IsLucky(BigInteger n)
        {
            var num = n;
            while (num > 0)
            {
                var digit = num - (num / 10) * 10;
                if (digit != 4 && digit != 7) return false;
                num /= 10;
            }

            return true;
        }

        static void Main(string[] args)
        {
            var luckyNumbers = new List<BigInteger>();
            for (var n = 1; n <= 1000; n++)
            {
                if (IsLucky(n)) luckyNumbers.Add(n);
            }

            var answers = new Dictionary<BigInteger, BigInteger>();
            string input = Console.ReadLine();
            if (!string.IsNullOrEmpty(input))
            {
                for (var length=1; length<input.Length; length++)
                {
                    for (var pos=0; pos<=input.Length - length; pos++)
                    {
                        var strNum = input.Substring(pos, length);
                        var num = BigInteger.Parse(strNum);
                        if (IsLucky(num))
                        {
                            //Console.WriteLine("Found lucky number {0} of length {1}", num, length);
                            if (answers.ContainsKey(num))
                            {
                                answers[num]++;
                            } else
                            {
                                answers.Add(num, 1);
                            }
                        }
                    }
                }
            }

            var maxOcc = new BigInteger(0);
            foreach (var num in answers)
            {
                if (num.Value > maxOcc) maxOcc = num.Value;
            }
            var maxAnswers = new List<BigInteger>();
            foreach (var num in answers)
            {
                if (num.Value == maxOcc) maxAnswers.Add(num.Key);
            }
            //Console.WriteLine("MaxOcc = {0}", maxOcc);
            var lexMin = "99999999999999999999999999999999999999999999999999";
            foreach (var num in maxAnswers)
            {
                if (string.Compare(num.ToString(), lexMin) < 0) lexMin = num.ToString();
            }

            if (lexMin != "99999999999999999999999999999999999999999999999999")
                Console.WriteLine(lexMin);
            else Console.WriteLine("-1");
        }
    }
}


int num = 0;
string res = "No";
num = Convert.ToInt32(Console.ReadLine());

for (int i = 1; i < num - 1; i++) {
    for (int j = i; j < num - 1; j++) {
        if (num == i * ((i + 1) / 2) + (j * (j + 1) / 2))
            res = "Yes";
    }
}

Console.WriteLine("Is Funky = " + res);


using System; using System.Linq;

class P {
  static void Main () {

    var strs = new [] {
"George Washington, 1789-1797                                                           ",
"John Adams, 1797-1801                                                                ",
"Thomas Jefferson, 1801-1809                                                         ",
"James Madison, 1809-1817                                                           ",
"James Monroe, 1817-1825                                                          ",
"John Quincy Adams, 1825-1829                                                   ",
"Andrew Jackson, 1829-1837                                                    ",
"Martin Van Buren, 1837-1841                                                ",
"William Henry Harrison, 1841                                             ",
"John Tyler, 1841-1845                                                  ",
"James Knox Polk, 1845-1849                                            ",
"Zachary Taylor, 1849-1850                                           ",
"Millard Fillmore, 1850-1853                                       ",
"Franklin Pierce, 1853-1857                                      ",
"James Buchanan, 1857-1861                                     ",
"Abraham Lincoln, 1861-1865                                  ",
"Andrew Johnson, 1865-1869                                 ",
"Ulysses S. Grant, 1869-1877                             ",
"Rutherford Birchard Hayes, 1877-1881                  ",
"James Abram Garfield, 1881                          ",
"Chester Alan Arthur, 1881-1885                    ",
"Grover Cleveland, 1885-1889                     ",
"Benjamin Harrison, 1889-1893                  ",
"Grover Cleveland, 1893-1897                 ",
"William McKinley, 1897-1901               ",
"Theodore Roosevelt, 1901-1909           ",
"William Howard Taft, 1909-1913        ",
"Woodrow Wilson, 1913-1921           ",
"Warren Gamaliel Harding, 1921-1923",
"Calvin Coolidge, 1923-1929      ",
"Herbert Clark Hoover, 1929-1933",
"Franklin Delano Roosevelt, 1933-1945",
"Harry S. Truman, 1945-1953          ",
"Dwight David Eisenhower, 1953-1961    ",
"John Fitzgerald Kennedy, 1961-1963      ",
"Lyndon Baines Johnson, 1963-1969          ",
"Richard Milhous Nixon, 1969-1974            ",
"Gerald Rudolph Ford, 1974-1977                ",
"James Earl Carter, Jr., 1977-1981               ",
"Ronald Wilson Reagan, 1981-1989                   ",
"George Herbert Walker Bush, 1989-1993               ",
"William Jefferson Clinton, 1993-2001                  ",
"George Walker Bush, 2001-2009                          ",
"Barack Hussein Obama, 2009-                              ",
    var n = int.Parse(Console.ReadLine());
    var s = strs[n-1].Split(',')[0].Split(' ').Last();

    Console.Write(s);
  }
}


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

namespace Rank
{
    class Class3
    {
        public static void Main5(string[] args)
        {
            int l =int.Parse(Console.ReadLine());
            var str = Console.ReadLine();
            var ar = new int[l];
            int total = 0;
            for(int i = 0; i < l; i++)
            {
                int a = str[i] - '0';
                total += a;
                ar[i] = a;
            }
            if (total == 0)
            {
                Console.WriteLine("YES");
                return;
            }
            for(int i = 1; i <= total / 2 + 1; i++)
            {
                if (total % i != 0) continue;
                int st = 0;
                int j = 0;
                for(; j < l; j++)
                {
                    st += ar[j];
                    if (st == i)
                    {
                        st = 0;
                    }
                    else if (st < i) continue;
                    else
                    {
                        break;
                    }
                }
                if (st == 0)
                {
                    for (; j < l; j++)
                    {
                        if (ar[j] != 0) break;
                    }
                    if (j == l) { Console.WriteLine("YES"); return; }
                }
            }
            Console.WriteLine("NO");
        }

    }
}


 static void Main(string[] args)
        {
            int input = Convert.ToInt32(Console.ReadLine());
            int s = NextLuckyYear(input);
            Console.WriteLine(s.ToString());
        }

        static int NextLuckyYear(int year)
        {
            int luckyYear = 0;
            string sYear = year.ToString();
            if (sYear.Length == 1)
            {
                return 1;
            }
            string a = (Convert.ToInt32(sYear[0].ToString()) + 1).ToString();
            for (int i = 0; i < sYear.Length - 1; i++)
            {
                a += "0";
            }
            luckyYear = year - Convert.ToInt32(a);
            return luckyYear * -1;
        }


using System;namespace C{class A{static void Main(){String[] str = Console.ReadLine().Split();int f = Convert.ToInt32(str[0]);int it = Convert.ToInt32(str[1]);int th = Convert.ToInt32(str[2]);
char[][] arr = new char[f][];for (int i = 0; i < f; i++)arr[i] = Console.ReadLine().ToCharArray();int t = 0;for (int i=0;i<it;i++){int c=0;for (intj=0;j<f;j++)if (arr[j][i]== 'Y')c++;if (c>=th)t++;
}Console.Write(t);}}}//kitten


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

namespace Codeforces
{
    class Program
    {

        static void Main(string[] args) {
            int[] input = readInts();
            string[] s = new string[input[0]];
            for(int i = 0; i < input[0]; i++) {
                s[i] = Console.ReadLine();
            }
            int ans = 0;
            for(int c = 0; c < input[1]; c++) {
                int count = 0;
                for(int q = 0; q < input[0]; q++) {
                    if(s[q][c] == 'Y') {
                        count++;
                    }
                }
                if(count >= input[2]) {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


using System;

namespace CF242A
{
    class Squats
    {
        int n;
        String hamsters;

        public void Read ()
        {
            n = Convert.ToInt32 (Console.ReadLine ());
            hamsters = Console.ReadLine ();
        }

        public void Solve ()
        {
            counter = 0;
            for (int i = 0; i < n; i++)
                if (hamsters [i] == 'X')
                    counter++;
            Console.Write (Math.Abs (counter - n / 2));
        }
    }

    class MainClass
    {
        public static void Main (string[] args)
        {
            Squats problem = new Squats ();
            problem.Read ();
            problem.Solve ();
        }
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{0F695567-1A84-448C-B3C5-00F2C4482C03}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>prC</RootNamespace>
    <AssemblyName>prC</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</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|AnyCPU' ">
    <PlatformTarget>AnyCPU</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.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
    <None Include="input">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </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>


Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "A.Contest", "A.Contest\A.Contest.csproj", "{1E33F78A-68B3-42F4-A54D-07412C28A48F}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|x86 = Debug|x86
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{1E33F78A-68B3-42F4-A54D-07412C28A48F}.Debug|x86.ActiveCfg = Debug|x86
		{1E33F78A-68B3-42F4-A54D-07412C28A48F}.Debug|x86.Build.0 = Debug|x86
		{1E33F78A-68B3-42F4-A54D-07412C28A48F}.Release|x86.ActiveCfg = Release|x86
		{1E33F78A-68B3-42F4-A54D-07412C28A48F}.Release|x86.Build.0 = Release|x86
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;
public class CF{
    public static void Main(){
                    int n = int.Parse(Console.ReadLine());
            int xmin = int.MaxValue, ymin = int.MaxValue, xmax = int.MinValue, ymax = int.MinValue;
            for (int i = 0; i < n; i++)
			{
                var xy = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
                xmin = Math.Min(xy[0],xmin);
                ymin = Math.Min(xy[1],xmin);
                xmax = Math.Max(xy[0],xmax);
                ymax = Math.Max(xy[1],xmax);

			}
            Console.WriteLine(Math.Abs(xmax-xmin)*Math.Abs(ymax-ymin)>0?Math.Abs(xmax-xmin)*Math.Abs(ymax-ymin):-1);
            //Console.ReadKey();
    }
}


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

namespace CodeForces
{
    class Program
    {
        struct Matrix
        {
            public BigInteger A1, A2, A3, A4;

            public static Matrix Mul(Matrix m1, Matrix m2)
            {
                Matrix result = new Matrix();
                result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;
                result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;
                result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;
                result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;
                return result;
            }

            public void Mod(long mod)
            {
                A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;
            }

            public static Matrix PowerMod(long power, Matrix m, long mod)
            {
                Matrix modLast = m, result = new Matrix();

                while (power != 0)
                {
                    if ((power & 1) == 1)
                    {
                        if (result.A1 == 0)
                            result = modLast;
                        else
                            result = Matrix.Mul(result, modLast);

                        result.Mod(mod);
                    }

                    modLast = Matrix.Mul(modLast, modLast);
                    modLast.Mod(mod);
                    power >>= 1;
                }

                return result;
            }
        }

        struct Result
        {
            public long Index, Value;
            public int SIndex;
        }

        static void Main(string[] args)
        {
            long[] steps = new long[] { 60, 300, 1500, 15000, 150000, 1500000, 15000000, 150000000, 1500000000, 15000000000, 150000000000, 1500000000000, 15000000000000, 150000000000000, 1500000000000000, 15000000000000000 };
            long[] mods = new long[] { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000 };

            long n = Convert.ToInt64(Console.ReadLine());
            int index = 0;
            long modValue = n % mods[index];

            Queue<Result> queue = new Queue<Result>();
            long[] fs = new long[60]; fs[1] = 1;

            for (int i = 2; i < fs.Length; i++)
            {
                fs[i] = (fs[i - 1] + fs[i - 2]) % mods[index];
                if (fs[i] == modValue)
                    queue.Enqueue(new Result { Index = i, Value = fs[i], SIndex = index });
            }

            List<Result> result = new List<Result>();

            while (queue.Count > 0)
            {
                Result current = queue.Dequeue();

                if (current.Value == n && current.SIndex == 12)
                {
                    result.Add(current);
                    continue;
                }
                else if (current.SIndex > 12)
                    continue;

                for (int i = 0; i * steps[current.SIndex] < steps[current.SIndex + 1]; i++)
                {
                    long nIndex = i * steps[current.SIndex] + current.Index;
                    long value = Cal(nIndex, mods[current.SIndex + 1]);

                    if (value == n % mods[current.SIndex + 1])
                        queue.Enqueue(new Result { Index = nIndex, SIndex = current.SIndex + 1, Value = value });
                }
            }

            if (result.Count == 0)
                Console.WriteLine(-1);
            else
            {
                long sIndex = result.Select(x => x.Index).Min();
                Console.WriteLine(sIndex);
            }
        }

        static long Cal(long index, long mod)
        {
            Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };
            Matrix power = Matrix.PowerMod(index, m, mod);
            return (long)power.A2;
        }
    }
}


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

namespace Compete.CFE38 {
    public class TaskA : IProblem {
        public static void Main(string[] args) {
            new TaskA().Solve(Console.In, Console.Out);
        }

        public void Solve(TextReader input, TextWriter output) {
            // INPUT
            var n = int.Parse(input.ReadLine());
            var s = input.ReadLine();

            // SOLUTION
            var sb = new StringBuilder();
            bool prev = false;
            foreach (var c in s) {
                if (IsVowel(c)) {
                    if (!prev) {
                        prev = true;
                        sb.Append(c);
                    }
                }
                else {
                    prev = false;
                    sb.Append(c);
                }
            }

            // OUTPUT
            output.WriteLine(sb.ToString());
        }

        private static bool IsVowel(char c) => "aeiouy".Contains(c);
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static int ReadInt() => int.Parse(Console.ReadLine());
        static string ReadString() => Console.ReadLine();
        static int[] ReadIntArray() => (Console.ReadLine().Split(' ')).Select(int.Parse).ToArray();
        static double[] ReadDoubleArray() => (Console.ReadLine().Split(' ')).Select(double.Parse).ToArray();
        static long[] ReadLongArray() => (Console.ReadLine().Split(' ')).Select(long.Parse).ToArray();
        static List<int> ReadIntList() => (Console.ReadLine().Split(' ')).Select(int.Parse).ToList();
        static List<long> ReadLongList() => (Console.ReadLine().Split(' ')).Select(long.Parse).ToList();
        static char[] ReadCharArray() => (Console.ReadLine().Split(' ')).Select(char.Parse).ToArray();

        public struct P {
            int x;
            int y;
            public P(int x, int y)
            {
                this.x = x;
                this.y = y;
            }
        }

        static void Main(string[] args)
        {
             int n = ReadInt;
            string str = Console.ReadLine();

            int length = str.Length;

            int l = str.Where(a => a == '8').Count();

            int ans = 0;
            while (length >= 11 && l > 0)
            {
                ans++;
                length -= 11;
                l--;
            }

            Console.WriteLine(ans);

            Console.ReadLine();
        }

        private static int Foo(string s)
        {
            int ans = 0;
            if (s.Any(i => char.IsDigit(i))) ans++;
            if (s.Any(i => char.IsLower(i))) ans++;
            if (s.Any(i => char.IsUpper(i))) ans++;
            return ans;
        }
    }
}


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

namespace ForCodeForses
{
	class Program
	{
		static void Main(string[] args)
		{
			int n, s;
			n = Convert.ToInt32(Console.ReadLine());
			string line = Console.ReadLine();
			string[] arr = line.Split(' ');

			Array.Sort(arr);

			int[] f = arr.Select(ch = > int.Parse(ch.ToString())).ToArray();

			s = 1;

			for (int j = n - 1; j > 1; j--)
			{
				if (f[j - 1] != 0)
				{
					if (f[j] != f[j - 1])
						s++;
				}
				else break;
			}

			Console.WriteLine(s);
			Console.ReadKey();
		}
	}
}


class Module1 {

    static void Main() {
        Int64 n = Console.ReadLine;
        Int64 i = (Math.Sqrt(ShiftLeft(n, 1)) - 5);
        if ((i < 0)) {
            i = 0;
        }

        while (((i
                    * ((i + 1)
                    / 2))
                    <= n)) {
            i++;
        }

        Int64 ans = (i
                    - ((i
                    * ((i + 1)
                    / 2))
                    - n));
        if ((ans == 0)) {
            ans = (i - 1);
        }

        Console.WriteLine(ans);
    }
}


using System;

namespace MyApp
{

	class MyForm : Form
	{

		public static void Main()
		{
		int n=Convert.ToInt32(Console.ReadLine());
		int c=0,k=0,l=0;
		string s="";
		int[] a=new int[n+1];
		string[] q=new string[n+1];

		    for (int j=1; j<=n; j++)
		    {
		    a[j]=Convert.ToInt32(Console.ReadLine());
		    k=a[j];
		    if (a[j]<=9)
		    {
		    q[j]=a[j].ToString();
		    }
		    else
		    {
		    for (int i=9; i>=1; i--)
			{
			k=k-i;
			if (k>0)
			{
			l=k;
			s=i.ToString()+s;
			}
			q[j]=l.ToString()+s;
			}
			s="";
		    }
		    }
			for (int i=1; i<=n; i++)
		    {
		    Console.WriteLine(q[i]);
		    }
			Console.ReadKey();
		}
	}
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp4", "ConsoleApp4\ConsoleApp4.csproj", "{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{3B7F4C3F-6B88-46A2-B0A9-0B0CD010E181}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {65F1C66D-5F75-4DF1-9653-59C07F14E27E}
	EndGlobalSection
EndGlobal


    public class Program
    {
        public static void Main(string[] args)
        {
            var number = Convert.ToInt32(Console.ReadLine());
            Console.Write(number % 2);
        }
    }


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{C845BAA9-539D-4B68-AE7F-F777A4F5311A}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>D_CS</RootNamespace>
    <AssemblyName>D_CS</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</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|AnyCPU' ">
    <PlatformTarget>AnyCPU</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.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Numerics;
using static Template;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pi = System.ValueTuple<int, int>;

class Solver
{
    public void Solve(Scanner sc)
    {
        var (N, s) = (sc.Int, sc.Str);
        WriteLine(N + 1);
    }

    public List<(T item, int len)> RLEncoding<T>(IList<T> list, Comparison<T> cmp = null)
    {
        cmp ??= Comparer<T>.Default.Compare;
        var rt = new List<(T, int)> { (list[0], 1) };
        for (var i = 1; i < list.Count; i++)
            if (cmp(rt[1].Item1, list[i]) == 0)
                rt[1] = (rt[1].Item1, rt[1].Item2 + 1);
            else rt.Add((list[i], 1));
        return rt;
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve(new Scanner());
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    //public static int PopCount(int n) => (int)System.Runtime.Intrinsics.X86.Popcnt.PopCount((uint)n);
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}

public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    //public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ').AsSpan()[..]) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
}

#endregion