using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;
using System.Numerics;

class Solution
{

    static int? getVal(char c)
    {
        if (c >= 'a' && c <= 'f')
            return 10 + (c - 'a');
        if (c >= 'A' && c <= 'F')
            return 10 + (c - 'A');
        if (c >= '0' && c <= '9')
            return c - '0';
        return null;
    }

    static char? convert(char? A, char? B)
    {
        if (A == null || B == null)
            return null;
        var x = getVal(A.Value);
        var y = getVal(B.Value);
        if (x == null || y == null)
            return null;
        var res = x.Value * 16 + y.Value;
        return (char)res;
    }

    static void Main(string[] args)
    {
        var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);
        var n = nm[0];
        var a = nm[1];
        var x = nm[2];
        var b = nm[3];
        var y = nm[4];
        for (int i = 0; i < n; i++)
        {
            var c1 = (a - 1 + i) % n;
            var c2 = (b - 1 - i) % n;
            c2 = c2 < 0 ? c2 + n : c2;
            if (c1 == c2 )
            {
                Console.WriteLine("YES");
                return;
            }
            if (c1 == x - 1 || c2 == y - 1)
            {
                Console.WriteLine("NO");
                return;
            }
        }
    }
}


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

namespace Codeforces
{
    class А
    {
        private static ThreadStart s_threadStart = new А().Go;
        private static bool s_time = false;

        private void Go()
        {
            long a = GetLong();
            long b = GetLong();
            long x = 0;
            long t;

            while (a != 0 && b != 0)
            {
                if (a > b) { t = a; a = b; b = t; }
                x += (b / a);
                t = b % a;
                b = a;
                a = t;
            }

            Wl(x);
        }

        #region Template

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

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

            return ioEnum.Current;
        }

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

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

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

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

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

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

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

        #endregion
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Web;
using System.Net;
using System.Collections;
using System.Threading;

namespace ConsoleApplication1 {
    class Program {
        static void Main( string[] args ) {
            long a = ReadLong();
            long b = ReadLong();
            long count = 0;
            while ( a != 0 && b != 0 ) {
                if ( a < b ) {
                    long c = a;
                    a = b;
                    b = c;
                }

                count += a / b;
                a %= b;
            }

            Console.WriteLine(count);
        }

        static int _current = -1;
        static string[] _words = null;
        static long ReadLong() {
            if ( _current == -1 ) {
                _words = Console.ReadLine().Split(new char[] { ' ', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                _current = 0;
            }

            long value = long.Parse(_words[_current]);
            if ( _current == _words.Length - 1 )
                _current = -1;
            else
                _current++;

            return value;
        }
    }
}


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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var l = Console.ReadLine().Split();
            for (var i = 0; i < l.Length; i++)
            {
                if (l[i][0] == s[0] || l[i][1] == s[1])
                {
                    Console.WriteLine("YES");
                    //Console.ReadKey();
                    return;
                }
            }

            Console.WriteLine("NO");
            //Console.ReadKey();
        }
    }
}


using System;

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

            string str1 = Console.ReadLine();

            string str2 = Console.ReadLine();

            if (str2.Contains(str1[1])||str2.Contains(str1[0]))
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");

        }
    }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string nums = Console.ReadLine();
            var res = new List<int>();
            foreach (var i in nums.Split(' ').Select(s => Convert.ToInt32(s)))
            {
                if (!res.Contains(i))
                    res.Add(i);
                if (res.Count > 3)
                    break;
            }
            if (res.Count == 1)
                Console.WriteLine(0);
            else if (res.Count == 2)
            {
                if (Math.Abs(res[0] - res[1]) % 2 == 0)
                    Console.WriteLine(Math.Abs(res[0] - res[1]) / 2);
                else
                    Console.WriteLine(Math.Abs(res[0] - res[1]));
            }
            else if (res.Count == 3)
            {
                int maxVal = res.Max();
                int minVal = res.Min();
                res.Remove(maxVal);
                res.Remove(minVal);
                if (maxVal + minVal == 2 * res[0])
                    Console.WriteLine(res[0] - minVal);
                else
                    Console.WriteLine(-1);
            }
            else
                Console.WriteLine(-1);
        }
    }
}


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

class Program
{
    const string inputPath = "input.txt";
    const string outPath = "output.txt";
    static void Main(string[] args)
    {
        // var inputText = File.ReadAllLines(inputPath);
        // var stringN = inputText[0].Split(' ');
        // var stringNums = inputText[1].Split(' ');

        var stringN = Console.ReadLine();
        var stringNums = Console.ReadLine().Split(' ');

        int n = int.Parse(stringN);

        List<int> nums = new List<int>();
        HashSet<int> hasNums = new HashSet<int>();

        foreach (var num in stringNums)
        {
            hasNums.Add(int.Parse(num));
        }

        if (hasNums.Count > 3)
        {
            System.Console.WriteLine(-1);
        }
        else
        {
            nums = hasNums.ToList();
            nums.Sort();
            if (nums.Count == 3)
            {
                if (nums[2] - nums[1] == nums[1] - nums[0])
                {
                    System.Console.WriteLine(nums[1] - nums[0]);
                }
                else
                {
                    System.Console.WriteLine(-1);
                }
            }
            else if (nums.Count == 2)
            {
                if ((nums[1] - nums[0]) % 2 == 0)
                {
                    System.Console.WriteLine((nums[1] - nums[0]) / 2);
                }
                else
                {
                    System.Console.WriteLine(nums[1] - nums[0]);
                }
            }
            else if (nums.Count == 1)
            {
                System.Console.WriteLine(0);
            }
            else
            {
                System.Console.WriteLine(-1);
            }

   //         Console.ReadLine();
        }
    }
}


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

namespace Codeforce
{

    class Printer
    {
        StringBuilder sb;

        public Printer()
        {
            sb = new StringBuilder();
        }

        public void WriteLine(string s)
        {
            sb.AppendLine(s);
        }

        public void Write(string s)
        {
            sb.Append(s);
        }

        public void Print()
        {
            Console.Write(sb);
        }
    }

    class Program
    {
        static StreamReader input = new StreamReader(Console.OpenStandardInput());
        //static StreamWriter output = new StreamWriter(Console.OpenStandardOutput());

        static int nextInt()
        {
            int t = input.Read();
            while ((t < '0' || t > '9' || t < 'A' || t > 'Z') && t != '-') t = input.Read();
            if (t >= 'A' && t <= 'Z')
                return t;
            int sign = 1;
            if (t == '-')
            {
                sign = -1;
                t = input.Read();
            }
            int x = 0;
            while (t >= '0' && t <= '9')
            {
                x *= 10;
                x += t - '0';
                t = input.Read();
            }
            return x * sign;
        }

        static int[] parseInt(string s)
        {
            string[] temp = s.Split(' ');
            int[] res = new int[temp.Length];
            for (int i = 0; i < temp.Length; i++)
            {
                res[i] = Convert.ToInt32(temp[i]);
            }
            return res;
        }

