using System;
namespace CodeForces
{
    public class A
    {
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();
            long n = Convert.ToInt64(s);
            n++;
            int ans = 1;
            if ((n+"").IndexOf('8') == -1)
            {
                n++;
                ans++;
            }
            Console.WriteLine(n);
        }
    }
}
/*


Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "488A", "488A\488A.csproj", "{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|x86 = Debug|x86
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Debug|x86.ActiveCfg = Debug|x86
		{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Debug|x86.Build.0 = Debug|x86
		{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Release|x86.ActiveCfg = Release|x86
		{94B514C4-137B-473D-A7F0-1E7D8E8A3CEF}.Release|x86.Build.0 = Release|x86
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;
using System.Linq;

class B723 {
    public static void Main() {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        var ss = s.Split('(', ')');
        int answer1 = 0, answer2 = 0;
        for (int i = 0; i < ss.Length; i += 2) {
            var opts = StringSplitOptions.RemoveEmptyEntries;
            var sss = ss[i].Split(new char[] { '_' }, opts);
            foreach (var j in sss)
                if (answer1 < j.Length) answer1 = j.Length;
        }
        for (int i = 1; i < ss.Length; i += 2) {
            var sss = ss[i].Split(new char[] { '_' }, opts);
            answer2 += sss.Length;
        }
        Console.WriteLine($"{answer1} {answer2}");
    }
}


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

namespace XkcdComics
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = Int32.Parse(Console.ReadLine());
            var text = Console.ReadLine();
            int cursor = 0;
            bool inBrackets = false;
            bool isWordChar = false;
            int wordsInBrackets = 0;
            int maxWordOutBrackets = 0;
            int curentWordOutBrackets = 0;

            foreach (var item in text)
            {
                if (item == '(')
                {

                    if (isWordChar)
                        if (curentWordOutBrackets > maxWordOutBrackets)
                        {
                            maxWordOutBrackets = curentWordOutBrackets;

                        }
                    isWordChar = false;
                    inBrackets = true;
                    curentWordOutBrackets = 0;
                }
                else if(item == ')')
                {
                    if (isWordChar)
                        wordsInBrackets++;
                    inBrackets = false;
                    isWordChar = false;
                }

                else if(item == '_')
                {
                    if (isWordChar)
                        if(inBrackets)
                        {
                            wordsInBrackets++;
                        }
                        else
                        {
                            if (curentWordOutBrackets > maxWordOutBrackets)
                                maxWordOutBrackets = curentWordOutBrackets;
                            curentWordOutBrackets = 0;
                        }
                    isWordChar = false;
                }
                else
                {
                    isWordChar = true;
                    if (!inBrackets)
                        curentWordOutBrackets++;
                }
            };

            Console.WriteLine($"{maxWordOutBrackets} {wordsInBrackets} ");
            Console.ReadKey();
        }
    }
}


using System;
using System.Drawing;

namespace CF_1028_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Rectangle[] a = new Rectangle[n];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split();
                int x = int.Parse(s[0]);
                int y = int.Parse(s[1]);
                int x1 = int.Parse(s[2]);
                int y1 = int.Parse(s[3]);
                a[i] = new Rectangle(x, y, x1-x, y1-y);
            }

            for (int i = 0; i < n; i++)
            {
                Rectangle b = a[i];
                int count = 0;
                for (int j = 0; j < n; j++)
                {
                    if (i == j) continue;

                    if (b.IntersectsWith(a[j]))
                    {
                        count++;
                        b.Intersect(a[j]);
                    }
                }

                if (count == n - 1)
                {
                    Console.WriteLine(b.Left + " " + b.Top);
                    return;
                }
            }
        }
    }
}


//#define TESTCASES
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

namespace HackerEarth
{
    /// <summary>
    /// Solution class
    /// </summary>
    internal static class Program
    {
        #region Main
        /// <summary>
        /// Modulo operator used in a lot of questions
        /// </summary>
        private const long mod = 1000000007L;

        /// <summary>
        /// Fast Console IO helper
        /// </summary>
        private static ConsoleHelper Console { get; } = new ConsoleHelper();

        /// <summary>
        /// Main method - Launches solver
        /// </summary>
        private static void Main()
        {
            using (Console)
            {
#if DEBUG
                Stopwatch timer = Stopwatch.StartNew();
#endif

#if TESTCASES
                TestCases();
#else //!TESTCASES
                Solve();
#endif
#if DEBUG
                timer.Stop();
                Console.Write($"\r\nTotal run time: {timer.Elapsed.TotalSeconds:0.000}s");
#endif
            }
        }

#if TESTCASES
        /// <summary>
        /// Solves the problem for multiple test cases
        /// </summary>
        private static void TestCases()
        {
            int t = Console.NextInt();
            Console.SkipNextLine();

            while (t-- > 0)
            {
                Solve();
            }
        }

#endif
        #endregion

        #region Solution

        /// <summary>
        /// Solution
        /// </summary>
        private static void Solve()
        {

            int l=Console.NextInt();
            int r=Console.NextInt();
			int x=Console.NextInt();
			int y=Console.NextInt();
            int k=Console.NextInt();
			int t=0;
         while(x<=y)
		 {
		 int mid=x+(y-x)/2;
		 if(mid*k>r)
		 y=mid-1;
		 if(mid*x<l)
		 x=mid+1;
		 else
		 {
		 t=1;
		 break;
		 }
		 if(t==0)
		 Console.WriteLine("NO");
		 else
		 Consoel.WriteLine("YES");

		 }

        }
        #endregion
    }

    #region Tools
    //Solution does not extend beyond this point, those are merely tools to help along
    /// <summary>
    /// Fast Console IO helper
    /// </summary>
    [DebuggerStepThrough]
    internal sealed class ConsoleHelper : IDisposable
    {
        #region Constants
        /// <summary>
        /// The standard input and output buffers size (2^20, 1Mb)
        /// </summary>
        private const int baseSize = 1048576;
        /// <summary>
        /// Integer out string conversion buffer
        /// </summary>
        private static readonly char[] numBuffer = new char[20];
        #endregion

        #region Fields
        private readonly BufferedStream inStream; //Buffered console input stream
        private readonly StreamWriter outStream; //Buffered console output stream

        private readonly byte[] inBuffer; //Input buffer
        private int inputIndex; //Input buffer current index
        private int bufferEnd; //Input buffer ending index
        #endregion

        #region Properties
        /// <summary>
        /// The buffer size, in bytes
        /// </summary>
        public int BufferSize { get; }

        /// <summary>
        /// If this memory stream is open and available to read/write
        /// </summary>
        public bool Open { get; private set; }
        #endregion

        #region Constructors
        /// <summary>
        /// Creates a new console IO helper reading from the standard Console input and output
        /// </summary>
        public ConsoleHelper() : this(baseSize) { }

        /// <summary>
        /// Creates a new console IO helper reading from the standard Console input and output with the specified buffer size
        /// <param name="bufferSize">Size of the buffer to use in bytes</param>
        /// </summary>
        public ConsoleHelper(int bufferSize)
        {
            //Open the input/output streams
#if DEBUG
            //Test mode
            this.inStream = new BufferedStream(File.OpenRead(@"..\..\input.txt"), bufferSize);
            this.outStream = new StreamWriter(File.Create(@"..\..\output.txt", bufferSize), Encoding.ASCII, bufferSize);
#else //!DEBUG
//Submission mode
            this.inStream = new BufferedStream(Console.OpenStandardInput(bufferSize), bufferSize); //Submission stream
            this.outStream = new StreamWriter(Console.OpenStandardOutput(bufferSize), Encoding.ASCII, bufferSize);
#endif

            //Set fields
            this.inBuffer = new byte[bufferSize];
            this.inputIndex = this.bufferEnd = 0;
            this.BufferSize = bufferSize;
            this.Open = true;
        }
        #endregion

        #region Static methods
        /// <summary>
        /// Verifies that the passed character is a non-special ASCII character
        /// </summary>
        /// <param name="i">Character to validate</param>
        /// <returns>True if the character is not a special character</returns>
        public static bool ValidateChar(int i) => i >= ' ';

        /// <summary>
        /// Verifies that the passed character is a non-special ASCII character or a whitespace
        /// </summary>
        /// <param name="i">Character to validate</param>
        /// <returns>True if the character is not a whitespace or a special character</returns>
        public static bool ValidateCharNoSpace(int i) => i > ' ';

        /// <summary>
        /// Verifies that the passed character is a numerical character (0-9)
        /// </summary>
        /// <param name="i">Character to validate</param>
        /// <returns>True if the character is a numerical character, false otherwise</returns>
        public static bool ValidateNumber(int i) => i >= '0' && i <= '9';

        /// <summary>
        /// Verifies if a character is an Endline character
        /// </summary>
        /// <param name="i">Character to check</param>
        /// <returns>True if it is an Endline character, false otherwise</returns>
        public static bool IsEndline(int i) => i == '\n' || i == '\0';

        /// <summary>
        /// Takes a signed int value and copies it's characters at the end of the integer char buffer
        /// </summary>
        /// <param name="n">Int to write to the buffer</param>
        /// <returns>Head index at which the buffer's writing starts</returns>
        private static int GetIntBuffer(int n)
        {
            int head = 20;
            bool neg;
            if (n < 0)
            {
                neg = true;
                n = -n;
            }
            else { neg = false; }

            do
            {
                numBuffer[--head] = (char)((n % 10) + 48);
                n /= 10;
            }
            while (n > 0);

            if (neg) { numBuffer[--head] = '-'; }
            return head;
        }

        /// <summary>
        /// Takes a signed long value and copies it's characters at the end of the integer char buffer
        /// </summary>
        /// <param name="n">Long to write to the buffer</param>
        /// <returns>Head index at which the buffer's writing starts</returns>
        private static int GetLongBuffer(long n)
        {
            int head = 20;
            bool neg;
            if (n < 0L)
            {
                neg = true;
                n = -n;
            }
            else { neg = false; }

            do
            {
                numBuffer[--head] = (char)((n % 10L) + 48L);
                n /= 10L;
            }
            while (n > 0L);

            if (neg) { numBuffer[--head] = '-'; }
            return head;
        }
        #endregion

        #region Methods
        /// <summary>
        /// Returns the next byte data in the console input stream
        /// </summary>
        /// <returns>Next data byte from the console</returns>
        public byte Read()
        {
            CheckBuffer();
            return this.inBuffer[this.inputIndex++];
        }

        /// <summary>
        /// Returns the next byte data in the console input stream without consuming it
        /// </summary>
        /// <returns>Next data byte from the console</returns>
        public byte Peek()
        {
            CheckBuffer();
            return this.inBuffer[this.inputIndex];
        }

        /// <summary>
        /// Skips a number of characters in the input stream
        /// </summary>
        /// <param name="n">Amount of chars to skip, defaults to 1</param>
        public void Skip(int n = 1) => this.inputIndex += n;

        /// <summary>
        /// Assures we have data available in the input buffer
        /// </summary>
        private void CheckBuffer()
        {
            //If we reach the end of the buffer, load more data
            if (this.inputIndex >= this.bufferEnd)
            {
                this.inputIndex = this.inputIndex - this.bufferEnd;
                this.bufferEnd = this.inStream.Read(this.inBuffer, 0, this.BufferSize);

                //If nothing was added, add a null char at the start
                if (this.bufferEnd < 1) { this.inBuffer[this.bufferEnd++] = 0; }
            }
        }

        /// <summary>
        /// Returns the next character in the console input stream
        /// </summary>
        /// <returns>Next character in the input stream</returns>
        public char NextChar() => (char)Read();

        /// <summary>
        /// Returns the next string token from the console input
        /// </summary>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <returns>Parsed string, separated by spaces or special characters such as line feeds</returns>
        public string Next()
        {
            byte b = SkipInvalid();
            ValidateEndline(b);

            //Append all characters
            StringBuilder sb = new StringBuilder().Append((char)b);
            b = Peek();
            while (ValidateCharNoSpace(b))
            {
                //Peek to not consume terminator
                sb.Append((char)b);
                Skip();
                b = Peek();
            }

            return sb.ToString();
        }

        /// <summary>
        /// Returns the next int value in the console input, this is a fast parse
        /// </summary>
        /// <exception cref="FormatException">If the text is not a valid integer</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for integer</exception>
        /// <returns>Parsed int value from the input</returns>
        public int NextInt()
        {
            //Skip invalids
            byte b = SkipInvalid();
            ValidateEndline(b);

            //Verify for negative
            bool neg = false;
            if (b == '-')
            {
                neg = true;
                b = Read();
            }

            //Get first digit
            if (!ValidateNumber(b)) { throw new FormatException("Integer parsing has failed because the string contained invalid characters"); }

            int n = b - '0';
            b = Peek();
            while (ValidateNumber(b))
            {
                //Peek to not consume terminator, and check for overflow
                n = checked((n << 3) + (n << 1) + (b - '0'));
                Skip();
                b = Peek();
            }
            //If the character causing the exit is a valid ASCII character, the integer isn't correct formatted
            if (ValidateCharNoSpace(b)) { throw new FormatException("Integer parsing has failed because the string contained invalid characters"); }

            return neg ? -n : n;
        }

        /// <summary>
        /// Returns the next long value in the console input, this is a fast parse
        /// </summary>
        /// <exception cref="FormatException">If the text is not a valid long</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for long</exception>
        /// <returns>Parsed long value from the input</returns>
        public long NextLong()
        {
            byte b = SkipInvalid();
            ValidateEndline(b);

            //Verify negative
            bool neg = false;
            if (b == '-')
            {
                neg = true;
                b = Read();
            }

            //Get first digit
            if (!ValidateNumber(b)) { throw new FormatException("Integer parsing has failed because the string contained invalid characters"); }

            long n = b - '0';
            b = Peek();
            while (ValidateNumber(b))
            {
                //Peek to not consume terminator, and check for overflow
                n = checked((n << 3) + (n << 1) + (b - '0'));
                Skip();
                b = Peek();
            }
            //If the character causing the exit is a valid ASCII character, the long isn't correct formatted
            if (ValidateCharNoSpace(b)) { throw new FormatException("Long parsing has failed because the string contained invalid characters"); }

            return neg ? -n : n;
        }

        /// <summary>
        /// Returns the next double value in the console input
        /// Note: fast double parsing is slightly harder, I'll implement it if I need to
        /// </summary>
        /// <exception cref="FormatException">If the text is not a valid double</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for double</exception>
        /// <returns>Parsed double value from the input</returns>
        public double NextDouble() => double.Parse(Next());

        /// <summary>
        /// Returns the next n int values on the same line in an array
        /// </summary>
        /// <param name="n">Number of values to seek</param>
        /// <exception cref="FormatException">If the text is not a valid integer</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for integer</exception>
        /// <exception cref="OutOfMemoryException">If the created array is too large for the system memory</exception>
        /// <returns>The n integer values in an array</returns>
        public int[] NextInts(int n)
        {
            int[] array = new int[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = NextInt();
            }

            SkipNextLine();
            return array;
        }

        /// <summary>
        /// Returns the next n long values on the same line in an array
        /// </summary>
        /// <param name="n">Number of values to seek</param>
        /// <exception cref="FormatException">If the text is not a valid long</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for long</exception>
        /// <exception cref="OutOfMemoryException">If the created array is too large for the system memory</exception>
        /// <returns>The n long values in an array</returns>
        public long[] NextLongs(int n)
        {
            long[] array = new long[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = NextLong();
            }

            SkipNextLine();
            return array;
        }

        /// <summary>
        /// Returns the next n int values on the next m lines in the output stream under the form of an NxM matrix
        /// </summary>
        /// <param name="n">Number of rows to the matrix</param>
        /// <param name="m">Number of columns to the matrix</param>
        /// <exception cref="FormatException">If the text is not a valid integer</exception>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        /// <exception cref="OverflowException">If the value is too large for integer</exception>
        /// <exception cref="OutOfMemoryException">If the created 2D array is too large for the system memory</exception>
        /// <returns>The NxM matrix of integers</returns>
        public int[,] NextMatrix(int n, int m)
        {
            int[,] matrix = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    matrix[i, j] = NextInt();
                }

                SkipNextLine();
            }

            return matrix;
        }

        /// <summary>
        /// Returns the next line of text in the console
        /// </summary>
        /// <returns>Next string line from the console</returns>
        public string NextLine()
        {
            byte b = SkipInvalid();
            if (b == 0)
            {
                //Consume newline and return empty string
                Skip();
                return string.Empty;
            }

            //Read all the characters until the next linefeed
            StringBuilder sb = new StringBuilder().Append((char)b);
            b = Read();
            while (!IsEndline(b))
            {
                //Don't append special characters, but don't exit
                if (ValidateChar(b))
                {
                    sb.Append((char)b);
                }
                b = Read();
            }

            return sb.ToString();
        }

        /// <summary>
        /// Skips the next token in input
        /// </summary>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        public void SkipNext()
        {
            byte b = SkipInvalid();
            ValidateEndline(b);

            for (b = Peek(); ValidateCharNoSpace(b); b = Peek())
            {
                Skip();
            }
        }

        /// <summary>
        /// Skips all the text on the current line and jump to the next
        /// </summary>
        public void SkipNextLine()
        {
            for (byte b = Read(); !IsEndline(b); b = Read()) { }
        }

        /// <summary>
        /// Enumerates the given number of integers on the current line
        /// </summary>
        /// <param name="n">Number of integers on the current line</param>
        /// <returns>Enumerable of the integers</returns>
        public IEnumerable<int> EnumerateInts(int n)
        {
            while (n-- > 0)
            {
                yield return NextInt();
            }

            SkipNextLine();
        }

        /// <summary>
        /// Enumerates all the characters in the next line until the feed is exhausted or an endline character is met
        /// </summary>
        /// <returns>Enumerable of all the characters in the current line</returns>
        public IEnumerable<char> EnumerateLine()
        {
            for (char c = NextChar(); !IsEndline(c); c = NextChar())
            {
                if (ValidateChar(c))
                {
                    yield return c;
                }
            }
        }

        /// <summary>
        /// Assures we are not trying to read more data on the line that there exists
        /// </summary>
        /// <param name="b">Byte data to verify</param>
        /// <exception cref="InvalidOperationException">If there is no more data on the line being read</exception>
        private void ValidateEndline(byte b)
        {
            //If empty char
            if (b == 0)
            {
                //Go back a char and throw
                this.inputIndex--;
                throw new InvalidOperationException("No values left on line");
            }
        }

        /// <summary>
        /// Skips all invalid character bytes then returns the first valid byte found, spaces are considered invalid
        /// </summary>
        /// <returns>The next valid character byte, cannot be a whitespace</returns>
        private byte SkipInvalid()
        {
            byte b = Peek();
            if (IsEndline(b)) { return 0; }

            while (!ValidateCharNoSpace(b))
            {
                Skip();
                b = Peek();
                //Return empty char if we meet an linefeed or empty char
                if (IsEndline(b)) { return 0; }
            }

            return Read();
        }

        /// <summary>
        /// Writes the given char to the console output
        /// </summary>
        /// <param name="c">Character to write</param>
        public void Write(char c) => this.outStream.Write(c);

        /// <summary>
        /// Writes the given char buffer to the console output
        /// </summary>
        /// <param name="buffer">Char buffer to write</param>
        public void Write(char[] buffer) => this.outStream.Write(buffer);

        /// <summary>
        /// Writes the given string to the console output
        /// </summary>
        /// <param name="s">String to write</param>
        public void Write(string s) => this.outStream.Write(s);

        /// <summary>
        /// Writes the given integer to the console output
        /// </summary>
        /// <param name="n">Integer to write</param>
        public void Write(int n)
        {
            int head = GetIntBuffer(n);
            this.outStream.Write(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the given long to the console output
        /// </summary>
        /// <param name="n">Long to write</param>
        public void Write(long n)
        {
            int head = GetLongBuffer(n);
            this.outStream.Write(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the contents of the StringBuilder to the console output
        /// </summary>
        /// <param name="sb">StringBuilder to write to the output</param>
        public void Write(StringBuilder sb) => this.outStream.Write(sb.ToCharArray());

        /// <summary>
        /// Writes the given object to the console output using the object's ToString method
        /// </summary>
        /// <param name="o">Object to write</param>
        public void Write(object o) => this.outStream.Write(o);

        /// <summary>
        /// Writes a sequence to the console output with the given string separator
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">String separator between each element, defaults to the empty string</param>
        public void Write<T>(IEnumerable<T> e, string separator = "") => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes a sequence to the console output with the given string separator
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">Character separator between each element</param>
        public void Write<T>(IEnumerable<T> e, char separator) => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes a linefeed to the console output
        /// </summary>
        public void WriteLine() => this.outStream.WriteLine();

        /// <summary>
        /// Writes the given char to the console output, followed by a linefeed
        /// </summary>
        /// <param name="c">Character to write</param>
        public void WriteLine(char c) => this.outStream.WriteLine(c);

        /// <summary>
        /// Writes the given char buffer to the console output, followed by a linefeed
        /// </summary>
        /// <param name="buffer">Char buffer to write to the output</param>
        public void WriteLine(char[] buffer) => this.outStream.WriteLine(buffer);

        /// <summary>
        /// Writes the given string to the console output, followed by a linefeed
        /// </summary>
        /// <param name="s">String to write</param>
        public void WriteLine(string s) => this.outStream.WriteLine(s);

        /// <summary>
        /// Writes the given integer to the console output, followed by a linefeed
        /// </summary>
        /// <param name="n">Integer to write</param>
        public void WriteLine(int n)
        {
            int head = GetIntBuffer(n);
            this.outStream.WriteLine(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the given long to the console output, followed by a linefeed
        /// </summary>
        /// <param name="n">Long to write</param>
        public void WriteLine(long n)
        {
            int head = GetLongBuffer(n);
            this.outStream.WriteLine(numBuffer, head, 20 - head);
        }

        /// <summary>
        /// Writes the contents of the StringBuilder to the console output, followed by a linefeed
        /// </summary>
        /// <param name="sb">StringBuilder to write to the output</param>
        public void WriteLine(StringBuilder sb) => this.outStream.WriteLine(sb.ToCharArray());

        /// <summary>
        /// Writes a sequence to the console output with the given string separator, follows by a linefeed
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">String separator between each element, defaults to the empty string</param>
        public void WriteLine<T>(IEnumerable<T> e, string separator = "") => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes a sequence to the console output with the given string separator, follows by a linefeed
        /// </summary>
        /// <typeparam name="T">Type of elements in the sequence</typeparam>
        /// <param name="e">Sequence to print</param>
        /// <param name="separator">Character separator between each element</param>
        public void WriteLine<T>(IEnumerable<T> e, char separator) => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());

        /// <summary>
        /// Writes the given object to the console output using the object's ToString method, followed by a linefeed
        /// </summary>
        /// <param name="o">Object to write</param>
        public void WriteLine(object o) => this.outStream.WriteLine(o);

        /// <summary>
        /// Flushes the output buffer to the console if the buffer is full, or if it's being forced
        /// </summary>
        public void Flush() => this.outStream.Flush();

        /// <summary>
        /// Disposes of the resources of this ConsoleHelper, closing all the associated streams
        /// </summary>
        public void Dispose()
        {
            if (this.Open)
            {
                Flush();
                this.inStream.Dispose();
                this.outStream.Dispose();
                this.Open = false;
            }
        }
        #endregion
    }

    /// <summary>
    /// Useful extensions
    /// </summary>
    internal static class Extensions
    {
        #region Enumerable extensions
        /// <summary>
        /// Applies an action on each member of the enumerable
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="action">Action to apply to each parameter</param>
        public static void ForEach<T>(this IEnumerable<T> e, Action<T> action)
        {
            foreach (T t in e)
            {
                action(t);
            }
        }

        /// <summary>
        /// Joins all the elements of the enumerable into a string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="separator">Separator string, defaults to the empty string</param>
        public static string Join<T>(this IEnumerable<T> e, string separator = "") => new StringBuilder().AppendJoin(e, separator).ToString();

        /// <summary>
        /// Joins all the elements of the enumerable into a string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="separator">Separator character</param>
        public static string Join<T>(this IEnumerable<T> e, char separator) => new StringBuilder().AppendJoin(e, separator).ToString();

        /// <summary>
        /// Finds the object with the maximum value in the enumerable
        /// </summary>
        /// <typeparam name="T">Type of objects in the Enumerable</typeparam>
        /// <typeparam name="TU">Comparing type, must implement IComparable(T)</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="selector">Function calculating the value that we want the max from</param>
        /// <returns>The object with the maximum value in the enumerable</returns>
        public static T MaxValue<T, TU>(this IEnumerable<T> e, Func<T, TU> selector) where TU : IComparable<TU>
        {
            using (IEnumerator<T> enumerator = e.GetEnumerator())
            {
                if (!enumerator.MoveNext()) { throw new InvalidOperationException("No elements in sequence"); }

                T max = enumerator.Current;
                TU value = selector(max);
                while (enumerator.MoveNext())
                {
                    TU v = selector(enumerator.Current);
                    if (value.CompareTo(v) < 0)
                    {
                        max = enumerator.Current;
                        value = v;
                    }
                }

                return max;
            }
        }

        /// <summary>
        /// Finds the object with the minimum value in the enumerable
        /// </summary>
        /// <typeparam name="T">Type of objects in the Enumerable</typeparam>
        /// <typeparam name="TU">Comparing type, must implement IComparable(T)</typeparam>
        /// <param name="e">Enumerable to loop through</param>
        /// <param name="selector">Function calculating the value that we want the min from</param>
        /// <returns>The object with the minimum value in the enumerable</returns>
        public static T MinValue<T, TU>(this IEnumerable<T> e, Func<T, TU> selector) where TU : IComparable<TU>
        {
            using (IEnumerator<T> enumerator = e.GetEnumerator())
            {
                if (!enumerator.MoveNext()) { throw new InvalidOperationException("No elements in sequence"); }

                T min = enumerator.Current;
                TU value = selector(min);
                while (enumerator.MoveNext())
                {
                    TU v = selector(enumerator.Current);
                    if (value.CompareTo(v) > 0)
                    {
                        min = enumerator.Current;
                        value = v;
                    }
                }

                return min;
            }
        }
        #endregion

        #region String extensions
        /// <summary>
        /// Appends multiple objects to a StringBuilder, separated by the given string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="sb">StringBuilder to append to</param>
        /// <param name="source">Enumerable to loop through</param>
        /// <param name="separator">Separator string, defaults to the empty string</param>
        /// <returns>The StringBuilder instance after the appending is done</returns>
        public static StringBuilder AppendJoin<T>(this StringBuilder sb, IEnumerable<T> source, string separator = "")
        {
            using (IEnumerator<T> e = source.GetEnumerator())
            {
                if (e.MoveNext())
                {
                    sb.Append(e.Current);
                    while (e.MoveNext())
                    {
                        sb.Append(separator).Append(e.Current);
                    }
                }
            }

            return sb;
        }

        /// <summary>
        /// Appends multiple objects to a StringBuilder, separated by the given string
        /// </summary>
        /// <typeparam name="T">Type of elements in the Enumerable</typeparam>
        /// <param name="sb">StringBuilder to append to</param>
        /// <param name="source">Enumerable to loop through</param>
        /// <param name="separator">Separator character</param>
        /// <returns>The StringBuilder instance after the appending is done</returns>
        public static StringBuilder AppendJoin<T>(this StringBuilder sb, IEnumerable<T> source, char separator)
        {
            using (IEnumerator<T> e = source.GetEnumerator())
            {
                if (e.MoveNext())
                {
                    sb.Append(e.Current);
                    while (e.MoveNext())
                    {
                        sb.Append(separator).Append(e.Current);
                    }
                }
            }

            return sb;
        }

        /// <summary>
        /// Returns true if the string is null, or the empty string ""
        /// Note: this will never throw a NullRef exception given that it is an extension method calling a static method
        /// </summary>
        /// <param name="s">String to test</param>
        /// <returns>True if the string is null or empty, false otherwise</returns>
        public static bool IsEmpty(this string s) => string.IsNullOrEmpty(s);

        /// <summary>
        /// Creates a substring from a starting and ending index
        /// </summary>
        /// <param name="s">String to substring</param>
        /// <param name="start">Starting index</param>
        /// <param name="end">Ending index</param>
        /// <returns>The resulting substring</returns>
        public static string SubStr(this string s, int start, int end) => s.Substring(start, (end - start) + 1);

        /// <summary>
        /// Copies the contents of a StringBuilder instance to an array
        /// </summary>
        /// <param name="sb">StringBuilder to copy</param>
        /// <returns>Contents array of the StringBuilder</returns>
        public static char[] ToCharArray(this StringBuilder sb)
        {
            char[] buffer = new char[sb.Length];
            sb.CopyTo(0, buffer, 0, sb.Length);
            return buffer;
        }
        #endregion

        #region Number extensions
        /// <summary>
        /// Tests if the given number is even or not
        /// </summary>
        /// <param name="n">Number to test</param>
        /// <returns>True if the number is pair, false otherwise</returns>
        public static bool IsEven(this int n) => (n & 1) == 0;

        /// <summary>
        /// Tests if the given number is Even or not
        /// </summary>
        /// <param name="n">Number to test</param>
        /// <returns>True if the number is pair, false otherwise</returns>
        public static bool IsEven(this long n) => (n & 1L) == 0;

        /// <summary>
        /// Real Modulus function over the integer, not a remainder function like the normal C# mod
        /// </summary>
        /// <param name="n">Left operand of the mod</param>
        /// <param name="m">Right operand of the mod</param>
        /// <returns>The Modulus of n and m, within [0, m - 1]</returns>
        public static int Mod(this int n, int m) => ((n % m) + m) % m;

        /// <summary>
        /// Real Modulus function over the integer, not a remainder function like the normal C# mod
        /// </summary>
        /// <param name="n">Left operand of the mod</param>
        /// <param name="m">Right operand of the mod</param>
        /// <returns>The Modulus of n and m, within [0, m - 1]</returns>
        public static long Mod(this long n, long m) => ((n % m) + m) % m;

        /// <summary>
        /// Counts the amount of set bits (1s in the binary representation) of a given integer
        /// </summary>
        /// <param name="n">Integer to get the set bits from</param>
        /// <returns>Amount of set bits of the integer</returns>
        public static int SetBits(this int n)
        {
            n = n - ((n >> 1) & 0x55555555);
            n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
            return (((n + (n >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
        }

        /// <summary>
        /// Counts the amount of set bits (1s in the binary representation) of a given long
        /// </summary>
        /// <param name="n">Long to get the set bits from</param>
        /// <returns>Amount of set bits of the long</returns>
        public static long SetBits(this long n)
        {
            n = n - ((n >> 1) & 0x5555555555555555);
            n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333);
            return (((n + (n >> 4)) & 0xF0F0F0F0F0F0F0F) * 0x101010101010101) >> 56;
        }
        #endregion

        #region Array extensions
        /// <summary>
        /// Does a binary search through the sorted array to find the requested value
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>The index of the found element, or -1 if it wasn't found</returns>
        public static int BinarySearch<T>(this T[] array, T value) => Array.BinarySearch(array, value);

        /// <summary>
        /// Clears the array of all elements
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to clear</param>
        public static void Clear<T>(this T[] array) => Array.Clear(array, 0, array.Length);

        /// <summary>
        /// Determines if the array contains the given value
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>True if the value was found, false otherwise</returns>
        public static bool Contains<T>(this T[] array, T value) => Array.IndexOf(array, value) != -1;

        /// <summary>
        /// Enumerates the contents of an ArraySegment
        /// </summary>
        /// <typeparam name="T">Type contained within the array</typeparam>
        /// <param name="array">Array to iterate through</param>
        /// <param name="offset">Index offset to start the iteration at, defaults to 0</param>
        /// <param name="count">Amount of values to return, default to the whole array</param>
        /// <returns>Enumerable of all the values contained in the ArraySegment</returns>
        public static IEnumerable<T> Enumerate<T>(this T[] array, int offset = 0, int count = 0)
        {
            if (count == 0) { count = array.Length - offset; }

            int max = offset + count;
            for (int i = offset; i < max; i++)
            {
                yield return array[i];
            }
        }

        /// <summary>
        /// Sees if an elements matching the specified condition exists in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="match">Matching function to apply</param>
        /// <returns>True if a matching element exists, false otherwise</returns>
        public static bool Exists<T>(this T[] array, Predicate<T> match) => Array.Exists(array, match);

        /// <summary>
        /// Finds the first element matching the given condition in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="match">Matching function to apply</param>
        /// <returns>The first found element that satisfied the match, or default(T) if none did</returns>
        public static T Find<T>(this T[] array, Predicate<T> match) => Array.Find(array, match);

        /// <summary>
        /// Finds the last element matching the given condition in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="match">Matching function to apply</param>
        /// <returns>The last found element that satisfied the match, or default(T) if none did</returns>
        public static T FindLast<T>(this T[] array, Predicate<T> match) => Array.FindLast(array, match);

        /// <summary>
        /// Applies an action to every member of the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to loop through</param>
        /// <param name="action">Action to apply on each member</param>
        public static void ForEach<T>(this T[] array, Action<T> action) => Array.ForEach(array, action);

        /// <summary>
        /// Generates all the subsets of the given array of a size greater than or equal 1
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to get the subsets from</param>
        /// <returns>All the subsets of size 1 or greater from the array</returns>
        public static IEnumerable<List<T>> GetSubsets<T>(this T[] array)
        {
            int max = 1 << array.Length, l = array.Length - 1;
            for (int i = 1; i < max; i++)
            {
                if ((i & -i) == i) { continue; } //Exclude subsets of length 1

                List<T> subset = new List<T>(array.Length);
                subset.AddRange(array.Where((t, j) => (i & (1 << (l - j))) != 0));
                yield return subset;
            }
        }

        /// <summary>
        /// Finds the first index of the given value in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>The index of the value in the array, or -1 if it wasn't found</returns>
        public static int IndexOf<T>(this T[] array, T value) => Array.IndexOf(array, value);

        /// <summary>
        /// Finds the last index of the given value in the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to search into</param>
        /// <param name="value">Value to find</param>
        /// <returns>The last index of the value in the array, or -1 if it wasn't found</returns>
        public static int LastIndexOf<T>(this T[] array, T value) => Array.LastIndexOf(array, value);

        /// <summary>
        /// Reverses the array
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to reverse</param>
        /// <returns>The reversed array</returns>
        public static T[] Reverse<T>(this T[] array)
        {
            Array.Reverse(array);
            return array;
        }

        /// <summary>
        /// Sorts the array with the default comparer of T
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to sort</param>
        public static void Sort<T>(this T[] array) => Array.Sort(array);

        /// <summary>
        /// Sorts an array with the given comparison method
        /// </summary>
        /// <typeparam name="T">Type of elements in the array</typeparam>
        /// <param name="array">Array to sort</param>
        /// <param name="comparison">Comparison method to sort the array with</param>
        public static void Sort<T>(this T[] array, Comparison<T> comparison) => Array.Sort(array, comparison);

        /// <summary>
        /// Swap two elements in an array
        /// </summary>
        /// <typeparam name="T">Type of the array</typeparam>
        /// <param name="array">Aray to swap elements in</param>
        /// <param name="i">Index of the first element</param>
        /// <param name="j">Index of the second element</param>
        public static void Swap<T>(this T[] array, int i, int j)
        {
            T t = array[i];
            array[i] = array[j];
            array[j] = t;
        }

        public static void heapadd(this List<int> l, int i)
        {
            l.Add(i);
            for (int j = l.Count - 1; j >= 0;)
            {
                int t = (j - 1) / 2;
                if (l[j] > l[t])
                {
                    int temp = l[t];
                    l[t] = l[j];
                    l[j] = temp;
                }
                else
                    break;
                j = t;
            }
        }
        public static int heapdelete(this List<int> l)
        {
            int le = l.Count;
            int t = l[0];
            l[0] = l[le - 1];
            l.RemoveAt(le - 1);
            for (int i = 0; i < le - 1;)
            {
                int y = 2 * i + 1;
                if (y + 1 >= le - 1)
                {
                    if (y >= le - 1)
                        break;
                    if (l[i] < l[y])
                    {
                        int temp = l[y];
                        l[y] = l[i];
                        l[i] = temp;

                    }
                    break;
                }
                if (l[y] < l[y + 1])
                {
                    if (l[i] < l[y + 1])
                    {
                        int temp = l[y + 1];
                        l[y + 1] = l[i];
                        l[i] = temp;
                        i = y + 1;
                    }
                    else
                        break;
                }
                else
                {
                    if (l[i] < l[y])
                    {
                        int temp = l[y];
                        l[y] = l[i];
                        l[i] = temp;
                        i = y;
                    }
                    else
                        break;
                }
            }

            return t;
        }

        #endregion
    }
    #endregion
}


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

namespace modularexponentiation
{
    class Program
    {
        static void Main(string[] args)
        {
            BigInteger n = BigInteger.Parse(Console.ReadLine());
            BigInteger m = BigInteger.Parse(Console.ReadLine());
            BigInteger k =(BigInteger) ((m) % (Math.Pow(2.0, n)));
            Console.WriteLine(k);
        }
    }
}


using System;

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

public class ModularExponentiation : ISolution
    {
        public override void Solve()
        {
            int n = ReadInt();
            int m = ReadInt();
            if (n >= 27)
            {
                Console.Write(m);
            }
            else
            {
                Console.Write(m % Math.Pow(2, n));
            }
        }
    }


int n = int.Parse(Console.ReadLine());
int m = int.Parse(Console.ReadLine());
int z = m /n ;
Console.WriteLine(z);


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

namespace modularexponentiation
{
    class Program
    {
        static void Main(string[] args)
        {
            //BigInteger y = 1;
            BigInteger n = BigInteger.Parse(Console.ReadLine());
            BigInteger m = BigInteger.Parse(Console.ReadLine());
            double k = (BigInteger)m;
            BigInteger y = (BigInteger)Math.Pow(2.0, k);

            BigInteger.ModPow(m, 1,y);

        }
    }
}


using System;

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

    public class ModularExponentiation : ISolution
    {
        public override void Solve()
        {
            int n = ReadInt();
            int m = ReadInt();
            if (n >= 27)
            {
                Console.Write(m);
            }
            else
            {
                Console.Write(m % Math.Pow(2, n));
            }
        }
    }

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


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

namespace DynamicProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            CutRibbon();
        }

        static void CutRibbon()
        {
            var nabc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = nabc[0];
            int a = nabc[1];
            int b = nabc[2];
            int c = nabc[3];

            int[] arr = { a, b, c };
            int x, y, z;
            arr = arr.OrderBy(a => a).ToArray();
            int[] dp = new int[4001];
            dp[arr[0]] = 1;
            dp[arr[1]] = 1;
            dp[arr[2]] = 1;
            for (int i = arr[0] + 1; i <= n; i++)
            {
                x = y = z = 0;
                if (arr[0] <= i && dp[i - arr[0]] > 0)
                {
                    x = dp[i - arr[0]] + 1;
                }
                if (arr[1] <= i && dp[i - arr[1]] > 0)
                {
                    y = dp[i - arr[1]] + 1;
                }
                if (arr[2] <= i && dp[i - arr[2]] > 0)
                {
                    z = dp[i - arr[2]] + 1;
                }
                var max = Math.Max(x, y);
                dp[i] = Math.Max(max, Math.Max(z, dp[i]));
            }
            Console.WriteLine(dp[n]);
        }
        }}


using System;
using System.IO;
using System.Collections.Generic;
public class dp_cut_ribbon_189A
    {
        Dictionary<int, int> dp = new Dictionary<int, int>();
        private int max(int a, int b, int c)
        {
            return Math.Max(a, Math.Max(b, c));
        }
        private int rec(int n, int a, int b, int c)
        {
            if (dp.ContainsKey(n))
                return dp[n];
            if (n < 0)
                return -1;
            if (n == 0)
                return 0;
            int x = rec(n - a, a, b, c), y = rec(n - b, a, b, c), z = rec(n - c, a, b, c);
            if (x >= 0 || y >= 0 || z >= 0)
                dp[n] = max(x, y, z) + 1;
            else
                dp[n] = -1;
            return dp[n];
        }
        public int solve(int n, int a, int b, int c)
        {
            return rec(n, a, b, c);
        }
    }
    class main
    {
        private static void print(string s = "")
        {
            Console.Write(s);
        }
        private static void print(int s)
        {
            Console.Write(s);
        }
        private static void printL(string s = "")
        {
            Console.WriteLine(s);
        }
        private static void printL(int s)
        {
            Console.WriteLine(s);
        }
        static void Main(string[] args)
        {
                int[] input = Consloe.ReadLine().Split(' ').Select(int.Parse).ToArray();

                dp_cut_ribbon_189A obj = new dp_cut_ribbon_189A();

                printL(obj.solve(input[0],input[1],input[2],input[3]));

        }
    }


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

namespace DynamicProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            CutRibbon();
        }

        static void CutRibbon()
        {
            var nabc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = nabc[0];
            int a = nabc[1];
            int b = nabc[2];
            int c = nabc[3];

            int[] arr = { a, b, c };
            int x, y, z;
            arr = arr.OrderBy(a => a).ToArray();
            int[] dp = new int[4001];
            dp[arr[0]] = 1;
            dp[arr[1]] = 1;
            dp[arr[2]] = 1;
            for (int i = arr[0] + 1; i <= n; i++)
            {
                x = y = z = 0;
                if (arr[0] <= i && dp[i - arr[0]] > 0)
                {
                    x = dp[i - arr[0]] + 1;
                }
                if (arr[1] <= i && dp[i - arr[1]] > 0)
                {
                    y = dp[i - arr[1]] + 1;
                }
                if (arr[2] <= i && dp[i - arr[2]] > 0)
                {
                    z = dp[i - arr[2]] + 1;
                }
                var max = Math.Max(x, y);
                dp[i] = Math.Max(max, Math.Max(z, dp[i]));
            }
            Console.WriteLine(dp[n]);
        }
        }}


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

namespace Codeforce158
{
    class Program
    {
        static int[] parseInt(string s)
        {
            string[] temp = s.Split(' ');
            List<int> res = new List<int>();
            for (int i = 0; i < temp.Length; i++)
            {
                res.Add(Convert.ToInt32(temp[i]));
            }
            return res.ToArray();
        }

        static void Main(string[] args)
        {
            int[] data = parseInt(Console.ReadLine());

            int[] F = new int[data[0] + 1];
            F[data[1]] = 1;
            F[data[2]] = 1;
            F[data[3]] = 1;
            for (int i = 2; i < data[0] + 1; i++)
            {
                for (int j = 1; j < 4; j++)
                {
                    if (i - data[j] >= 0 && F[i - data[j]] != 0)
                    {
                        F[i] = Math.Max(F[i], F[i - data[j]] + 1);
                    }
                }
            }

            Console.WriteLine(F[data[0]]);
        }
    }
}


using System;
using System.IO;
using System.Collections.Generic;
public class dp_cut_ribbon_189A
    {
        Dictionary<int, int> dp = new Dictionary<int, int>();
        private int max(int a, int b, int c)
        {
            return Math.Max(a, Math.Max(b, c));
        }
        private int rec(int n, int a, int b, int c)
        {
            if (dp.ContainsKey(n))
                return dp[n];
            if (n < 0)
                return -1;
            if (n == 0)
                return 0;
            int x = rec(n - a, a, b, c), y = rec(n - b, a, b, c), z = rec(n - c, a, b, c);
            if (x >= 0 || y >= 0 || z >= 0)
                dp[n] = max(x, y, z) + 1;
            else
                dp[n] = -1;
            return dp[n];
        }
        public int solve(int n, int a, int b, int c)
        {
            return rec(n, a, b, c);
        }
    }
    class main
    {
        private static void print(string s = "")
        {
            Console.Write(s);
        }
        private static void print(int s)
        {
            Console.Write(s);
        }
        private static void printL(string s = "")
        {
            Console.WriteLine(s);
        }
        private static void printL(int s)
        {
            Console.WriteLine(s);
        }
        static void Main(string[] args)
        {
                int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

                dp_cut_ribbon_189A obj = new dp_cut_ribbon_189A();

                printL(obj.solve(input[0],input[1],input[2],input[3]));

        }
    }


public class Test
    {
        public static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int a = int.Parse(input[1]);
            int b = int.Parse(input[2]);
            int c = int.Parse(input[3]);

            int[] div = new int[n + 1];

            div[0] = 0;
            for (int i = Math.Min(a, Math.Min(b, c)); i <= n; ++i)
            {
                if (i >= a)
                    div[i] = div[i - a] + 1;
                if (i >= b)
                    div[i] = Math.Max(div[i], div[i - b] + 1);
                if(i >= c)
                    div[i] = Math.Max(div[i], div[i - c] + 1);
            }

            Console.WriteLine(div[n]);
        }
    }


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

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

            private void Solve()
            {
                var s = Console.ReadLine().Split(' ');
                int n = int.Parse(s[0]);
                int m = int.Parse(s[1]);
                int z = int.Parse(s[2]);
                int l, b;
                int ans = 0;
                if (m > n)
                {
                    b = m;
                    l = n;
                }
                else
                {
                    l = m;
                    b = n;
                }
                int bFirst = b;
                while (b<=z)
                {
                    if (b%l == 0)
                    {
                        ans++;
                    }
                    b+=bFirst;
                }
                Console.WriteLine(ans);
            }

            int BinarySearch(int[] arr, int q)
            {
                var l = 0;
                var r = arr.Length - 1;
                //int med = -1;
                while (l <= r)
                {
                    var med = l + (r - l) / 2;
                    if (arr[med] == q)
                    {
                        return med;
                    }
                    if (q < arr[med])
                    {
                        r = med - 1;
                    }
                    else
                    {
                        l = med + 1;
                    }
                }
                return -1;
            }

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

            #region Helpers

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

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

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

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


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

namespace CodeforcesBetaRound83
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split(':');

            int a = int.Parse(ss[0]);
            int b = int.Parse(ss[1]);

            string c = perevorot(a);

            if (int.Parse(c) <= b)
            {
                if (a != 23)
                {
                    int cc = a + 1;
                    if (cc < 10)
                        c = "0" + cc;
                    else
                        c = cc.ToString();

                    Console.WriteLine(c + ":" + perevorot(cc));
                }
                else
                    Console.WriteLine("00:00");
            }
            else
            {
                if (int.Parse(c) < 60)
                {
                    Console.WriteLine(ss[0] + ":" + c);

                }
                else
                {
                    if (a != 23)
                    {

                            int cc = a + 1;
                            if (cc < 10)
                                c = "0" + cc;
                            else
                                c = cc.ToString();

                            Console.WriteLine(c + ":" + perevorot(c));

                    }
                    else
                        Console.WriteLine("00:00");
                }

            }

            Console.ReadLine();

        }
       public static string perevorot(int a)
        {
            int a1 = a % 10;
            string aa = a1.ToString();
            int a2 = a / 10;
            aa = aa + a2.ToString();

       //    if (int.Parse(aa) < 10)
       //       aa = "0" + aa;

            return aa;
        }
    }
}


<?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>{25B6AE56-020D-4B7D-824A-5834F25493CD}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>_825</RootNamespace>
    <AssemblyName>825</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.Globalization;
using System.Linq;
using System.Text;

class codeforces
{

    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
        int res = 1 ;
        int pre  = -1;
        for (int i = 0 ; i < n ; i ++)
        {
            if (a[i] == 1)
            {
                if (pre + 1)
                {
                    res *= i - pre;
                }
                pre = i;
            }
        }
        if (pre == -1)
        {
            Console.WriteLine("0");
            return;
        }
        Console.WriteLine(res);
    }
}


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

class codeforces
{

    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Trim().split(' ').Select(int.Parse).ToArray();
        int res = 1 ;
        int pre  = -1;
        for (int i = 0 ; i < n ; i ++)
        {
            if (a[i] == 1)
            {
                if (pre + 1)
                {
                    res *= i - pre;
                }
                pre = i;
            }
        }
        if (pre == -1)
        {
            Console.WriteLine("0");
            return;
        }
        Console.WriteLine(res);
    }
}


using System;

namespace CF617B
{
	class MainClass
	{
		public static void Main ()
		{
			int n = int.Parse (Console.ReadLine ());
			int[] a = new int[102];
			int m = 0;
			string IntArray = Console.ReadLine ();
			string[] NewIntArray = IntArray.Split(' ');
			for (int i = 1; i <= n; i++) {
				int val = int.Parse (NewIntArray [i - 1]);
				if (val == 1)
					a [++m] = i;
			}
			long res = 1;
			if (m == 0)
				res = 0;
			else if (m == n)
				res = 1;
			else
				for (int i = 2; i <= m; i++)
					res *= long(a [i] - a [i - 1])
			Console.WriteLine ("{0}", res);
		}
	}
}


import java.io.*;
import java.util.*;

public class Sequence{
   public static void main(String args[])throws IOException{

      int a = 0;
      int b = 0;
      int i;
      int k;
      ArrayList<String> list = new ArrayList<>();
      Boolean err;
      String str = "";
      char arr[];
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              //Делаем
      do{
         try{
            err = false;
       //     System.out.println("Введите число из последовательности (4,7,44,77,444....) : ");
            str = br.readLine();
            arr = str.toCharArray();

            for(char current : arr){
               if(current == '4' || current == '7'){
                  continue;
               }else{
                  throw new NumberFormatException();
               }
            }

         }catch (NumberFormatException e) {
            err = true;
            System.out.println("Неккоректное число");
         }
      } while( err == true);

      String array[][] = new String[10][];

      for(i = 0,k = 2; i < 10;i++,k = k*2){
         array[i] = new String[k];
      }

      array[0][0] = "4";
      array[0][1] = "7";

      while ( a < 9 ) {
         for(String s : array[a]){
            for(String j : array[0]){
               array[a+1][b] = s+j;
               b++;
            }
         }
         b = 0;
         a +=1;

      }

      for(String[] n : array){
         for(String j : n){
            list.add(j);
         }
      }

      a = list.indexOf(str)+1;
      System.out.print(a);
      br.close();

   }
}


using System;
using C5;

namespace ForceTest2
{
    class MagicSolver {

        public static long getMaskPos(String part)
        {
            int result = 0;
            if (part.Length == 1)
            {
                if (part.Equals ("4"))
                {
                    result = 1;
                }
                else
                {
                    result = 2;
                }
            }
            else
            {
                if (part.Equals ("44"))
                {
                    result = 3;
                }
                else if (part.Equals ("47"))
                {
                    result = 4;
                }
                if (part.Equals ("74"))
                {
                    result = 5;
                }
                else if (part.Equals ("77"))
                {
                    result = 6;
                }
            }

            return result;
        }

        public static long findBasicPos(int len) {
            long result = 2;
            for (int i = 2; i <= len-1; i++) {
                result += (long)Math.Pow (2.0, (double)i);
            }

            return result;
        }

        public static String [] eraser(String mnumber) {
            ArrayList<String> result = new ArrayList<String> ();

            int len = mnumber.Length;

            while (len != 0) {
                if (len >= 2) {
                    String dchar = mnumber.Substring (len - 2, 2);
                    result.Add (dchar);
                    mnumber = mnumber.Substring(0, len-2);
                } else {
                    result.Add (mnumber);
                    mnumber = "";
                }
                len = mnumber.Length;
            }

            return result.ToArray ();

        }

    }

    class MainClass
    {
        public static void Main (string[] args)
        {
            String magicNum = Console.ReadLine ();

            long start = 0;

            if (magicNum.Length > 2) {
                start = MagicSolver.findBasicPos (magicNum.Length);
            }

            String[] partOfNum = MagicSolver.eraser (magicNum);

            foreach (String part in partOfNum) {
                start += MagicSolver.getMaskPos (part);
            }
            Console.Write (start);
        }
    }
}


using System;

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

            string line = Console.ReadLine();
            var numbers = line.Split(' ');
            var x = int.Parse(numbers[0]);
            int y = int.Parse(numbers[1]);

            if (x % 2 == 0 || y % 2 == 0)
                Console.WriteLine("Malvika");
            else
                Console.WriteLine("Akshat");

        }
    }


using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine(); string[] arr=s.Split(' ');
            int n = int.Parse(arr[0]), m = int.Parse(arr[1]);
            Console.Write(((n*m) % 2 == 0) ? "Malvika" : "Akshat");
        }
    }
}


using System;

namespace Test
{
    class Program
    {
        int Main(string[] args)
        {
            int m = int.Parse(Console.ReadLine());
            int n = int.Parse(Console.ReadLine());
            int x = m*n;
            Console.WriteLine(x%2 == 0 ? "Malvika" : "Akshat");
            return 0;
        }
    }
}


using System;

class MainClass()
{
    static void Main(string[] args)
    {
        int[] inputs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int minimum = input[0] > input[1] ? input[1] : input[0];

        if (minimum % 2 == 0) Console.WriteLine("Malvika");
        else Console.WriteLine("Akshat");
    }
}


using System;

class MainClass()
{
    static void Main(string[] args)
    {
        int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int minimum = input[0] > input[1] ? input[1] : input[0];

        if (minimum % 2 == 0) Console.WriteLine("Malvika");
        else Console.WriteLine("Akshat");
    }
}


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

class Program
{
    static void Main(string[] args)
    {
        int N = Int32.Parse(Console.ReadLine());
        string[] A = new string[] { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
        string[] B = new string[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
        string[] C = new string[] { "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
        string ans = "";
        if (N < 10) ans = B[N];
        else if (N < 20) ans = C[N - 10];
        else if (N % 10 == 0) ans = A[N / 10];
        else ans = A[N / 10] + "-" + B[N % 10];

        Console.WriteLine(ans);


using System;
    public class Program
    {
        public static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] numbers = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
            string [] bigger = { null, null, "twen", "thir",  null, "fif", null, null, "eigh", null };
            if (input.Length == 1) Console.WriteLine(numbers[input[0] - 48]);
            else
            {
                StringBuilder bldr = new StringBuilder();
                if(input[0]=='1')
                {
                    if (input[1] == '0') bldr.Append("ten");
                    else if (input[1] == '1') bldr.Append("eleven");
                    else if (input[1] == '2') bldr.Append("twelve");
                    else { bldr.Append("teen"); if (bigger[input[1] - 48] == null) bldr.Insert(0, numbers[input[1] - 48]); else bldr.Insert(0, bigger[input[1] - 48]); }
                }
                else
                {
                    bldr.Append("ty");
                    if (bigger[input[0] - 48] == null) bldr.Insert(0, numbers[input[0] - 48]);
                    else bldr.Insert(0, bigger[input[0] - 48]);
                    if (input[1] != '0') bldr.AppendFormat("-{0}", numbers[input[1] - 48]);
                }
                Console.WriteLine(bldr.ToString());
            }
        }
    }


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

namespace Console
{
    class Program
    {
        static void Main(string[] args)
        {
            var dict1 =  new Dictionary<string, string>()
            {
                {"0","zero"},
                {"1", "one"},
                {"2", "two"},
                {"3", "three"},
                {"4", "four"},
                {"5", "five"},
                {"6", "six"},
                {"7", "seven"},
                {"8", "eight"},
                {"9", "nine"},
            };
            var dict2 = new Dictionary<string, string>()
            {
                {"2", "twenty"},
                {"3", "thirty"},
                {"4", "forty"},
                {"5", "fifty"},
                {"6", "sixty"},
                {"7", "seventy"},
                {"8", "eighty"},
                {"9", "ninety"},
            };
            var specialDict = new Dictionary<string, string>()
            {
                {"10", "ten"},
                {"11","eleven"},
                {"12","twelve"},
                {"13","thirteen"},
                {"14","fourteen"},
                {"15","fifteen"},
                {"16","sixteen"},
                {"17","seventeen"},
                {"18","eighteen"},
                {"19","nineteen"},
            };
            var p = new Program();
            string s = System.Console.ReadLine();
            string result;
            if (s.Count() == 1)
            {
                result = dict1[s];
            }
            else
            {
                if (specialDict.ContainsKey(s))
                    result = specialDict.SpecialDict()[s];
                else
                {
                    var first = s[0].ToString();
                    var second = s[1].ToString();
                    var firstResult = dict2[first];
                    var secondResult = second=="0" ? string.Empty : dict1[second];
                    var defis = second == "0" ? string.Empty : "-";
                    result = string.Format("{0}{1}{2}", firstResult,defis, secondResult);
                }
            }
            System.Console.Write(result);

        }

        //Dictionary<string, string> Dict1()
        //{
        //    return new Dictionary<string, string>()
        //    {
        //        {"0","zero"},
        //        {"1", "one"},
        //        {"2", "two"},
        //        {"3", "three"},
        //        {"4", "four"},
        //        {"5", "five"},
        //        {"6", "six"},
        //        {"7", "seven"},
        //        {"8", "eight"},
        //        {"9", "nine"},
        //    };
        //}

        //Dictionary<string, string> Dict2()
        //{
        //    return new Dictionary<string, string>()
        //    {
        //        {"2", "twenty"},
        //        {"3", "thirty"},
        //        {"4", "forty"},
        //        {"5", "fifty"},
        //        {"6", "sixty"},
        //        {"7", "seventy"},
        //        {"8", "eighty"},
        //        {"9", "ninety"},
        //    };
        //}

        //Dictionary<string, string> SpecialDict()
        //{
        //    return new Dictionary<string, string>()
        //    {
        //        {"10", "ten"},
        //        {"11","eleven"},
        //        {"12","twelve"},
        //        {"13","thirteen"},
        //        {"14","fourteen"},
        //        {"15","fifteen"},
        //        {"16","sixteen"},
        //        {"17","seventeen"},
        //        {"18","eighteen"},
        //        {"19","nineteen"},
        //    };
        //}
    }
}


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

namespace cf624B
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            HashSet<int> used = new HashSet<int>(26);

            long total = 0;

            foreach (int e in a)
            {
                if (used.Contains(e))
                {
                    int h = e;
                    while(h>0 && used.Contains(h))
                    {
                        h--;
                    }
                    if (h > 0)
                    {
                        used.Add(h);
                        total += h;
                    }
                }
                else
                {
                    used.Add(e);
                    total += e;
                }
            }

            Console.WriteLine(total);
        }
    }
}


using System;

public class Example
{
   public static void Main()
   {
        int n = Console.ReadLine();
        byte d = n % 10;
        if(d >= 5)
            n +=(10-d);
        else
            n-=(10-d);
        Console.Write(" "+n);
   }
}


using System;

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

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

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

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


string [] tmp = Console.ReadLine().Split();
int Parent = Int32.Parse(tmp[0]);
int Childs = Int32.Parse(tmp[1]);

if (Parent == 0)
    Console.Write("Impossible");
if (Parent > Childs || Parent == Childs)
    Console.Write("{0} {1}", Parent, Parent);
if (Childs > Parent)
    Console.Write("{0} {1}", Childs, Parent + Childs - 1);


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication21", "ConsoleApplication21\ConsoleApplication21.csproj", "{0138161B-5138-4601-B6E7-03DFA9EAA492}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{0138161B-5138-4601-B6E7-03DFA9EAA492}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{0138161B-5138-4601-B6E7-03DFA9EAA492}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{0138161B-5138-4601-B6E7-03DFA9EAA492}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{0138161B-5138-4601-B6E7-03DFA9EAA492}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;
using System.Linq;

namespace test
{
    public class Program
    {

        private static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split().Select(Int32.Parse).ToList();

            var groupBy = arr.GroupBy(x => x).ToArray();

            int legs = -1;
            foreach (var grouping in groupBy)
            {
                if (grouping.Count() >= 4) legs = grouping.Key;
            }

            bool b = legs > 0;
            if (b)
            {
                for (int i = 0; i < 4; i++) arr.Remove(legs);

                Console.WriteLine(arr[0] == arr[1] ? "Elephant" : "Bear");
            }
            else
            {
                Console.WriteLine("Alien");
            }
        }
    }


using System;

namespace Issue_471A
{
    class Program
    {
        public static void Main(string[] args) {
            const int sticks_count = 9;
            var sticks = new int[sticks_count];

            for (int i = 0; i < sticks_count; ++i) {
                sticks[i] = ReadInt();
            }

            Sort.HeapSort(sticks);

            string result;

            if (IsBear(sticks)) result = "Bear";
            else if (IsElephant(sticks)) result = "Elephant";
            else result = "Alien";

            Console.WriteLine(result);
        }

        private static bool IsBear(int[] sticks) {
            return sticks[0] < sticks[1]
                && sticks[1] == sticks[4]
                && sticks[5] > sticks[1];
        }

        private static bool IsElephant(int[] sticks) {
            return sticks[0] == sticks[3]
                && sticks[0] < sticks[4]
                && sticks[4] == sticks[5];
        }
    }

    public static class Helper {
        public static bool IsInputError = false;
        public static bool IsEndOfLine = false;

        public static int ReadInt() {
            const int zeroCode = (int) '0';

            var result = 0;
            var isNegative = false;
            var symbol = Console.Read();
            IsInputError = false;
            IsEndOfLine = false;

            while (symbol == ' ') {
                symbol = Console.Read();
            }

            if (symbol == '-') {
                isNegative = true;
                symbol = Console.Read();
            }

            for ( ;
                (symbol != -1) && (symbol != ' ');
                symbol = Console.Read()
            ) {
                var digit = symbol - zeroCode;

                // if symbol == \n
                if (symbol == 13) {
                    // skip next \r symbol
                    Console.Read();
                    IsEndOfLine = true;
                    break;
                }

                if (digit < 10 && digit >= 0) {
                    var cache1 = result << 1;
                    var cache2 = cache1 << 2;
                    result = cache1 + cache2 + digit;
                } else {
                    IsInputError = true;
                    break;
                }
            }

            return isNegative ? ~result + 1 : result;
        }
    }

    static class Sort
    {
        public static void HeapSort<T>(this T[] array)
            where T : IComparable<T>
        {
            // create Heap from unordered array
            BuildHeap(array);

            // sort
            for (var i = array.Length - 1; i >= 0; --i) {
                Swap(ref array[0], ref array[i]);
                FloatUp(array, 0, i);
            }
        }

        private static void BuildHeap<T>(T[] array)
            where T: IComparable<T>
        {
            var size = array.Length;
            var last_index = size - 1;

            for (var i = (last_index - 1) / 2; i >= 0; --i) {
                FloatUp(array, i, size);
            }
        }

        private static void FloatUp<T>(T[] array, int index, int size)
            where T: IComparable<T>
        {
            var left_node_index = 2 * (index + 1) - 1;
            var right_node_index = 2 * (index + 1);

            if (left_node_index >= size) {
                return;
            }

            var largest = (array[left_node_index].CompareTo(array[index]) > 0)
                ? left_node_index
                : index;

            if (right_node_index < size) {
                largest = (array[right_node_index].CompareTo(array[largest]) > 0)
                    ? right_node_index
                    : largest;
            }

            if (largest != index) {
                Swap(ref array[index], ref array[largest]);
                FloatUp(array, largest, size);
            }
        }

        private static void Swap<T>(ref T a, ref T b) {
            T temp = a;
            a = b;
            b = temp;
        }
    }
}


        private static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split().Select(Int32.Parse).ToList();

            var groupBy = arr.GroupBy(x => x).ToArray();

            int legs = -1;
            foreach (var grouping in groupBy)
            {
                if (grouping.Count() >= 4) legs = grouping.Key;
            }

            bool b = legs > 0;
            if (b)
            {
                arr.RemoveAll(x => x == legs);

                Console.WriteLine(arr[0] == arr[1] ? "Elephant" : "Bear");
            }
            else
            {
                Console.WriteLine("Alien");
            }
        }


PROBLEMSSUBMIT CODEMY SUBMISSIONSSTATUSHACKSROOMSTANDINGSCUSTOM INVOCATION
A. MUH and Sticks
time limit per test1 second


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

namespace ConsoleApplication1
{
    class Program
    {
        internal static void MyMain()
        {
            int[] ints = RInts();
            var all = ints.GroupBy(a => a).Select(a => a.Count()).OrderBy(a => a).Reverse().ToList();
            if (all[0] >= 4)
            {
                if ((all.Count >= 2 && all[1] >= 2) || all[0] == 6)
                {
                    WLine("Elephant");
                    return;
                }
                else if (all[1] == 1 && all[0] == 5 || (all[0] == 4 && all[1] == 1 && all[2] >= 1))
                {
                    WLine("Bear");
                    return;
                }
                else {
                    WLine("Elien");
                    return;
                }
            }
            else {
                WLine("Alien");
            }

        }


192.168.1.174 (6:50 AM):
bear and elephant company javab nemide
salammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
i love world of war craft
192.168.1.174 (6:57 AM):
chi kar mikoni
192.168.1.46 (7:22 AM):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            var nums = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();
            Array.Sort(nums);
            int[] ls = new int[100];

            for (int i = 0; i < nums.Length; i++)
            {
                ls[nums[i]]++;
            }

            int max = ls.Max();
            bool isOne = false;
            for (int i = 0; i < ls.Length; i++)
            {

                if (ls[i] == 1)
                    isOne = true;
            }

            if (max<4)
                Console.WriteLine("Alien");
            else if (isOne) Console.WriteLine("Bear");
            else Console.WriteLine("Elephant");
            Console.ReadLine();
        }

    }

}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task", "Task\Task.csproj", "{7A8F88C5-8232-46C8-B86B-8F38540A738B}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{7A8F88C5-8232-46C8-B86B-8F38540A738B}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


    public class TaskA
    {
        static void Main(string[] args)
        {
            var testNumber = int.Parse(Console.ReadLine()!);
            for (var i = 0; i < testNumber; i++)
            {
                var testData = Console.ReadLine();
                var result = FindSolution(int.Parse(testData!));
                Console.WriteLine(result);
            }
        }

        private static int FindSolution(int percent)
        {
            var (min, max) = percent < 50 ? (percent, 100 - percent) : (100 - percent, percent);
            if (min == 0) return 1;

            while (true)
            {
                var remainder = max % min;
                if (remainder == 0) break;
                (min, max) = min < remainder ? (min, remainder) : (remainder, min);
            }

            return 100 / min;
        }
    }


using System;
using System.Linq;
using System.Threading;

namespace codeforces
{
  class Program
  {
    static void Main(string[] args)
    {
      int columns = int.Parse(Console.ReadLine());
      int[] values = Console.ReadLine().Split().Select(int.Parse).ToArray();
      Console.WriteLine(String.Join(' ', ChangeGravity(values)));
    }

    private static int[] ChangeGravity(params int[] values)
    {
      for (int j = 0; j < values.Length; j++)
      {
        for (int i = 0; i < values.Length - 1; i++)
        {
          if (values[i] > values[i + 1])
          {
            int diff = values[i] - values[i + 1];
            values[i] -= diff;
            values[i + 1] += diff;
          }
        }
      }
      return values;
    }
  }
}


int n = Convert.ToInt32(Console.ReadLine().Trim());
            string s = Console.ReadLine();
            string[] s1 = s.Split();
            int[] mas = new int[n];
            int i = 0;
            foreach(string a in s1)
            {
                mas[i] = Convert.ToInt32(a);
                i++;
            }
            Array.Sort(mas);
            for (int j = 0; j < n; j++)
                Console.Write(mas[j] + " ");


#include <iostream>
#include <string>

using namespace std;

int main()
{
	int *s;
	int n, count=1;
	cin >> n;
	s = new int[n];
	cin >> s[0];
	for (int i = 1; i < n; i++)
	{
		cin >> s[i];
		if (s[i - 1] == s[i])
			continue;
		count++;
	}
	cout << count;
}