        static void Main(string[] args)
        {
            Printer printer = new Printer();

            int n = Convert.ToInt32(Console.ReadLine());

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

            Queue<string> Q = new Queue<string>();

            Q.Enqueue("1");

            while (Q.Count > 0)
            {
                string tmp = Q.Dequeue();
                res.Add(Convert.ToInt32(tmp));

                string tmp1 = tmp + "1", tmp2 = tmp + "0";

                if (tmp1.Length < 11 && Convert.ToInt64(tmp1) <= n)
                    Q.Enqueue(tmp1);
                if (tmp2.Length < 11 && Convert.ToInt64(tmp2) <= n)
                    Q.Enqueue(tmp2);
            }

            Console.WriteLine(res.Count);

            printer.Print();

        }
    }
}


//#define RegExpScanner
using System;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Collections.Generic;
//using System.Text.RegularExpressions;

//Codeforces 9C.Числа Хексадесимал

namespace CodeForces
{
    class Program
    {

        [Conditional("DEBUG")]
        void OnDebug()
        {
        }

        private void solve()
        {
            int x = 999;
            string s = cin.Scan();
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] > '1') { x = i; break; }
            }

            var m = s.Select((e, idx) => (e - '0') >= 1 | (idx >= x) ? 1 : 0).Aggregate((ac, i) => (ac << 1) | i);
            Console.WriteLine(m);
        }

        static void Main()
        {
            new Program().solve();
#if DEBUG
            Console.ReadKey(true);
#endif
        }

        static T[] ga<T>(int n, Func<int, T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f(i);
            return a;
        }
    }
}

class cin
{
    private static readonly System.IO.StreamReader reader = new System.IO.StreamReader(Console.OpenStandardInput(1024 * 16), Encoding.ASCII, false, 1024 * 10);

    static int read() { return reader.Read(); }

    public static string Scan()
    {
        int c;
        StringBuilder sb = new StringBuilder();
        do c = read(); while (c < 33 || c > 126);
        for (; c >= 33 && c <= 126; c = read()) sb.Append((char)c);
        return sb.ToString();
    }

    public static uint gu()
    {
        return gu(read());
    }

    static uint gu(int first)
    {
        uint u = 0;
        for (int c = first; c != -1; c = read())
        {
            if (!char.IsDigit((char)c)) return u;
            u = 10 * u + (uint)c - '0';
        }

        throw new System.IO.IOException();
    }

    public static int gi()
    {
        for (int c = read(); c != -1; c = read())
        {
            switch ((char)c)
            {
                case '-':
                    read();
                    return -(int)gu(read());

                default:
                    if (char.IsDigit((char)c)) return (int)gu(c);
                    break;
            }
        }

        throw new System.IO.IOException();
    }
}


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

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

        private static void Main(string[] args)
        {
            long t = Next();
            long w = Next();
            long b = Next();

            long min = Math.Min(w, b);
            long max = Math.Max(w, b);
            long g = Gcd(w, b);
            long count = min - 1;
            if (w == b || t < min)
                count = t;
            else if (t/min >= max/g)
            {
                long d = min/g*max;
                long cnt = t/d - 1;

                count += cnt*(min);

                long tt = (cnt + 1)*d;

                count += Math.Min(t - tt + 1, min);
            }

            g = Gcd(count, t);
            writer.Write(count/g);
            writer.Write('/');
            writer.WriteLine(t/g);
            writer.Flush();
        }

        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a%b);
        }

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


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

namespace _292C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long t = long.Parse(input[0]);
            long w = long.Parse(input[1]);
            long b = long.Parse(input[2]);

            long min = (w > b) ? b : w;
            if (t < min)
                Console.WriteLine("1/1");
            else
            {
                long nok = NOK(w, b, t+1);
                long extra = (t / nok) * nok + min - t - 1;
                if ((extra < 0) || (nok == 1))
                    extra = 0;
                long count = (t / nok + 1) * min - 1 - extra;
                if (count == 0)
                {
                    Console.WriteLine("0/1");
                    return;
                }

                long NOD = NOD_Evclid(t, count);
                t /= NOD;
                count /= NOD;

                Console.WriteLine(count.ToString() + "/" + t.ToString());
                Console.ReadLine();

            }
        }
        static long NOK(long a, long b, long def)
        {
            long min, max;
            if (a > b)
            {
                min = b;
                max = a;
            }
            else
            {
                min = a;
                max = b;
            }

            a = min / NOD_Evclid(max, min);
            if (def / max >= a)
                return a * max;
            else
                return def;
        }
        static long NOD_Evclid(long a, long b) // a>b !
        {
            //https://ru.wikipedia.org/wiki/Алгоритм_Евклида
            long r = a % b;
            while (r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }
            return b;
        }
    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = int.Parse(Console.ReadLine());
        int[] A = new int[6];
        for(int i=5;i>=0;i--){
            A[i] =  N % 10;
            N /= 10;
        }
        int count;
        if(A[0] + A[1] + A[2] == A[3] + A[4] + A[5]){
            count = 0;
        }
        else{
            int diff;
            int[] B = new int[6];
            if(A[0] + A[1] + A[2] > A[3] + A[4] + A[5]){
                diff = (A[0] + A[1] + A[2]) - (A[3] + A[4] + A[5]);
                for(int i=0;i<6;i++){
                    B[i] = i < 3 ? A[i] : 9 - A[i];
                }
            }
            else{
                diff =  - (A[0] + A[1] + A[2]) + (A[3] + A[4] + A[5]);
                for(int i=0;i<6;i++){
                    B[i] = i >= 3 ? A[i] : 9 - A[i];
                }
            }
            Array.Sort(B);
            int c = 0;
            count = 0;
            for(int i=5;i>=0;i--){
                c += B[i];
                count++;
                if(diff <= c){
                    break;
                }
            }
        }
        sb.Append(count+"\n");
    }
}


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

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int[] array = new int[6];
            for (int i = 0; i < 6; i++)
            {
                int.TryParse(s[i].ToString(), out array[i]);
            }

            int sum1 = array[0] + array[1] + array[2];
            int sum2 = array[3] + array[4] + array[5];
            if (sum2 > sum1)
            {
                int[] result = { 9 - array[0], 9 - array[1], 9 - array[2], array[3], array[4], array[5] };
                Array.Sort(result);
                int sum = sum2 - sum1;
                {
                    int answer = 1;
                    for (int i = 0; i < 6; i++)
                    {
                        if (sum > result[5 - i]) { answer++; sum -= result[5 - i]; } else break;
                    }
                    Console.WriteLine(answer);
                }
            }
            if (sum1 > sum2)
            {
                int[] result = {array[0], array[1], array[2], 9-array[3], 9-array[4], 9-array[5] };
                Array.Sort(result);
                int sum = sum1 - sum2;
                {
                    int answer = 1;
                    for (int i = 0; i < 6; i++)
                    {
                        if (sum > result[5 - i]) { answer++; sum -= result[5 - i]; } else break;
                    }
                    Console.WriteLine(answer);
                }
            }
            if (sum1 == sum2) Console.WriteLine(0);
        }
    }
}


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

namespace CodeForcesProblems
{
    class A577MultiplicationTable
    {
        public static void Main()
        {
            //while(true)
            //{
                string[] a = Console.ReadLine().Split(' ');
                var n = int.Parse(a[0]);
                var x = int.Parse(a[1]);
                double j = 0;
                var count = 0;
                for(int i =1;i<=n;i++)
                {
                    j = x / i;
                    if (x % i == 0 && i<=n && j<=n)
                        count++;
                }

                Console.WriteLine(count);
            //}
        }
    }
}


using System;
using System.Linq;

class A577 {
    public static void Main() {
        var line = Console.ReadLine().Split();
        var n = int.Parse(line[0]);
        var x = int.Parse(line[1]);
        Console.WriteLine(Enumerable.Range(1, n).Count(k =>
            x / k <= n && x % k == 0
        ));
    }
}


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

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

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

            for (int i = 1; i < n; i++)
            {
                for (int j = 1; j < n; j++)
                {
                    writer.Write(ConvertToString(i*j, n));
                    writer.Write(' ');
                }
                writer.WriteLine();
            }

            writer.Flush();
        }

        private static string ConvertToString(int i, int b)
        {
            var st = new Stack<int>();
            while (i > 0)
            {
                st.Push(i%b);
                i /= b;
            }
            var bb = new StringBuilder();
            foreach (int j in st)
            {
                bb.Append((char) (j + '0'));
            }
            return bb.ToString();
        }

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


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

namespace _39h
{
    class Program
    {

        static string ToPos(Int32 k, Int32 pos)
        {
            string result = "";
            while (k > 0)
            {
                result = (k % pos).ToString() + result;
                k = k / pos;
            }
            return result;
        }

        static void PrintMatr(Int32[,] arr, Int32 pos)
        {
            if (pos == 10)
            {
                for (int i = 0; i < 9; i++)
                {
                    for (int j = 0; j < 9; j++)
                    {
                        Console.Write(arr[i, j].ToString()+" ");
                    }
                    Console.WriteLine();
                }
            }
            else
            {
                for (int i = 0; i < pos-1; i++)
                {
                    for (int j = 0; j < pos-1; j++)
                    {
                        Console.Write(ToPos(arr[i, j], pos)+ " ");
                    }
                    Console.WriteLine();
                }
            }
        }
        static void Main(string[] args)
        {
            Int32 pos = 0;
            pos = Convert.ToInt32(Console.ReadLine());
            Int32[,] arr = new Int32[9, 9];
            for(int i = 1;i<10;i++)
                for (int j = 1; j < 10; j++)
                {
                    arr[i-1, j-1] = i * j;
                }
            PrintMatr(arr, pos);
            //Console.ReadLine();
            //
        }
    }
}


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

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

            int n = nk[0];
            int k = nk[1];

            List<int> score = Console.ReadLine().Split().Select(int.Parse).ToList();

            int count = 0;

            for (int i = 0; i < n; i++)
            {
                if (score[i] >= score[k - 1])
                {
                    if (score[i] > 0)
                    {
                        count++;
                    }
                }
            }

            Console.WriteLine(count);

            Console.Read();
        }
    }
}


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

namespace ConsoleApplicationTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Int32 output = 0;
            string[] y_temp = Console.ReadLine().Split(' ');
                Int32 part=Convert.ToInt32(y_temp[0]);
               Int32 k = Convert.ToInt32(y_temp[1]);
               if (part < 1 || part > 50) { throw new Exception("Out of range"); }
               if (k > part) { throw new Exception("Out of range"); }
               string[] x_temp = Console.ReadLine().Split(' ');
             List<Int32> score=  Array.ConvertAll(x_temp, Int32.Parse).ToList();
             if (score.Count != part) { throw new Exception("Out of range"); }
            List<Int32> scoreDesc=score.OrderByDescending(x=>x).ToList();
            if (!score.SequenceEqual(scoreDesc)) { throw new Exception("Out of range"); }
            if (part == k) { output=score.FindLastIndex(x => x > 0) + 1; }
            else {
                for (Int32 i = k; i < part; i++)
                {
                    if (score[k - 1] == 0) { output = score.FindLastIndex(x => x > 0) + 1; break; }
                    if (i == part - 1) { if (score[i] == score[k - 1]) { output = part; } }
                    if (score[i] != score[k - 1])
                    {
                        output = i;
                        break;
                    }
                }

    }
            Console.WriteLine(output);
        }
    }
}


using System;
using System.Text.RegularExpressions;

namespace Codeforces
{
    class Codeforces
    {
        public static void Main(string[] args)
        {
            if (Regex.IsMatch(Console.ReadLine(), "0{7,}|1{7,}"))
            {
                Console.Write("YES");
            }

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


using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
    int count = 0;
    for (int i = 0; i < 2; i++)
    {
        string m= Convert.ToString(i);
        string patern = m+m+m+m+m+m+m;
        int n = 0;
        while ((n = input.IndexOf(patern, n)) != -1)
        {
            n += patern.Length;
            count++;
        }
    }
    if (count > 0)
    {
        Console.WriteLine("YES");
    }
    else
    {
        Console.WriteLine("NO");
    }
        }
    }
}


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

namespace Exams
{
    class Program
    {
        private static int n;

        private static int k;

        static void Main(string[] args)
        {
            int[] values = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
            n = values[0];
            k = values[1];

            int result = Solve();
            Console.Out.WriteLine(result);
        }

        private static int Solve()
        {
            for(int i2 = 0; i2 <= n; i2++)
            {
                for(int i3 = 0; i3 <= n - i2; i3++)
                {
                    for(int i4 = 0; i4 <= n - i3 - i2;i4++)
                    {
                        int i5 = n - i4 - i3 - i2;
                        int sum = 2 * i2 + 3 * i3 + 4 * i4 + 5 * i5;

                        if (sum == k)
                        {
//                            Console.Out.WriteLine("{4} = 2 * {0} + 3 * {1} + 4 * {2} + 5 * {3}", i2, i3, i4, i5, sum);

                            return i2;
                        }
                    }
                }
            }

            throw new ArgumentException("no possibility to pass exam");
        }
    }
}


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

namespace ConsoleApplication1
{
    class Scanner
    {
        public Scanner(Stream inputStream)
        {
            m_inputStreamReader = new StreamReader(inputStream);
        }

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

        public long NextLong()
        {
            return Int64.Parse(NextToken());
        }

        public double NextDouble()
        {
            return Double.Parse(NextToken());
        }

        public string NextLine()
        {
            return m_inputStreamReader.ReadLine();
        }

        public char NextChar()
        {
            return (char)m_inputStreamReader.Read();
        }

        private string NextToken()
        {
            char nextChar = (char)0;
            while (IsDelimeter(nextChar))
            {
                nextChar = NextChar();
            }

            string result = "";
            while (!IsDelimeter(nextChar))
            {
                result += nextChar;
                nextChar = NextChar();
            }

            return result;
        }

        private bool IsDelimeter(char c)
        {
            return c <= 32;
        }
        private StreamReader m_inputStreamReader;
    }
    class cf110a
    {
        private static bool IsLucky(int n)
        {
            if(n < 4) return false;
            while (n > 0)
            {
                int d = n % 10;
                if (d != 4 && d != 7)
                    return false;
                n /= 10;
            }
            return true;
        }
        private static bool IsAlmostLucky(int n)
        {
            for (int x = 1; x <= n; ++x)
                if (n % x == 0 && IsLucky(x))
                    return true;
            return false;
        }
        public static void Main()
        {
            var input = new Scanner(Console.OpenStandardInput());
            int n = input.NextInt();
            int sum = input.NextInt();
            int ans = Int32.MaxValue;
            for(int num5 = 0; num5 <= n; ++num5)
                for(int num4 = 0; num4 <= n; ++num4)
                    for(int num3 = 0; num3 <= n; ++num3)
                        for (int num2 = 0; num2 <= n; ++num2)
                        {
                            if (num5 + num4 + num3 + num2 != n)
                                continue;
                            int s = num5 * 5 + num4 * 4 + num3 * 3 + num2 * 2;
                            if (s == sum && num2 < ans)
                                ans = num2;
                        }
            Console.WriteLine(ans);
        }
    }
}


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

namespace Elephant
{
    class Program
    {
        static void Main(string[] args)
        {
        here:    int x = int.Parse(Console.ReadLine());
            if(x<1||x>1000000)
            {
                goto here;
            }
            int sum = 0;
            for(int i=x;i>0;i--)
            {

                if(x>=5)
                {
                    x = x - 5;
                    sum=sum+1;
                }
                else if(x<5&& x>0)
                {
                    sum++;
                    break;
                }

            }
            Console.WriteLine(sum);
        }
    }
}


using System;
class Program
{
    static void Main()
    {
        uint steps=0,n = uint.Parse(Console.ReadLine());
        if (n % 10 > 5) { steps += 2; n -= n % 10; }
        if(n%10<5 && n % 10 != 0) { steps += 1; n -= n % 10; }
        Console.WriteLine(steps+n/5);
    }
}


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

namespace _318A
{
    class Program
    {
        static void Main(string[] args)
        {
            Int64[] arr = Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray();
            Int64 count = 0;
            //var array1 = new int[arr[0]];
            //int j = 0;
            //for(int i = 0; i<arr[0]; i++)
            //{
            //    array1[i] = j + 1;

            //}
            if(arr[0]%2==1)
            {
                if((arr[0]+1)/2<arr[1])
                {
                    Int64 n = arr[1] - (arr[0] + 1) / 2;
                    count = 2 + (n - 1) * 2;
                }

                else
                {
                    Int64 n = arr[1];
                    count = 1 + (n - 1) * 2;
                }
            }
            else
            {
                if (arr[0] / 2 < arr[1])
                {
                    Int64 n = arr[1] - arr[0] / 2;
                    count = 2 + (n - 1) * 2;
                }
                else
                {
                    Int64 n = arr[1];
                    count = 1 + (n - 1) * 2;
                }
            }
            Console.WriteLine(count);

        }
    }
}


using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            UInt64 n = UInt64.Parse(input[0]);
            UInt64 m = UInt64.Parse(input[1]);

            UInt64 answer = 0;
            if (m <= (n / 2 + n % 2))
                answer = m + (m - 1);
            else
                answer = 2 * (m - (n / 2 + n % 2));
            Console.WriteLine(answer);

           // Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;
            List<int> tmp = new List<int>();

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

            for (int i = 0; i < input.Length; i++)
            {
                tmp.Add(Convert.ToInt32(input[i]));
            }
            tmp.Sort();

            Console.WriteLine((tmp[1] - tmp[0]) + (tmp[2] - tmp[1]));
            //Console.ReadLine();
        }
    }
}


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

namespace A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            Array.Sort(line);
            int distance = 300;
            for (int i = line[0]; i <= line[2];i++)
            {
                int temp = Math.Abs(line[0] - i) + Math.Abs(line[1] - i) + Math.Abs(line[2] - i);
                if (distance > temp)
                    distance = temp;
            }
            Console.WriteLine(distance);

        }
    }
}


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

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

            string line = Console.ReadLine();

            string[] input = line.Split(' ');
            string firstName = input[0];
            string lastName = input[1];

            List<string> x = new List<string>();

            for (int i = 0; i < firstName.Length; i++)
            {
                for (int j = 0; j < lastName.Length; j++)
                {
                    string str = firstName.Substring(0, i + 1);
                    string str1 = lastName.Substring(0, j + 1);
                    x.Add(str + str1);
                }
            }

            string minimum = x[0];

            foreach (string str in x)
            {
                if (String.Compare(str, minimum) < 0)
                {
                    minimum = str;
                }
            }

            Console.WriteLine(minimum);
        }
    }

}


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

namespace Генерация_логина
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            string name = input[0];
            string surname = input[1];

            string p1_login = "";
            List<string> logins = new List<string>();
            for (int i = 0; i < name.Length; i++)
            {
                string p2_login = "";
                p1_login += name[i];
                for (int j = 0; j < surname.Length; j++)
                {
                    p2_login += surname[j];
                    logins.Add(p1_login + p2_login);
                }
            }

            logins.Sort();
            Console.WriteLine(logins[0]);
        }
    }
}


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

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

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

            var x = p.Solve();
            p.Out(x);
        }
        object Solve()
        {
            var n = ReadLong();
            var m = ReadLong();
            long i = 0;
            while(n <= m)
            {
                n *= 3;
                m *= 2;
                i++;
            }
            return i;

        }

        long BS(long remain, long l, long r)
        {
            if (r - l == 1)
                return r;
            var half = (l + r) / 2;
            var sum = half * (half + 1) / 2;
            if (sum < remain)
                return BS(remain, half, r);
            return BS(remain, l, half);
        }

        class Pair
        {
            public long Val;
            public long Rem;
            public long Count1;
            public long Len;
        }

        Node FindDeepest(Node current, long target, Node bad)
        {
            Node result = null;
            for (int i = 0; i < current.Children.Count; i++)
            {
                if (current.Children[i] == bad)
                    continue;
                result = FindDeepest(current.Children[i], target, bad);
                if (result != null)
                {
                    break;
                }
            }
            if (current.parent != -1 && result == null && current.sum == target)
                return current;
            return result;
        }

        long CalcSum(Node current)
        {
            var sum = current.t;
            for (int i = 0; i < current.Children.Count; i++)
            {
                sum += CalcSum(current.Children[i]);
            }
            current.sum = sum;
            return sum;
        }

        class Node {
            public long parent;
            public long index;
            public long t;
            public long sum;
            public List<Node> Children;
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
}


using System;

namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split(' ');

            var a = int.Parse(word[0]);
            var b = int.Parse(word[1]);
            var year = 0;

            while (a <= b) {
                a *= 3;
                b *= 2;
                year++;
            }
            Console.WriteLine(year);
            Console.ReadLine();
        }
    }
}


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

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), bx = int.Parse(s[1]);
            long x = 0;
            int[] vx = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            for (int i = 0; i < n; i++) {
                x *= bx;
                x += vx[i];
            }
            s = Console.ReadLine().Split(' ');
            int m = int.Parse(s[0]), by = int.Parse(s[1]);
            long y = 0;
            int[] vy = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            for (int i = 0; i < m; i++) {
                y *= by;
                y += vy[i];
            }
            if (x == y) {
                Console.Write('=');
            } else if (x < y) {
                Console.Write('<');
            } else {
                Console.Write('>');
            }
            //Console.ReadKey();
        }
    }
}


using System;
using System.Linq;

namespace CSharp
{
    public class _602A
    {
        public static void Main()
        {
            ulong x = Read();
            ulong y = Read();

            Console.WriteLine(x > y ? '>' : x < y ? '<' : '=');
        }

        private static ulong Read()
        {
            uint b = uint.Parse(Console.ReadLine().Split().Last());

            ulong n = 0;
            foreach (uint d in Console.ReadLine().Split().Select(token => uint.Parse(token)))
            {
                n = n * b + d;
            }

            return n;
        }
    }
}


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

namespace Ladder4
{
    class Prob16
    {
        static void Main(string[] args)
        {
            int [] input = Console.ReadLine().Split(' ').Select(alias => int.Parse(alias)).ToArray();
            int [] puzzles = Console.ReadLine().Split(' ').Select(alias => int.Parse(alias)).ToArray();
            List<int> mins = new List<int>();
            int x = input[0];
            Array.Sort(puzzles);
            if (input[0] == puzzles.Length)
                Console.WriteLine(puzzles[puzzles.Length - 1] - puzzles[0]);
            else
            {
                for (int i = 0; i <= puzzles.Length - input[0]; i++)
                {
                    int difference = puzzles[x - 1] - puzzles[i];
                    mins.Add(difference);
                    x++;
                }
                int output = 999999999;
                for (int j = 0; j < mins.Count; j++)
                    output = Math.Min(output, mins[j]);
                Console.WriteLine(output);
            }
            //while (true) ;
        }
    }
}


using System;

namespace _337A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            input = Console.ReadLine().Split(' ');
            int[] numbers = new int[m];
            for (int i = 0; i < m; i++)
            {
                numbers[i] = int.Parse(input[i]);
            }
            for (int i = 0; i < m; i++)
            {
                for (int j = i + 1; j < m; j++)
                {
                    if (numbers[i] > numbers[j])
                    {
                        int temp = numbers[i];
                        numbers[i] = numbers[j];
                        numbers[j] = temp;
                    }
                }
            }
            int min = 10000;
            for (int i = 0; i <= m - n; i++)
            {
                int cur = numbers[i + n - 1] - numbers[i];
                if (cur < min) min = cur;
            }
            Console.WriteLine(min);
        }
    }
}


using System;
using System.Collections.Generic;

namespace teh_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] InputString = Console.ReadLine().Split();
            int[] Array = new int[6];
            int SumAll = 0;
            for (int i = 0; i < 6; i++)
            {
                Array[i] = Convert.ToInt32(InputString[i]);
                SumAll += Array[i];
            }
            if (SumAll % 2 == 1)
            {
                Console.WriteLine("NO");
                return;
            }
            else
            {
                for (int i = 0; i < 6; i++)
                {
                    for (int j = i + 1; j < 6; j++)
                    {
                        for (int p = j + 1; p < 6; p++)
                        {
                            if (Array[i] + Array[j] + Array[p] == SumAll / 2)
                            {
                                Console.WriteLine("YES");
                                return;
                            }
                        }
                    }
                }
            }
            Console.WriteLine("NO");
        }
    }
}


using System;
namespace _886A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            bool result = false;
            for (int i = 0; i < 6; i++)
                for (int j = i + 1; j < 6; j++)
                    for (int k = j + 1; k < 6; k++)
                    {
                        int sum1 = a[i] + a[j] + a[k], sum2 = 0;
                        for (int x = 0; x < 6; x++)
                            if (x != i && x != j && x != k)
                                sum2 += a[x];
                        if (sum1 == sum2)
                            result = true;
                    }
            Console.WriteLine(result ? "YES" : "NO");
        }
    }
}


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

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

namespace ed16
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

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

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

        static void solution()
        {
            #region SOLUTION
            var s = Console.ReadLine();
            var f = (int)s[0] - 96;
            var line = int.Parse(s.Substring(1, 1));
            if (line > 1 && line < 8 && f > 1 && f < 8)
            {
                Console.WriteLine(8);
                return;
            }

            if ((f == 1 && (line == 1 || line == 8)) || (f == 8 && (line == 1 || line == 8)))
            {
                Console.WriteLine(3);
                return;
            }

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

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

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

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

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

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

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

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


using System;

namespace CSharp
{
    public class _710A
    {
        public static void Main()
        {
            string cd = Console.ReadLine();

            int count = 0;

            for (int i = -1; i <= 1; i++)
            {
                for (int j = -1; j <= 1; j++)
                {
                    char c = (char)(cd[0] + i);
                    char d = (char)(cd[1] + j);

                    if (c >= 'a' && c <= 'h' && d >= '1' && d <= '8' && cd != new string(new char[] { c, d }))
                    {
                        count++;
                    }
                }
            }

            Console.WriteLine(count);
        }
    }
}


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

namespace Task55A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int ct = 0;
            int omit = 0;
            int sit = 1;
            HashSet<int> container = new HashSet<int>() { sit };
            string ans = "NO";
            while (true)
            {
                if (container.Count == n)
                {
                    ans = "YES";
                    break;
                }
                else if (omit > 2 * n)
                    break;

                sit += omit;
                if (sit > n) sit %= n;
                container.Add(sit);
                omit++;

            }
            Console.WriteLine(ans);
            //Console.ReadKey();
        }
    }
}


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

namespace ProgrammingContest.Codeforces.Round51
{
    class A
    {
        static bool check(int n)
        {
            bool[] used = new bool[n];
            for (int i = 0, j = 1; j<100000;i=(i+j)%n, j++)
                used[i] = true;
            for (int i = 0; i < n; i++)
                if (!used[i])
                    return false;
            return true;
        }
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            //for (int n = 1; n <= 1000; n++)
            {
                bool[] used = new bool[n];
                for (int i = 0, j = 1; !used[i]; j++)
                {
                    used[i] = true;
                    //Console.WriteLine(i);
                    i = (i + j) % n;
                }
                //Console.WriteLine(check(n));
                bool ok = true;
                for (int i = 0; i < n; i++)
                    if (!used[i])
                    {
                        ok = false;
                        //Console.WriteLine("NO");
                        //return;
                    }
                //Console.WriteLine("YES");
                Console.WriteLine( ok ? "YES":"NO");
            }
        }
    }
}


using System;

namespace myApp {
    class Program {
        static void Main (string[] args) {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Array.Sort(a);
            Array.ForEach(a, x => Console.Write(x + " "));
        }
    }
}


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

namespace Problem405A {
    class Program {
        static void Main(string[] args) {
            int columns = Convert.ToInt32(Console.ReadLine());
            string[] input1 = Console.ReadLine().Split(' ');
            int[] columnsInState1 = new int[columns];
            for (int i = 0; i < columns; i++) {
                columnsInState1[i] = Convert.ToInt32(input1[i]);
            }

            int[] sortedColumns = new int[columns];

            for (int i = 0; i < columns; i++) {
                int minTmp = int.MaxValue;
                int minTmpIndex = 0;
                for (int j = 0; j < columns; j++) {
                    int actColumn = columnsInState1[j];
                    if (actColumn < minTmp) {
                        minTmp = actColumn;
                        minTmpIndex = j;
                    }
                }
                sortedColumns[i] = minTmp;
                columnsInState1[minTmpIndex] = int.MaxValue;
            }

            for (int i = 0; i < columns; i++) {
                Console.Write(sortedColumns[i]);
                Console.Write(' ');
            }
            Console.Write(Environment.NewLine);
        }
    }
}


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

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

            int n = 0;

            foreach(char a in s)
            {
                if(a == 'a')
                {
                    n++;
                }
            }
            if (n > s.Length / 2)
            {
                Console.WriteLine(s.Length);
            }
            else
            {
                Console.WriteLine(n * 2 - 1);
            }
        }
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            var a = s.Count(c => c == 'a');
            var res = a - 1;
            Console.WriteLine(Math.Min(s.Length, res + a));

            //int n = Convert.ToInt32(Console.ReadLine());
            //int k = 0;
            //for (int i = 1; i < n; i++)
            //{
            //    if (n % i == 0)
            //        k++;
            //}
            //Console.WriteLine(k);

            //string str = Console.ReadLine();
            //string[] s = str.Split(' ');

            //int a = Convert.ToInt32(s[0]);
            //int b = Convert.ToInt32(s[1]);
            //int i = 0;
            //while (a <= b)
            //{
            //    a *= 3;
            //    b *= 2;
            //    i++;
            //}
            //Console.WriteLine(i);

            //string str = Console.ReadLine();
            //string[] s = str.Split(' ');

            //int n = Convert.ToInt32(s[0]);
            //int m = Convert.ToInt32(s[1]);
            //int k = Convert.ToInt32(s[2]);

            //if (m < n || k < n)
            //{
            //    Console.WriteLine("No");
            //}
            //else
            //{
            //    Console.WriteLine("Yes");
            //}

            //string str = Console.ReadLine();
            //string[] s = str.Split(' ');
            //int t = Convert.ToInt32(str);

            //string a = "I hate";
            //string b = " that I love";
            //string c = " that I hate";

            //for (int i = 0; i < t-1; i++)
            //{
            //    if (i % 2 == 1)
            //    {
            //        a += c;
            //    }
            //    else if( i % 2 == 0)
            //    {
            //        a += b;
            //    }
            //}
            //    Console.WriteLine($"{a} it");

            //int n = Convert.ToInt32(Console.ReadLine());
            //int a = n % 2;
            //if (a == 0)
            //{
            //    Console.WriteLine("Mahmoud");
            //}
            //else
            //{
            //    Console.WriteLine("Ehab");
            //}

            //string str = Console.ReadLine();
            //string[] s = str.Split(' ');

            //int n = Convert.ToInt32(s[0]);
            //int k = Convert.ToInt32(s[1]);

            //int count = 0;
            //while (count < k)
            //{
            //    if (n % 10 == 0)
            //    {
            //        n = n / 10;
            //    }
            //    else
            //    {
            //        n = n - 1;
            //    }
            //    count++;
            //}
            //Console.WriteLine(n);

            //string[] s = Console.ReadLine().Split(' ');
            //int x = int.Parse(s[0]);
            //int y = int.Parse(s[1]);
            //int z = int.Parse(s[2]);

            //if ((x + y >= z) && (y + z >= x) && (x + z >= y))
            //{
            //    Console.WriteLine("YES");
            //}
            //else
            //{
            //    Console.WriteLine("NO");
            //}

            //int x = Convert.ToInt32(Console.ReadLine());

            //    int count = 0;

            //    count += x / 100;
            //    x %= 100;
            //    count += x / 20;
            //    x %= 20;
            //    count += x / 10;
            //    x %= 10;
            //    count += x / 5;
            //    x %= 5;
            //    count += x;

            //Console.WriteLine(count);
        }
    }
}


namespace Problem1
{
	using System;
	using System.Text;
	using System.Linq;

	public static class Program
	{
		static void Main(string[] args)
		{
			// Cases
			// d1, d3, d2
			// d1, d3, d3, d1
			// d2, d3, d3, d2
			// d1, d1, d2, d2

			int[] l = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

			Console.WriteLine(new[]
			{
				l[0] + l[2] + l[1],
				l[0] + l[2] + l[2] + l[0],
				l[1] + l[2] + l[2] + l[1],
				l[0] + l[0] + l[1] + l[1],
			}
			.Min());
		}
	}
}


using System;
using System.Linq;
public class CF
{
    public static void Main()
    {
        var ds = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int d1 = ds[0];
        int d2 = ds[1];
        int d3 = ds[2];
        int p1 = d1 + d1 + d2 + d2;
        int p2 = d1 + d1 + d3 + d3;
        int p3 = d2 + d2 + d3 + d3;
        int p4 = d1 + d2 + d3;
        Console.Write(Math.Min(Math.Min(Math.Min(p1,p2),p3),p4));
        //Console.ReadKey();
    }
}


using System;
using System.Linq;

namespace CSharp
{
    public class _478C
    {
        public static void Main()
        {
            long[] counts = Console.ReadLine().Split().Select(token => long.Parse(token)).ToArray();

            long sum = counts.Sum();
            long max = counts.Max();

            Console.WriteLine(2 * sum >= 3 * max ? sum / 3 : sum - max);
        }
    }
}


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public object Solve()
    {
        var a = ReadLongArray();
        Array.Sort(a);
        long x = Math.Min(a[2] - a[1], a[0]);
        a[1] += x;
        a[0] -= x;

        a[1] += a[0] / 2;
        a[2] += (a[0] + 1) / 2;

        return Math.Min(a[1], (a[1] + a[2]) / 3);

        return null;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

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

    #endregion

    #region Read / Write

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

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

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

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

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

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

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

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

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

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

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

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

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

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }

    #endregion
}


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

namespace CF_399A
{
    class Program
    {
        static void Main()
        {
            int n, p, k;
            var input = Console.ReadLine().Split(' ');
            n = int.Parse(input[0]);
            p = int.Parse(input[1]);
            k = int.Parse(input[2]);
            string output = "";
            if (p > n || p < 1)
            {
                return;
            }
            if (p > k + 1)
            {
                output += "<< ";
                for(int i= p - k; i < p; i++)
                {
                    output += i + " ";
                }

            }
            else
            {
                for (int i = 1; i < p; i++)
                {
                    output += i + " ";
                }
            }

            output += $"({p})";

            if(p < n - k)
            {
                for (int i = p+1; i <= p+k; i++)
                {
                    output += " " + i;
                }
                output += " >>";
            }
            else
            {
                for (int i = p+1; i <= n; i++)
                {
                    output += " " + i;
                }
            }

            Console.WriteLine(output);
        }
    }
}


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

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

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

            int first = p - k;
            bool ok = false;
            if (first > 1)
            {
                writer.Write("<<");
                ok = true;
            }
            for (int i = Math.Max(1, first); i < p; i++)
            {
                if (ok)
                    writer.Write(' ');
                writer.Write(i);
                ok = true;
            }

            if (ok)
                writer.Write(' ');
            writer.Write('(');
            writer.Write(p);
            writer.Write(')');

            first = Math.Min(n, p + k);
            for (int i = p + 1; i <= first; i++)
            {
                writer.Write(' ');
                writer.Write(i);
            }

            if (first!=n)
            {
                writer.Write(" >>");
            }

            writer.Flush();
        }

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


#define Online

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

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            A();

#if Online
            Console.ReadLine();
#endif

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

        static void A()
        {
            int n = ReadInt();
            if (n >= 0)
            {
                Console.WriteLine(n);
            }
            else
            {
                string _n = n.ToString();
                if (_n.Length == 3 && _n[2].Equals('0'))
                {
                    Console.WriteLine(0);
                    return;
                }
                if (_n[_n.Length - 1] >= _n[_n.Length - 2])
                {
                    for (int i = 0; i < _n.Length - 1; i++)
                    {
                        Console.Write(_n[i]);
                    }
                }
                else
                {
                    for (int i = 0; i < _n.Length - 2; i++)
                    {
                        Console.Write(_n[i]);
                    }
                    Console.Write(_n[_n.Length - 1]);
                }
            }
        }

        static void B()
        {

        }

        static void C()
        {

        }

        static void D()
        {

        }

        static void E()
        {

        }

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

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

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

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

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

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }

    class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;
        public Stack<int> ans = new Stack<int>();
        public Graph(int n)
        {
            g = new List<int>[n + 1];
            for (int i = 0; i <= n; i++)
                g[i] = new List<int>();
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }

        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public bool DFS(int u, ref int time)
        {
            color[u] = gray;
            time++;
            o[u] = time;
            for (int i = 0; i < g[u].Count; i++)
            {
                int v = g[u][i];
                if (color[v] == gray)
                {
                    return true;
                }
                if (color[v] == white)
                {
                    p[v] = u;
                    if (DFS(v, ref time)) return true;
                }
            }
            color[u] = black;
            ans.Push(u);
            c[u] = time;
            time++;
            return false;
        }
    }

    static class GraphUtils
    {
        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public static void BFS(int s, Graph g)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(s);
            while (q.Count != 0)
            {
                int u = q.Dequeue();
                for (int i = 0; i < g.g[u].Count; i++)
                {
                    int v = g.g[u][i];
                    if (g.color[v] == white)
                    {
                        g.color[v] = gray;
                        g.d[v] = g.d[u] + 1;
                        g.p[v] = u;
                        q.Enqueue(v);
                    }
                }
                g.color[u] = black;
            }
        }

        public static bool DFS(int u, ref int time, Graph g, Stack<int> st)
        {
            g.color[u] = gray;
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == gray)
                {
                    return true;
                }
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    if (DFS(v, ref time, g, st)) return true;
                }
            }
            g.color[u] = black;
            st.Push(u);
            g.c[u] = time;
            time++;
            return false;
        }

        public static void FordBellman(int u, Graph g)
        {
            int n = g.g.Length;
            for (int i = 0; i <= n; i++)
            {
                g.d[i] = int.MaxValue;
                g.p[i] = 0;
            }

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }

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

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

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

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

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

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

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

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

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

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

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

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

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}


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

namespace SolvingAlgorithms
{
    class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();
            long inp = Convert.ToInt64(input);
            long  output = 0;
            Char[] inpC = new Char[input.Length];
            for (int i = 0; i < inpC.Length; i++)
            {
                inpC[i] = input[i];
            }

            if (inp > 0)
            {
                output = inp;
            }
            else if (inp >= -10)
            {
                output = 0;
            }
            else
            {
                int q= input.Length;
                int a = Convert.ToInt32(input.Remove(q - 1,1));
                int b = Convert.ToInt32(input.Remove(q - 2,1));
                if (a > b)
                {
                    output = a;
                }
                else
                    output = b;

            }

            Console.WriteLine(output);

        }
    }
}


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

namespace CodeForces.PRACTICE
{
    // Vanya and Books (implementation, math)
    class _552B
    {
        public static long NumberOfDigits(int n)
        {
            long num = n, res = 0, p = 1, len = 1;
            while (num > 9) { res += 9 * p * len; num /= 10; p *= 10; len++; }
            res += (n - p + 1) * len;
            return res;
        }

        // !!!
        public static long NumberOfDigitsNew(int n)
        {
            long res = 0;
            for (long i = 1; i <= n; i *= 10)
                res += n - i + 1;
            return res;
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(NumberOfDigitsNew(n));
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static long N, cnt_dig, cnt = 1;

        public static void Main()
        {
            N = Convert.ToInt32(Console.ReadLine());

            for (int i = 1; i <= 1000000000; i*=10)
            {
                if (N < i)
                    break;

                else if (N >= i && N < i * 10)
                    cnt_dig += (N - i + 1) * cnt;

                else if (N >= i * 10)
                    cnt_dig += (i * 10 - i) * cnt;

                ++cnt;
            }

            Console.WriteLine(cnt_dig);
           // Console.ReadKey();
        }
    }

}


#region imports
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

#endregion

namespace CodeForces
{
    class Problem
    {
        const bool IsContest = true;

        private void Solve()
        {
            var length = _.NextInt();
            var sum = _.NextInt();
            _.WriteLine(MinNumber(length, sum) + " " + MaxNumber(length, sum));

        }

        private string MaxNumber(int length, int sum)
        {
            if (sum == 0)
            {
                return length == 1 ? "0" : "-1";
            }

            var maxSum = length * 9;
            if (sum > maxSum) return "-1";
            var ans = "";

            while (sum > 0)
            {
                var t = Math.Min(sum, 9);
                ans += t;
                sum -= t;
            }
            return ans.PadRight(length, '0');
        }

        private string MinNumber(int length, int sum)
        {
            if (sum == 0)
            {
                return length == 1 ? "0" : "-1";
            }

            var maxSum = length * 9;
            if (sum > maxSum) return "-1";

            var ans = "";
            var mustBreak = false;
            while (sum > 0 && !mustBreak)
            {
                var t = Math.Min(sum, 9);
                if (sum - t == 0 && length > 1)
                {
                    t--;
                    mustBreak = true;
                }
                ans = t + ans;
                length--;
                sum -= t;
            }
            while (length > 1)
            {
                ans = '0' + ans;
                length--;
            }
            if (sum > 0)
            {
                ans = sum + ans;
            }
            return ans;
        }

        #region shit
        private readonly InOut _ = new InOut(IsContest);
        static void Main(string[] args)
        {
            var p = new Problem();
            p.Solve();
            p._.Close();
        }
    }
    class InOut
    {
        private const string InputFile = "input.txt";
        private const string OutputFile = "output.txt";
        public StreamWriter Cout { get; private set; }
        public StreamReader Cin { get; private set; }
        private void SetConsoleIo()
        {
            Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));
            Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));
        }
        private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }
        public InOut() { SetConsoleIo(); }
        public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }
        public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }
        public void WriteLine(object x) { Cout.WriteLine(x); }
        public void Close() { Cin.Close(); Cout.Close(); }
        public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }
        private int _pos;
        private string[] _tokens;

        private string[] NextStringArray() { return Cin.ReadLine().Split(" \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }
        public string NextToken()
        {
            while (_tokens == null || _pos == _tokens.Length)
            {
                // ReSharper disable once PossibleNullReferenceException
                _tokens = NextStringArray();
                _pos = 0;
            }
            return _tokens[_pos++];
        }
        public int NextInt() { return int.Parse(NextToken()); }
        public long NextLong() { return long.Parse(NextToken()); }
        public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }
        public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }
        public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }
        #endregion
    }
}


using System;

namespace длина_и_сумма
{
    class Program
    {
        static int numberLength;
        static int symbolsSum;

        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] strArr = str.Split(' ');
            numberLength = int.Parse(strArr[0]); // Длина числа
            symbolsSum = int.Parse(strArr[1]); // Сумма цифр

            Console.WriteLine(GetMin() + " " + GetMaximum());
            /*
            100
            n = 3 Нулей = n - 1
            s = 15
            10059 -> 90000
             */
             // 10059
        }

        static string GetMin()
        {
            // 1 0
            if (numberLength == 1 && symbolsSum == 0)
                return "0";

            if (9 * numberLength < symbolsSum || symbolsSum == 0)
            {
                return "-1";
            }
            // 5
            // 3

            // 30000
            int[] symbols = new int[numberLength];

            int currentSymbolsSum = symbolsSum;

            int i = numberLength - 1;
            // 3 0
            for (; i >= 0; i--)
            {
                if (currentSymbolsSum > 9)
                {
                    symbols[i] = 9;
                    currentSymbolsSum -= symbols[i];
                }
                else
                {
                    symbols[i] = currentSymbolsSum;
                    break;
                }
            }
            if (symbols[0] == 0)
            {
                symbols[0] = 1;
                symbols[i] = symbols[i] - 1;
            }

            return string.Join("", symbols);
        }

        static string GetMaximum()
        {
            if (numberLength == 1 && symbolsSum == 0)
                return "0";

            if (9 * numberLength < symbolsSum || symbolsSum == 0)
            {
                return "-1";
            }
            int[] symbols = new int[numberLength];
            // symbols[0] = 9. symbols[1] = 0. symbols[2] = 0
            // numberLength = 3
            // currentSymbolsSum = 25
            // 960
            // currentSymbolsSum = 6
            int currentSymbolsSum = symbolsSum;
            for (int i = 0; i < numberLength; i++)
            {
                if (currentSymbolsSum >= 9)
                {
                    symbols[i] = 9;
                    currentSymbolsSum -= symbols[i];
                }
                else
                {
                    symbols[i] = currentSymbolsSum;
                    break;
                }
            }
            return string.Join("", symbols);
        }
    }
}


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int k = 0;
            for (int i = 1; i <= n/2; i++)
            {
                if ( (n - i) % i == 0)
                {
                    k++;
                }
            }

            Console.WriteLine(k);
        }
    }
}


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

class A935 {
    public static void Main() {
        var n = int.Parse(Console.ReadLine());
        Console.WriteLine(Divisor.Of(n, new OpsInt()).Count() - 1);
    }

    // Snippet: Divisor
    class Divisor {
        public static IEnumerable<T> Of<T>(T n, IOps<T> ops) {
            var i = ops.One();
            for (; ops.Less(ops.Mul(i, i), n); i = ops.Inc(i))
                if (ops.IsZero(ops.Mod(n, i))) {
                    yield return i;
                    yield return ops.Div(n, i);
                }
            if (ops.Eq(ops.Mul(i, i), n)) yield return i;
        }
    }

    // Snippet: IOps
    interface IOps<T> {
        T From(int a);
        T Zero();
        T One();
        T MinusOne();
        T MinValue();
        T MaxValue();

        bool IsEven(T a);
        bool IsOne(T a);
        bool IsZero(T a);
        int Sign(T a);

        T Inc(T a);
        T Dec(T a);
        T Abs(T a);
        T Add(T a1, T a2);
        T Sub(T a1, T a2);
        T Mul(T a1, T a2);
        T Div(T a1, T a2);
        T Mod(T a1, T a2);
        T Shl(T a1, int a2);
        T Shr(T a1, int a2);
        T Max(T a1, T a2);
        T Min(T a1, T a2);

        bool Less(T a1, T a2);
        bool Eq(T a1, T a2);
    }

    // Snippet: OpsInt
    class OpsInt : IOps<int> {
        public int From(int a) { return a; }
        public int Zero() { return 0; }
        public int One() { return 1; }
        public int MinusOne() { return -1; }
        public int MinValue() { return int.MinValue; }
        public int MaxValue() { return int.MaxValue; }

        public bool IsEven(int a) { return (a & 1) == 0; }
        public bool IsOne(int a) { return a == 1; }
        public bool IsZero(int a) { return a == 0; }
        public int Sign(int a) { return a; }

        public int Inc(int a) { return a + 1; }
        public int Dec(int a) { return a - 1; }
        public int Abs(int a) { return Math.Abs(a); }
        public int Add(int a1, int a2) { return a1 + a2; }
        public int Sub(int a1, int a2) { return a1 - a2; }
        public int Mul(int a1, int a2) { return a1 * a2; }
        public int Div(int a1, int a2) { return a1 / a2; }
        public int Mod(int a1, int a2) { return a1 % a2; }
        public int Shl(int a1, int a2) { return a1 << a2; }
        public int Shr(int a1, int a2) { return a2 >> a2; }
        public int Max(int a1, int a2) { return Math.Max(a1, a2); }
        public int Min(int a1, int a2) { return Math.Min(a1, a2); }

        public bool Less(int a1, int a2) { return a1 < a2; }
        public bool Eq(int a1, int a2) { return a1 == a2; }
    }
}


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

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

            //Console.SetIn(new StreamReader("file.in"));
            /*
            FileStream filestream = new FileStream("out.txt", FileMode.Create);
            var streamwriter = new StreamWriter(filestream);
            streamwriter.AutoFlush = true;
            Console.SetOut(streamwriter);
            */

            int n = int.Parse(Console.ReadLine());
            int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), ts => int.Parse(ts));
            Array.Sort(v);
            int aux = v[0];
            v[0] = v[n - 1];
            v[n - 1] = aux;
            for (int i = 0; i < n; i++) {
                Console.Write("{0} ", v[i]);
            }

            //Console.ReadKey();
        }
    }
}


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

namespace CodeForces
{
    class DifferenceRow
    {
        static void Main()
        {
            Run();
        }
        static void Run()
        {
            int n = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split();
            List<int> p = new List<int>();
            for (int i = 0; i < n; i++)
            {
                int num = int.Parse(str[i]);
                p.Add(num);
            }
            p.Sort();
            int pCount = p.Count;
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("{0} ", p.Last());
            for (int i = 1; i < pCount - 1; i++)
                sb.AppendFormat("{0} ", p[i]);
            sb.AppendFormat("{0} ", p.First());
            Console.WriteLine(sb.ToString().TrimEnd());
        }
    }
}


using System;
using System.Linq;

namespace CodeForce1
{
    class Program
    {
        static void Main(string[] args)
        {
            string matrix = Console.ReadLine();
            matrix = new string(matrix.Distinct().ToArray());
            if (matrix.Length % 2 != 0)
            {
                Console.WriteLine("IGNORE HIM!");
            }
            else
            {
                Console.WriteLine("CHAT WITH HER!");
            }
            Console.Read();
        }
    }
}


using System;

class Program
{
    static bool Identification(string line)
    {
        int[] arr = new int['z' - 'a' + 1];
        int count = 0;
        for (int i = 0; i < line.Length; i++)
            if (arr[line[i] - 'a'] != 1)
            {
                arr[line[i] - 'a'] = 1;
                count++;
            }
        if (count % 2 == 1)
            return false;
        else
            return true;
    }

    static void Main()
    {
        if (Identification(Console.ReadLine()))
            Console.WriteLine("CHAT WITH HER!");
        else
            Console.WriteLine("IGNORE HIM!");

    }
}