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

public class CodeForces87
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = false;
#else
const bool testing = false;
#endif

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

    static void program(TextReader input)
     {
        //reader.ReadLine();
        //var data = reader.ReadLine().TrimEnd().Split(' ').Select(long.Parse).ToList();

        var n = long.Parse(reader.ReadLine());
        var ns = n.ToString();
        var result = int.MaxValue;
        for (var i = 0; i < Math.Pow(2, 10);i++){
            var s = Convert.ToString(i, 2).PadLeft(9).Substring(0, ns.Length);
            var news = new StringBuilder();
            for (var j = 0; j < s.Length;j++){
                if(s[j] == '1'){
                    news.Append(ns[j]);
                }
            }

            var res = news.ToString();
            if(res.Length > 0 && res[0] != '0'){
                var pos = int.Parse(res);
                if(Math.Sqrt(pos) % 1 == 0){
                    result = Math.Min(result, ns.Length - pos.ToString().Length);
                }
            }
        }
        Console.WriteLine(result == int.MaxValue ? -1 : result);
    }

    public static void Main(string[] args)
    {
        CultureInfo nonInvariantCulture = new CultureInfo("en-US");
        Thread.CurrentThread.CurrentCulture = nonInvariantCulture;
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("3\n2\n4\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("4 3\n2\n3\n4\n"));
        Console.WriteLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("13\n3\n8\n9\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("13 4\n10\n5\n4\n8\n"));
        Console.WriteLine();

    }
}


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

namespace _227A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split(' ');
            string[] b = Console.ReadLine().Split(' ');
            string[] c = Console.ReadLine().Split(' ');

            int xa = Convert.ToInt32(a[0]);
            int ya = Convert.ToInt32(a[1]);
            int xb = Convert.ToInt32(b[0]);
            int yb = Convert.ToInt32(b[1]);
            int xc = Convert.ToInt32(c[0]);
            int yc = Convert.ToInt32(c[1]);

            int k = (xb - xa) * (yc - yb) - (xc - xb) * (yb - ya);

            if (k > 0) Console.WriteLine("LEFT");
            else
            {
                if (k == 0) Console.WriteLine("TOWARDS");
                else Console.WriteLine("RIGHT");
            }
            Console.ReadLine();
        }
    }
}


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

namespace A.Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string text = Console.ReadLine();
            for (int i = 0; i < n; i++)
            {
                text = text.Replace("RU", "D");

            text = text.Replace("UR", "D");

            }

            Console.WriteLine(text.Length);
        }
    }
}


class Program
    {
        static void Main(string[] args)
        {
            int length = int.Parse(Console.ReadLine());
            string sequence = Console.ReadLine();
            sequence = sequence.Replace("UR", "D");
            sequence = sequence.Replace("RU", "D");

            Console.WriteLine(sequence.Length);
            Console.ReadKey();

        }
    }


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

namespace shagi
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32( Console.ReadLine());
            StringBuilder steps = new StringBuilder (Console.ReadLine());
            int i;
            for (i = 0; i <= steps.Length - 1; i++)
            {
                if (steps[i]=='U' && steps[i + 1] == 'R')
                {
                    steps.Remove(i, 2);
                    steps.Insert(i, 'D');

                }
                if (steps[i] == 'R' && steps[i + 1] == 'U')
                {
                    steps.Remove(i, 2);
                    steps.Insert(i, 'D');

                }

            }
            Console.WriteLine(steps.Length);
        }
    }
}


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

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int[] kq = new int[b - a + 1];
            for(int i = 0; i < kq.Length; i++)
                kq[i] = (a + i) * (a + i) - (a + i) * (a + b) + (a * a + b * b + b - a) / 2;
            Console.WriteLine(kq.Min());
        }
    }
}


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

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

            int n, R, r;
            ang=0;

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

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


От NickSerg, контест: Codeforces Round #100, задача: (A) Новогодний стол, Неправильный ответ на претест 6, #

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

    namespace Codeforces
    {
        internal class Program
        {
            private static string Read()
            {
                return Console.ReadLine();
            }
            private static string[] ReadArray()
            {
                return Console.ReadLine().Split(' ');
            }
            private static int ReadInt()
            {
                return Int32.Parse(Console.ReadLine());
            }
            private static long ReadLong()
            {
                return long.Parse(Console.ReadLine());
            }
            private static int ReadNextInt(string[] input, int index)
            {
                return Int32.Parse(input[index]);
            }

            private static void Main()
            {
                var input = ReadArray();
                var n = ReadNextInt(input, 0);
                var rR = ReadNextInt(input, 1);
                var r = ReadNextInt(input, 2);
                if(r==rR && n == 1)
                {
                    Console.WriteLine("YES");
                    return;
                }
                if(r >= rR)
                {
                    Console.WriteLine("NO");
                    return;
                }
                if(2 * r > rR)
                {
                    if(n == 1)
                        Console.WriteLine("YES");
                    else
                    {
                        Console.WriteLine("NO");
                    }
                    return;
                }
                if(2 * r == rR)
                {
                    if(n <= 2)
                        Console.WriteLine("YES");
                    else
                    {
                        Console.WriteLine("NO");
                    }
                    return;
                }

                var a = 2 * Math.Asin((double) r/(rR - r));
                if(a * n <= 2 * Math.PI && a > 0)
                    Console.WriteLine("YES");
                else
                {
                    Console.WriteLine("NO");
                }

            }
        }
    }


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

namespace TestConsole
{
    public class Program
    {
        static void Main(string[] args)
        {
            var money = long.Parse(Console.ReadLine());
            Console.WriteLine(CalculateLottery(money));
        }

        private static long CalculateLottery(long money)
        {
            long billCount = 0;
            var bills = new[] { 100, 20, 10, 5, 1 };

            foreach (var bill in bills)
            {
                while (money > 0)
                {
                    var count = money / bill;
                    money -= count * bill;
                    billCount += count;
                }
            }

            return billCount;
        }
    }
}


using System;

namespace TestConsole
{
    public class Program
    {
        static void Main(string[] args)
        {
            var money = long.Parse(Console.ReadLine());
            Console.WriteLine(CalculateLottery(money));
        }

        private static long CalculateLottery(long money)
        {
            long billCount = 0;
            var bills = new[] { 100, 20, 10, 5, 1 };

            foreach (var bill in bills)
            {
                while (money > 0)
                {
                    var count = money / bill;
                    money -= count * bill;
                    billCount += count;
                }
            }

            return billCount;
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1062
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp7", "ConsoleApp7.csproj", "{0BE878F0-59C5-4937-97E2-067D4DE3BF00}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{0BE878F0-59C5-4937-97E2-067D4DE3BF00}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {33B23004-8358-49E5-B718-E34496A6C7BA}
	EndGlobalSection
EndGlobal


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int k = 0;
            while (n != 0)
            {
                if (n >= 100)
                {
                    n -= 100;
                    k++;
                }
                else if (n >= 20)
                {
                    n -= 20;
                    k++;
                }
                else if (n >= 10)
                {
                    n -= 20;
                    k++;
                }
                else if (n >= 5)
                {
                    n -= 5;
                    k++;
                }
                else if (n >= 1)
                {
                    n -= 1;
                    k++;
                }

            }
            Console.WriteLine(k);

        }
    }
}


        int n = int.Parse(Console.ReadLine());
        int count = 0;

        while (n != 0)
        {
            count += n / 100;
            n = n % 100;
            count += n / 20;
            n = n % 20;
            count += n / 5;
            n = n % 5;
            count += n / 2;
            n = n % 2;
            count += n / 1;
            n = n % 1;
        }
        Console.WriteLine(count);


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.421
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp39", "ConsoleApp39\ConsoleApp39.csproj", "{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2B6A6B94-9759-400A-8CF9-A38BF67C72B6}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {04AE9A66-327A-4ADF-9CC1-B809EB3D9E32}
	EndGlobalSection
EndGlobal


namespace _996a
{
	class Program
	{
		static void Main(string[] args)
		{
			long n = Convert.ToInt32(Console.ReadLine());
			long num = n / 100 + (n % 100)/20 + (n % 100 % 20)/5 + (n % 100 % 20 % 5);
			Console.WriteLine(num);
		}
	}
}


using System;
using System.Linq;
using System.Reflection.PortableExecutable;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int Cant = 0;
            int Money = Int32.Parse(Console.ReadLine());
            int[] Monedas = { 100, 20, 10, 5, 1 };

            for (int i = 0; i < Monedas.Length;i++)
            {
                if (Money == 0)
                {
                    break;
                }

                while (Money / Monedas[i] > 0)
                {
                    Money -= Monedas[i];
                    Cant++;
                }
            }

            Console.WriteLine(Cant);

        }

    }
}


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

namespace CSharpScratchpad
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] coins = {1, 5, 10,20,100};
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(DPChange(n,coins));
        }

        static int DPChange(int money, int[] coins)
        {
            var minNumCoins = Enumerable.Repeat(0, money + 1).ToArray();

            for (int m = 1; m <= money; m++)
            {
                minNumCoins[m] = int.MaxValue;
                foreach (var coin in coins)
                {
                    if (m >= coin)
                    {
                        minNumCoins[m] = Math.Min(minNumCoins[m - coin] + 1, minNumCoins[m]);
                    }
                }
            }

            return minNumCoins[money];
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
namespace CP
{
    class Program
    {
        static void Main(string [] main)
        {
            int [] nAndM = Array.ConvertAll(Console.ReadLine().Split(' ') , x => Convert.ToInt32(x));
            Console.WriteLine(nAndM.Max() - 1 + nAndM.Min());
        }
    }
}


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

class Pair<T1, T2> {
    public Pair(T1 first, T2 second) {
        First = first;
        Second = second;
    }
    public T1 First { get; set; }
    public T2 Second { get; set; }
    public override string ToString() {
        return "{" + First + " " + Second + "}";
    }
}
namespace CF {
    class Program {

        public static int N = 0;
        public static int M = 0;

        public static int Last = -1;
        public static List<bool> Result;

        static void Main(string[] args) {

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

            var vals = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();
            N = vals[0];
            M = vals[1];
            Result = new List<bool>();

            var p = false;
            while (N + M > 0) {
                p = !p;
                if (M == 0) {
                    Result.Add(true);
                    N--;
                    continue;
                }
                if (N == 0) {
                    Result.Add(false);
                    M--;
                    continue;
                }
                var res = false;
                if (p) {
                    res = Peria();
                } else {
                    res = Vasia();
                }
                Result.Add(res);
                if (res) {
                    Last = 1;
                    N--;
                } else {
                    Last = 0;
                    M--;
                }

            }

            var pet = 0;
            var vas = 0;

            for (int i = 1; i < Result.Count; i++) {
                if (Result[i] == Result[i - 1]) {
                    pet++;
                } else {
                    vas++;
                }
            }

            Console.WriteLine(pet + " " + vas);

#if DEBUG
            Console.ReadKey();
#endif
        }

        public static bool Peria() {
            if (Last == -1) {
                if (N < M) {
                    return false;
                }
                return true;
            }
            if (Last == 1) {
                return true;
            } else {
                return false;
            }
        }

        public static bool Vasia() {
            if (Last == 1) {
                return false;
            } else {
                return true;
            }
        }

    }
}


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

class P {
  static int result = 1;
  static void Main() {
    var x = int.Parse(Console.ReadLine());
    var digits = 0;
    { var temp = x;
    while (temp > 0) { x = x | (1 << (temp%10)); temp /= 10; } }
    var divs = new List<int>();
    for (var d = 2; d <= x ; d++)
      if (x % d == 0) { divs.Add(d); x /= d; d--; }
    Recurse(divs, 0, 1, digits);
    Console.Write(result);
  }

  static void Recurse(List<int> divs, int i, int n, int digits) {
    if (i >= divs.Count) {
      while (n > 0) {
        if ((digits & (1 << (n%10)))!=0) { result++; return; }
        n /= 10;
      }
    Recurse(divs, i + 1, n * divs[i], digits);
    do { i++; }
    while (i < divs.Count && divs[i] == divs[i-1]);
    Recurse(divs, i, n, digits);
  }
}


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

class Program
{

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

        var lst = new List<int>();

        for (int i = 1; i <= n; i++)
        {
            if (n%i==0)
            {
                lst.Add(i);
            }
        }

        var a = new bool[9];

        while (n > 0)
        {
            a[n%10] = true;
            n /= 10;
        }

        Console.WriteLine(lst.Count(x=>hasC(a, x)));
    }

    static bool hasC(bool[] a, int b)
    {
        while (b > 0)
        {
            if (a[b % 10])
                return true;
            b /= 10;
        }

        return false;
    }
}


using System;
using System.Linq;

public class Puzzles
{
	private static void Main()
	{
		var input = ReadIntArray();
		var n = input[0];
		var m = input[1];
		var f = ReadIntArray();

		var minDifference = int.MaxValue;
		FindMinCombination(f, n, 0, 0, int.MaxValue, int.MinValue, ref minDifference);

		Console.WriteLine(minDifference);
	}

	private static void FindMinCombination(int[] f, int n, int current, int selected, int minSofar, int maxSofar, ref int minDifference)
	{
		if (selected == n)
		{
			if (maxSofar - minSofar < minDifference)
			{
				minDifference = maxSofar - minSofar;
			}

			return;
		}
		else if (current == f.Length)
		{
			return;
		}

		//Consider current puzzle
		FindMinCombination(f, n, current + 1, selected + 1, Math.Min(minSofar, f[current]), Math.Max(maxSofar, f[current]), ref minDifference);

		//Ignore current puzzle
		FindMinCombination(f, n, current + 1, selected, minSofar, maxSofar, ref minDifference);
	}

	private static int[] ReadIntArray()
	{
		return Console.ReadLine().Split().Select(int.Parse).ToArray();
	}

	private static long[] ReadLongArray()
	{
		return Console.ReadLine().Split().Select(long.Parse).ToArray();
	}

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

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


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

namespace Round218
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            Console.SetIn(System.IO.File.OpenText("input.txt"));

            string[] ar = Console.ReadLine().Split();

            int n = int.Parse(ar[0]);
            int k = int.Parse(ar[1]);

            int m = n / k;

            int[,] rep = new int[k, 2];

            ar = Console.ReadLine().Split();

            for (int i = 0; i < n; i++)
            {
                int index = i % k;
                if (ar[i] == "1")
                    rep[index, 0]++;
                else
                    rep[index, 1]++;
            }

            int count = 0;
            for (int i = 0; i < k; i++)
            {
                int rOne = m - rep[i, 0];
                int rTwo = m - rep[i, 1];
                count += Math.Min(rOne, rTwo);
            }
            Console.WriteLine(count);
        }
    }
}


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

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

            int l;
            string str=Console.ReadLine();
            string []str2=str.Split(' ');

           int n=Convert.ToInt32(str2[0]);

             int k=Convert.ToInt32(str2[1]);
            int[] a=new int [n];

            string

            int s=0;
            for (l = 0; l < k; l++)
            {
                int one = 0;
                int two = 0;
                for (int i = 0; i < n; i = i + k)
                    if (a[i + l] == 1)
                        one++;
                    else
                        two++;
                int min = one > two ? two : one;
                s = s + min;
            }
            Console.WriteLine(s);
            Console.ReadLine();

        }
    }
}


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

namespace test
{
    class Program
    {

        public static int ApperCaseBegins(int i, string s)
        {
            char[] chararr = s.ToCharArray();
            for (; i < chararr.Length; i++)
            {
                if (chararr[i] <= 90) return i;
            }
            return i;
        }

        public static bool Contains_lowercase(string S)
        {

            char[] chararr = S.ToCharArray();

            for (int i = 0; i <= chararr.Length; i++)
            {
                if (chararr[i] >= 97) return true;
            }
            return false;
        }

        static void Main(string[] args)
        {
            string input_string;
            int string_size, ans, i;
            List<string> list_of_sub_strings = new List<string>();

            string_size = int.Parse(Console.ReadLine());
            input_string = Console.ReadLine();

            if (!Contains_lowercase(input_string)) Console.WriteLine(0);
            else
            {
                int helper;
                char[] charArray = input_string.ToCharArray();
                for (i = 0; i < charArray.Length; i++)
                {

                    if (charArray[i] >= 97)
                    {
                        helper = ApperCaseBegins(i, input_string);
                        list_of_sub_strings.Add(input_string.Substring(i, helper - i));
                        i = helper;
                    }
                }

            }

            HashSet<char> mySet = new HashSet<char>();
            ans = 0;
            for (i = 0; i < list_of_sub_strings.Count; i++)
            {

                //  mySet = new HashSet<char>(list_of_sub_strings[i].ToCharArray());
                foreach (char c in list_of_sub_strings[i].ToCharArray()) mySet.Add(c);
                if (ans < mySet.Count()) { ans = mySet.Count(); }
                mySet.Clear();
            }

            // foreach (string s in list_of_sub_strings) Console.WriteLine(s);
            Console.WriteLine(ans);
            //Console.ReadKey();
        }

    }
}


using System;

namespace _807B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int p = int.Parse(input[0]), x = int.Parse(input[1]), y = int.Parse(input[2]);
            int result = -1, t = x;
            while (t >= y)
            {
                if (F(t, p))
                {
                    result = 0;
                    break;
                }
                t -= 50;
            }
            if (result == -1)
            {
                while (!F(t, p))
                    t += 50;
                result = (int)Math.Ceiling((t - x) / 100D);
            }
            Console.WriteLine(result);
        }

        static bool F(int t, int p)
        {
            bool res = false;
            int i = (t / 50) % 475;
            for (int j = 0; j < 25; j++)
            {
                i = (i * 96 + 42) % 475;
                if (i + 26 == p)
                {
                    res = true;
                    break;
                }
            }
            return res;
        }
    }
}


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

class Program
{
    private static bool Can(int s, int p)
    {
        var i = (s / 50) % 475;
        for (int j = 0; j < 25; j++)
        {
            i = (i * 96 + 42) % 475;
            if (26 + i == p) return true;
        }

        return false;
    }

    private static void Main(string[] args)
    {
        int p = RI();
        int x = RI();
        int y = RI();

        for (int i = -1000; i <= 1000; i++)
            if (x + 50 * i >= y)
                if (Can(x + 50 * i, p))
                {
                    Console.WriteLine(Math.Max(0, (i + 1) / 2));
                }
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

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

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

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

        return g;
    }

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

        return matrix;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return s.ToArray();
    }

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

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

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

        return s;
    }

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

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

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

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

        return s.ToArray();
    }

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

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

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

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

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

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

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

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

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

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


using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;

namespace Codeforces.R316D1
{
    public struct ModInteger : IEquatable<ModInteger>
    {
        readonly int mod;
        readonly long value;
        public ModInteger(int mod, long value = 0L)
        {
            this.mod = mod;
            this.value = value % mod;
            if (value < 0)
            {
                this.value = value + mod;
            }
        }

        public bool Equals(ModInteger other)
        {
            return mod == other.mod && value == other.value;
        }

        public override bool Equals(object obj)
        {
            if (!(obj is ModInteger))
            {
                return false;
            }
            var other = (ModInteger)obj;
            return Equals(other);
        }

        public override int GetHashCode()
        {
            return (int)value;
        }

        public static bool operator ==(ModInteger left, ModInteger right)
        {
            return left.Equals(right);
        }

        public static bool operator !=(ModInteger left, ModInteger right)
        {
            return !(left == right);
        }

        public static ModInteger LeftShift(ModInteger left, int right)
        {
            return left << right;
        }

        public static ModInteger operator <<(ModInteger left, int right)
        {
            if (right > 32)
            {
                return left << 32 << (right - 32);
            }
            return new ModInteger(left.mod, left.value << right);
        }

        public static ModInteger Add(ModInteger left, int right)
        {
            return left + right;
        }

        public static ModInteger operator +(ModInteger left, int right)
        {
            return new ModInteger(left.mod, left.value + right);
        }

        public static ModInteger operator ++(ModInteger m)
        {
            return m + 1;
        }

        public static ModInteger Multiply(ModInteger left, int right)
        {
            return new ModInteger(left.mod, left.value * right);
        }

        public static ModInteger operator *(ModInteger left, int right)
        {
            return Multiply(left, right);
        }

        public static ModInteger Div(int left, int right, int mod)
        {
            return Pow(right, mod - 2, mod) * left;
        }

        public static ModInteger Pow(long x, int n, int mod)
        {
            var res = 1L;
            for (; n > 0; n >>= 1)
            {
                if ((n & 1) == 1)
                {
                    res = res * x % mod;
                }
                x = x * x % mod;
            }
            return new ModInteger(mod, res);
        }

        public static ModInteger ToModInteger(int value)
        {
            return new ModInteger(0, value);
        }

        public static implicit operator int(ModInteger value)
        {
            return (int)value.value;
        }

        public static int ToInt32(ModInteger value)
        {
            return value;
        }

        public static ModInteger Increment(ModInteger item)
        {
            return ++item;
        }
    }
    public static class Solver
    {
        const int mod = 1000000007;
        public static void Main()
        {
            using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Solve(Console.In, sw);
            }
        }

        public static void Solve(TextReader tr, TextWriter tw)
        {
            Contract.Requires(tr != null);
            Contract.Requires(tw != null);

            tw.WriteLine(Parse(tr));
        }

        private static int Parse(TextReader tr)
        {
            var info = CultureInfo.InvariantCulture;
            tr.ReadLine();
            var a = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();

            return Calc(a);
        }

        private static ModInteger Calc(int[] a)
        {
            int num1 = a.Count(x => x == 1);
            int num2 = a.Length - num1;

            return F(num1, num2);
        }

        private static ModInteger F(int a, int b)
        {
            var res = new ModInteger(mod, 1);

            for (int i = 0; i < b; ++i)
            {
                res *= a + 1 + i;
            }

            var I = new ModInteger[a + 1];
            I[0] = new ModInteger(mod, 1);
            I[1] = new ModInteger(mod, 1);
            for (int i = 2; i <= a; ++i)
            {
                I[i] = I[i - 1] + (i - 1) * I[i - 2];
            }
            return res * I[a];
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cakeminator", "Cakeminator\Cakeminator.csproj", "{69B40C6B-8B15-4893-BC10-C83C32D163CE}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{69B40C6B-8B15-4893-BC10-C83C32D163CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{69B40C6B-8B15-4893-BC10-C83C32D163CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{69B40C6B-8B15-4893-BC10-C83C32D163CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{69B40C6B-8B15-4893-BC10-C83C32D163CE}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {145B729C-3B15-4625-9DF8-9D75548722C1}
	EndGlobalSection
EndGlobal


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

namespace test
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var n = Int32.Parse (Console.ReadLine ());

			var tList = Console.ReadLine ().Split (' ').Select (x => Int32.Parse (x)).OrderBy(x => x);

			var T = Int32.Parse (Console.ReadLine ());

			var prev = tList.First ();
			var maxLen = 1;
			var currentLen = 1;

			tList.Skip(1).ToList().ForEach (x => {
				if (x - prev > T) {
					currentLen = 1;
				} else {
					currentLen++;
				}

				if (currentLen > maxLen) {
					maxLen = currentLen;
				}

				prev = x;
			});

			Console.WriteLine (maxLen);
		}
	}
}


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

namespace Arpa_and_a_research_in_Mexican_wave
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = input[0];
            int k = input[1];
            int t = input[2];
            int[] persons = new int[9999];
            for(int i = 1; i <= t;i++)
            {
                persons[i] = 1;
                if(i > k)
                {
                    persons[i - k] = 0;
                }
                if(i > n)
                {
                    persons[n - k] = 0;
                }
                if(i == k +n)
                {
                    persons[n] = 0;
                }
            }
            int count = 0;
            for(int i = 0; i < 11;i++)
            {
                count += persons[i];
            }
            Console.Write(count);
        }
    }
}


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

namespace Arpa_and_a_research_in_Mexican_wave
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = input[0];
            int k = input[1];
            int t = input[2];
            int standingpersons = 0;
            for(int i = 1; i <= t;i++)
            {
                standingpersons++;
                if(i > k)
                {
                    standingpersons--;
                }
                if(i > n)
                {
                    standingpersons--;
                }
                if(i == k +n)
                {
                    standingpersons--;
                }
            }
            Console.Write(standingpersons);
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        public static void main(string[] ags)
        {
            string[] s = Console.ReadLine().Split(' ');
            int first, next;
            first = int.Parse(s[0]);
            next = int.Parse(s[1]);
            if (Next(first) == next)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
        static int Next(int start)
        {
            start++;
            while (!isPrime(start))
            {
                start++;
            }
            return start;

        }
        static bool isPrime(int n)
        {
            int limit = (int)Math.Sqrt(n);
            for (int i = 2; i < limit; i++)
            {
                if (n % i == 0) { return false; }
            }
            return true;
        }
    }
}


using System;
using System.Linq;
class Program
{
    static void Main()
    {
        var primes = new int[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 };
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(nm[1] == primes[Array.IndexOf(primes, nm[0]) + 1] ? "YES" : "NO");
    }
}


namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            var before = GC.GetTotalMemory(true);
            var input = Console.ReadLine().Split(' ');
            var n = byte.Parse(input[0]);
            var m = byte.Parse(input[1]);
            byte next = 0;
            byte[] arr = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};

            for (int i = 0; i < arr.Length; i++)
            {
                if (arr[i] > n)
                {
                    next = arr[i];
                    break;
                }
            }

            if(m == next) Console.Write("YES");
            else Console.WriteLine("NO");
        }
    }
}


using System.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Contest_379_div2_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = 0;
            using (StreamReader r = new StreamReader(Console.OpenStandardInput()))
            {
                int d = 0, min;//is the count of 256 ;
                List<int> j = r.ReadLine().Split().Select(x => int.Parse(x)).ToList();
                min = Math.Min(j[0], j[2]);min = Math.Min(j[3], min);
                d = Math.Min(j[1], j[0] - min);
                Console.WriteLine(256 * min + d * 32);
            }
        }
    }
}


using System;
using System.Linq;

public class Example
{
    public static void Main(string[] args)
    {
        var numbers = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        var Count256 = numbers.Where(x => numbers.IndexOf(x) != 1).Min();
        var count32 = Math.Min(numbers[1], numbers[0] - Count256);
        Console.WriteLine(256 * Count256 + 32 * count32);
    }
}


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

namespace Task1
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var inputs = Input.ReadNumbers();

            var n = inputs[0];
            var k = inputs[1];

            var s = Console.ReadLine();

            var g = s.IndexOf('G');
            var t = s.IndexOf('T');

            var i = g;

            if (g < t)
            {
                while (i <= t && i < n)
                {
                    if (i == t)
                    {
                        Console.WriteLine("YES");
                        return;
                    }

                    i += k;
                    if (s[i] == '#')
                    {
                        Console.WriteLine("NO");
                        return;
                    }
                }
            }
            else
            {
                while (i >= t && i >= 0)
                {
                    if (i == t)
                    {
                        Console.WriteLine("YES");
                        return;
                    }

                    i -= k;
                    if (s[i] == '#')
                    {
                        Console.WriteLine("NO");
                        return;
                    }
                }
            }

            Console.WriteLine("NO");
        }
    }

    static  class Input
    {
        public static List<int> ReadNumbers()
        {
            var input = Console.ReadLine();
            return input.Split(new []{" "}, StringSplitOptions.RemoveEmptyEntries).Select(Int32.Parse).ToList();
        }
    }
}


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

public class Source
{
    public void Program()
    {
    }
    void method(int pos, int end, bool[] c,string s)
    {
        if (pos == end)
        {
            writeLine("YES");
            return;
        }
        if (c[pos] == true || s[pos] == '#' || pos < 0 || pos >= n || c[pos])
        {
            writeLine("NO");
            return;

        }
        c[pos] = true;
        method(pos + m, end, c, s);

    }
    int n, m;
    void Read()
    {
        n = ri(); m = ri();
        string s = reader.ReadLine();
        int start = 0, end = 0;
        bool[] c = new bool[n];
        fill(c, false);
        for (int i = 0; i < n; i++)
        {
            if (s[i] == 'G')
                start = i;
            if (s[i] == 'T')
                end = i;
        }
        if (start > end)
            m = -m;
        method(start, end, c,s);

    }

    #region hide it
    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
            reader = new StreamReader(Console.OpenStandardInput());
            writer = new StreamWriter(Console.OpenStandardOutput());
            //reader = new StreamReader("input.txt");
            //writer = new StreamWriter("output.txt");
#endif
        var source = new Source();
        source.Read();
        source.Program();

        /* try
         {
             new Source().Program();
         }
         catch (Exception ex)
         {
 #if DEBUG
             Console.WriteLine(ex);
 #else
             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 ri() { return int.Parse(ReadToken()); }
    public static char ReadChar() { return char.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(i => int.Parse(i)).ToArray(); }
    public static char[] ReadCharArray() { return ReadAndSplitLine().Select(i => char.Parse(i)).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(i => long.Parse(i)).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 char[][] ReadCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadCharArray(); 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 write<T>(T value) { writer.Write(value); }
    public static void writeLine<T>(T value) { writer.WriteLine(value); }
    public static void writeArray<T>(T[] array, string split) { for (int i = 0; i < array.Length; i++) { write(array[i] + split); } }
    public static void writeMatrix<T>(T[][] matrix, string split) { for (int i = 0; i < matrix.Length; i++) { writeArray(matrix[i], split); writer.Write("\n"); } }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
    #endregion

    #region Methods
    #region DSU
    public void MakeSet(int[] poi)
    {
        for (int i = 0; i < poi.Length; i++)
        {
            poi[i] = i;
        }
    }
    public int Find(int x, int[] poi)
    {
        if (poi[x] == x) return x;
        return poi[x] = Find(poi[x], poi);
    }
    Random rand = new Random();
    public void Unite(int x, int y, int[] poi)
    {
        y = Find(y, poi);
        x = Find(x, poi);
        if (rand.Next() % 2 == 0)
            Swap(ref x, ref y);
        poi[x] = y;
    }
    #endregion

    class Deque<T>
    {
        T[] array;
        int start, length;
        public Deque()
        {
            start = 0; length = 0; array = new T[1];
        }
        public T this[int index] { get { return array[(start + index) % array.Length]; } set { array[(start + index) % array.Length] = value; } }
        int last { get { return (start + length) % array.Length; } }
        /// <summary>
        /// ÃÆÃ¢â¬ËÃâÃÂÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬Ã
        /// </summary>
        public T PeekFirst()
        {
            return array[start];
        }
        public int Count { get { return length; } }
        /// <summary>
        /// ÃÆÃÂÃâÃÂºÃÆÃÂÃâÃÂ¾ÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂµÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬  ÃÆÃÂÃâÃÂ±ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ· ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃ¢â¬ËÃâÃÂ
        /// </summary>
        public T PeekLsat()
        {
            return array[last];
        }
        public T PopLast()
        {
            if (length == 0)
                throw new IndexOutOfRangeException("OutOfRange");
            length--;
            return array[last];
        }
        public T PopFirst()
        {
            if (length == 0)
                throw new IndexOutOfRangeException("OutOfRange");
            length--;
            if (start >= array.Length - 1) start = 0; else start++;
            return array[start - 1 < 0 ? array.Length - 1 : start - 1];
        }
        public void AddFirst(T value)
        {
            IncreaseAndInspection();
            if (start <= 0) start = array.Length - 1; else start--;
            array[start] = value;
            length++;
        }
        public void AddLast(T value)
        {
            IncreaseAndInspection();
            array[last] = value;
            length++;
        }
        bool overflow { get { return length == array.Length; } }
        void IncreaseAndInspection()
        {
            if (overflow)
                increase();

        }
        void increase()
        {
            T[] array2 = new T[array.Length * 2];
            for (int i = 0; i < array.Length; i++)
            {
                int pos = (start + i) % array.Length;
                array2[i] = array[pos];
            }
            array = array2;
            start = 0;
            array2 = null;
        }
        public void Clear()
        {
            start = 0; length = 0; array = new T[1];
        }

        //ÃÆÃ¢â¬ËÃÂ¢Ã¢â¬Å¡ÃÂ¬ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ·ÃÆÃÂÃâÃÂ¼ÃÆÃÂÃâÃÂµÃÆÃ¢â¬ËÃÂ¢Ã¢â¬Å¡ÃÂ¬, ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ¾ÃÆÃÂÃâÃÂ±ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ²ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ ÃÆÃÂÃâÃÂ² ÃÆÃÂÃâÃÂºÃÆÃÂÃâÃÂ¾ÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂµÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬ /ÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ°ÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬ÃÂ¡ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂ¾, ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃÂÃâÃÂµ ÃÆÃ¢â¬ËÃâÃÂ ÃÆÃÂÃâÃÂºÃÆÃÂÃâÃÂ¾ÃÆÃÂÃâÃÂ½ÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬ ÃÆÃÂÃâÃÂ°/ÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ°ÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬ÃÂ¡ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂ¾,
    }
    class Heap<T>
    {
        Comparison<T> ic;
        List<T> storage = new List<T>();
        public Heap(Comparison<T> ic)
        {
            this.ic = ic;
        }
        public void Add(T element)
        {
            storage.Add(element);
            int pos = storage.Count - 1;
            while (pos != 0 && ic(storage[((int)(pos - 1) >> 1)], element) > 0)
            {
                Swap(storage, pos, ((int)(pos - 1) / 2));
                pos = ((int)(pos - 1) / 2);
            }
        }
        /// <summary>
        /// ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃÂÃâÃÂµ ÃÆÃÂÃâÃÂ¿ÃÆÃÂÃâÃÂ¾ÃÆÃ¢â¬ËÃâÃÂÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ³ÃÆÃÂÃâÃÂ¾
        /// </summary>
        /// <returns></returns>
        public T Pop()
        {
            T t = storage[0];
            Swap(storage, 0, storage.Count - 1);
            int pos = 0;
            storage.RemoveAt(storage.Count - 1);
            if (Count > 0)
                while (true)
                {
                    T my = storage[pos];
                    if (pos * 2 + 1 >= Count)
                        break;
                    T left = storage[pos * 2 + 1];
                    if (pos * 2 + 2 >= Count)
                    {
                        if (ic(left, my) < 0)
                        {
                            Swap(storage, pos, pos * 2 + 1);
                            pos = pos * 2 + 1;
                        }
                        break;
                    }
                    T right = storage[pos * 2 + 2];
                    if (ic(left, my) < 0 || ic(right, my) < 0)
                    {
                        if (ic(left, right) < 0)
                        {
                            Swap(storage, pos, pos * 2 + 1);
                            pos = pos * 2 + 1;
                        }
                        else
                        {

                            Swap(storage, pos, pos * 2 + 2);
                            pos = pos * 2 + 2;
                        }
                    }
                    else break;
                }
            return t;
        }

        public void Clear()
        {
            storage.Clear();
        }
        /// <summary>
        /// ÃÆÃÂÃâÃÂ±ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ· ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃ¢â¬ËÃâÃÂ
        /// </summary>
        /// <returns></returns>
        public T Peek()
        {
            return storage[0];
        }
        public int Count
        {
            get { return storage.Count; }
        }
        //void RemoveLast, Size, peeklast, add
    }
    static void Swap<T>(ref T lhs, ref T rhs)
    {
        T temp;
        temp = lhs;
        lhs = rhs;
        rhs = temp;
    }
    static void Swap<T>(T[] a, int l, int r)
    {
        T temp;
        temp = a[l];
        a[l] = a[r];
        a[r] = temp;
    }
    static void Swap<T>(List<T> a, int l, int r)
    {
        T temp;
        temp = a[l];
        a[l] = a[r];
        a[r] = temp;
    }

    bool outregion(long y, long x, long n, long m)
    {
        if (x < 0 || x >= m || y < 0 || y >= n)
            return true;
        return false;
    }
    static void initlist<T>(ref List<T>[] list, int n)
    {
        list = new List<T>[n];
        for (int i = 0; i < n; i++)
            list[i] = new List<T>();
    }
    static void newarray<T>(ref T[][] array, int n, int m)
    {
        array = new T[n][];
        for (int i = 0; i < n; i++)
            array[i] = new T[m];
    }
    static void newarray<T>(ref T[] array, int n)
    {
        array = new T[n];
    }
    static void fill<T>(T[] array, T value)
    {
        for (int i = 0; i < array.Length; i++)
            array[i] = value;
    }
    static void fill<T>(T[][] array, T value)
    {
        for (int i = 0; i < array.Length; i++)
            for (int j = 0; j < array[i].Length; j++)
                array[i][j] = value;
    }
    public bool NextPermutation<T>(T[] b, Comparison<T> ic)
    {
        for (int j = b.Length - 2; j >= 0; j--)
        {
            if (ic(b[j], b[j + 1]) < 0)
            {
                for (int l = b.Length - 1; l >= 0; l--)
                {
                    if (ic(b[l], b[j]) > 0)
                    {
                        Swap(b, j, l);
                        Array.Reverse(b, j + 1, b.Length - (j + 1));
                        return true;
                    }
                }
            }
        }
        return false;
    }
    int[,] step8 = new int[,]
    {
        {-1,0 },
        {1,0 },
        {0,-1 },
        {0,1 },
        {1,1 },
        {-1,1 },
        {-1,-1 },
        {1,-1 },
    };
    int[,] step4 = new int[,]
    {
        {-1,0 },
        {1,0 },
        {0,-1 },
        {0,1 },
    };
    struct Vector2
    {
        public double x;
        public double y;
        public Vector2(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
        public double Dist(Vector2 to)
        {
            return Math.Sqrt(Math.Abs(Math.Pow(to.x - x, 2)) + Math.Abs(Math.Pow(to.y - y, 2)));
        }
        public static bool operator ==(Vector2 left, Vector2 right) { return left.x == right.x && left.y == right.y; }
        public static bool operator !=(Vector2 left, Vector2 right) { return left.x != right.x || left.y != right.y; }
    }
    #endregion
    #endregion

}


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

namespace CodeForces1
{
    class Program
    {
        static bool isright(int[] x, int[] y)
        {
            if (x[0] == x[1] && y[0] == y[1]) return false;
            if (x[0] == x[2] && y[0] == y[2]) return false;
            if (x[2] == x[1] && y[2] == y[1]) return false;
            int a, b, c;
            a = (x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]);
            b = (x[2] - x[1]) * (x[2] - x[1]) + (y[2] - y[1]) * (y[2] - y[1]);
            c = (x[0] - x[2]) * (x[0] - x[2]) + (y[0] - y[2]) * (y[0] - y[2]);

            return (a + b == c || b + c == a || c + a == b);
        }
        static bool isalmostright(int[] x, int[] y)
        {
            int[] dx = { -1, 1, 0, 0 };
            int[] dy = { 0, 0, -1, 1 };
            for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    x[i] += dx[j];
                    y[i] += dy[j];
                    if (isright(x, y)) return true;
                    x[i] -= dx[j];
                    y[i] -= dy[j];
                }
            }
            return false;
        }
        public static void Main()
        {
            string[] t = Console.ReadLine().Split();
            int[] x = new int[3];
            int[] y = new int[3];
            for (int i = 0; i < 3; ++i)
            {
                x[i] = int.Parse(t[2 * i]);
                y[i] = int.Parse(t[2 * i + 1]);
            }

            if (isright(x, y)) { Console.WriteLine("RIGHT"); return; }
            if (isalmostright(x, y)) { Console.WriteLine("ALMOST"); return; }
            Console.WriteLine("NEITHER");
        }
    }


using System;
using System.Collections;
using System.Text;
namespace p2
{
    class Program
    {
        public static int Main(string[] args)
        {  string[] line =Console.ReadLine().Split();
            int x1,x2,x3,y1,y2,y3;
            x1=int.Parse(line[0]);
            x2=int.Parse(line[2]);
            x3=int.Parse(line[4]);
            y1=int.Parse(line[1]);
            y2=int.Parse(line[3]);
            y3=int.Parse(line[5]);
            double a,b,c;
            bool f=false
            ini(x1, x2, x3, y1, y2, y3,out a,out b,out c);
            if (pif(a,b,c)==true){Console.WriteLine("RIGHT");return 0;}

            Almost(x1, x2, x3, y1, y2, y3, a, b, c, f,out f);
            if(f==true){return 0;}
            Console.WriteLine( "NEITHER");
            //Console.ReadKey();
            return 0;
        }

        static void Almost(int x1, int x2, int x3, int y1, int y2, int y3, double a, double b, double c,out bool f)
        {
            ini(x1 + 1, x2, x3, y1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1 - 1, x2, x3, y1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2 + 1, x3, y1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2 - 1, x3, y1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3 + 1, y1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3 - 1, y1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3, y1 + 1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3, y1 - 1, y2, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3, y1, y2 + 1, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3, y1, y2 - 1, y3, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3, y1, y2, y3 + 1, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            ini(x1, x2, x3, y1, y2, y3 - 1, out a, out b, out c);
            if (pif(a, b, c) == true) {
                Console.WriteLine("ALMOST");f=true;
                return 0;
            }
            return 0;
        }

        static void ini(int x1, int x2, int x3, int y1, int y2, int y3,out double a,out double b,out double c)
        {
            a = otr(x1, y1, x2, y2);
            b = otr(x2, y2, x3, y3);
            c = otr(x1, y1, x3, y3);
        }
        public static double otr(int a1,int b1,int a2,int b2){
            return ((a2-a1)*(a2-a1)+(b2-b1)*(b2-b1));
        }
        public static bool pif(double a,double b,double c){
            if(a+b-c==0) {return true;}
            if(a-b+c==0) {return true;}
            if(-a+b+c==0) {return true;}
            return false;}
    }
    }


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

namespace FirstApp
{

    class Program
    {

        static void Main(string[] args)
        {

            string[] substr = new string[10000];

            int[] count = new int[10000];

            int num = 0;

            string str = Console.ReadLine();
           // string str = "wzznz";

            bool check;

            for (int i = 0; i < 10000; i++)
            {

                count[i] = 0;

            }

            for (var i = 0; i < str.Length; i++)
            {

                StringBuilder tmp = new StringBuilder("", 1000);

                for (var j = i; j < str.Length; j++)
                {

                    tmp.AppendFormat(Convert.ToString(str[j]));

                   // if (tmp.Length > 1)
                   // {

                        //проверяем есть ли значение в массиве подстрок

                        check = true;

                        for (var m = 0; m < num; m++)
                        {
                            if (String.Compare(Convert.ToString(tmp), Convert.ToString(substr[m]), true) == 0)
                            {
                                check = false;
                            }
                        }

                        //проверяем на уникальность и добавим в массив подстроки

                        if (check == true)
                        {
                            substr[num] = Convert.ToString(tmp);
                            num++;
                        }

                    //}

                }

            }

            //начинаем поиск

            for (var r = 0; r < num; r++)
            {
                int pos = -1; //позиция

                for (int st = 0; st < str.Length; st++)
                {
                    int index = str.IndexOf(substr[r], st);

                    if (index > -1 && pos != index)
                    {
                        count[r] = count[r] + 1;
                        pos = index;

                    }
                }
            }

            //отбираем самую большую подстроку
            int symcount = 0;
            for (var r = 0; r < num; r++)
            {
                if (count[r] > 1)
                {
                   // Console.WriteLine(count[r]);
                    if (substr[r].Length > symcount)
                    {
                        symcount = substr[r].Length;
                    }
                }
            }

            Console.WriteLine(symcount);

           // Console.ReadKey();

        }

        //  static bool Check(string tmp){

        //      return true;

        //   }

    }

}


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

namespace FirstApp
{

    class Program
    {

        static void Main(string[] args)
        {

            string[] substr = new string[10000];

            int[] count = new int[10000];

            int num = 0;

            string str = Console.ReadLine();
           // string str = "ckvfndqgkmhcyojaqgdkenmbexufryhqejdhctxujmtrwkpbqxufxamgoeigzfyzbhevpbkvviwntdhqscvkmphnkkljizndnbjt";

            bool check;

            for (int i = 0; i < 10000; i++)
            {

                count[i] = 0;

            }

            for (var i = 0; i < str.Length; i++)
            {

                StringBuilder tmp = new StringBuilder("", 1000);

                for (var j = i; j < str.Length; j++)
                {

                    tmp.AppendFormat(Convert.ToString(str[j]));

                        //проверяем есть ли значение в массиве подстрок

                        check = true;
                    /*
                        for (var m = 0; m < num; m++)
                        {
                            if (String.Compare(Convert.ToString(tmp), Convert.ToString(substr[m]), true) == 0)
                            {
                                check = false;
                                break;
                            }
                        }
                    */
                        //проверяем на уникальность и добавим в массив подстроки

                    if (check == true)
                    {
                        substr[num] = Convert.ToString(tmp);
                        num++;
                    }
                }

            }

            //начинаем поиск

            for (var r = 0; r < num; r++)
            {
                int pos = -1; //позиция

                for (int st = 0; st < str.Length; st++)
                {
                    int index = str.IndexOf(substr[r], st);

                    if (index > -1 && pos != index)
                    {
                        count[r] = count[r] + 1;
                        pos = index;

                    }
                }
            }

            //отбираем самую большую подстроку

            int symcount = 0;
            for (var r = 0; r < num; r++)
            {
                if (count[r] > 1)
                {
                   // Console.WriteLine(count[r]);
                    if (substr[r].Length > symcount)
                    {
                        symcount = substr[r].Length;
                    }
                }
            }

            Console.WriteLine(symcount);

           // Console.WriteLine("end");
            Console.ReadKey();

        }
    }
}


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

namespace Program1
{
    class Program
    {

        static int Main(string[] args)
        {

            string str = GetString();
            //string str = "";
            string tmpStr;
            string podstr;
            string otvet = "^";
            int count;

            for (int i = 0; i < str.Length; i++)
            {
                for (int g = 0; g < str.Length - i; g++)
                {

                    tmpStr = str.Substring(i + g - 1);
                    podstr = str.Substring(i, g + 1);

                    if (tmpStr.IndexOf(podstr) > -1)
                    {
                        if (otvet.Length <= podstr.Length)
                        {
                            otvet = podstr;
                        }
                        else continue;

                    }
                    else
                    {
                        break;
                    }

                }

            }

            if (otvet == "^") count = 0; else count = otvet.Length;
            Console.WriteLine(count);

            return 0;
        }

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

    }
}


#define USE_FILES
//#define VERBOSE
//#define MANY_TESTS_IN_INPUT
//#define INCREASE_STACK

#if ONLINE_JUDGE // Defined by Codeforces judging system
#undef USE_FILES
#endif

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

namespace Acm
{
    /// <summary>
    /// For the simplicity of hacking / reading / exploring.
    /// Problem solution is in this class only!
    /// </summary>
    class ProblemSolution
    {
        public LineReader In { get; }

        public TextWriter Out { get; }

        public ProblemSolution(LineReader @in, TextWriter @out)
        {
            In = @in;
            Out = @out;
        }

        /// <summary>
        /// </summary>
        /// <param name="testId">
        /// For multi-test inputs: ID of test, from 1 to T
        /// For single-test inputs: -1
        /// </param>
        public void SolveTest(int testId)
        {
            long[] line = In.Read();
            long a = line[0], b = line[1];

            long diff = Math.Abs(a - b);

            Verbose.Log(() => $"Diff = {diff}");
            HashSet<long> divisors = new HashSet<long>();

            for (long divisor = 1; divisor * divisor <= diff; divisor++)
            {
                if (diff % divisor == 0)
                {
                    Verbose.Log(() => $"Using divisor {divisor} && {diff / divisor}");
                    divisors.Add(divisor);
                    divisors.Add(diff / divisor);
                }
            }
            Verbose.Log(() => $"Divisors: {String.Join(" ", divisors)}");

            long answerK = 0;
            long answerLcm = long.MaxValue;
            foreach (long divisor in divisors)
            {
                Verbose.Log(() => $"Using divisor {divisor}");

                long k = (divisor - (a % divisor)) % divisor;
                long lcm = (a + k) * (b + k) / divisor;

                Verbose.Log(() => $"k = {k}, then a = {a + k}, b = {b + k}. LCM = {lcm}");

                if (lcm < answerLcm)
                {
                    Verbose.Log(() => $"Result is improved with LCM {lcm}, k = {k}");

                    answerLcm = lcm;
                    answerK = k;
                }
            }

            Out.WriteLine(answerK);
        }
    }

    // ---------------
    // There is nothing interesting below this line!
    // ---------------

    class Program
    {
        private static LineReader In { get; set; }

        private static TextWriter Out { get; set; }

        public static void Main(string[] args)
        {
#if USE_FILES
            In = new LineReader(File.OpenText("input.txt"));
            Out = new StreamWriter("../../output.txt", false);
#else
            In = new LineReader(Console.In);
            Out = Console.Out;
#endif

                        try
            {
#if INCREASE_STACK
				var thread = new Thread(Solve, 32 * 1024 * 1024);
				thread.Start();
				thread.Join();
#else
                Solve();
#endif
            }
            finally
            {
                Out.Dispose();
            }
        }

        public static void Solve()
        {
#if MANY_TESTS_IN_INPUT
            int t = In.Read();
            for (int i = 1; i <= t; i++)
            {
                new ProblemSolution(In, Out).SolveTest(i);
            }
#else
            new ProblemSolution(In, Out).SolveTest(-1);
#endif
        }
    }

    class Verbose
    {
        public static void Log(Func<string> s)
        {
#if VERBOSE
            Console.WriteLine(s());
#endif
        }
    }

    /// <summary>
    /// Input usability things
    /// </summary>
    class InputLine
    {
        private readonly string _line;

        public InputLine(string line)
        {
            _line = line;
        }

        public static implicit operator string(InputLine line)
        {
            return line._line;
        }

        public static implicit operator int(InputLine line)
        {
            return int.Parse(line._line);
        }

        public static implicit operator int[] (InputLine line)
        {
            return line._line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
        }

        public static implicit operator long[] (InputLine line)
        {
            return line._line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
        }
    }

    class LineReader
    {
        public TextReader Reader { get; }

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

        public InputLine Read()
        {
            string line = Reader.ReadLine();
            return line == null
                ? null
                : new InputLine(line.Trim());
        }
    }
}


using System;
using System.Collections.Generic;

namespace ConsoleApp4
{
    class Program
    {

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

        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var span = str.Split(' ');
            int a = int.Parse(span[0]);
            int b = int.Parse(span[1]);

            if (b > a)
            {
                int t = b;
                b = a;
                a = t;
            }
            long min = int.MaxValue;
            int k = -1;

            for (int i = 0; i < a - b+1; i++)
            {
                var g = gcd(a + i, b + i);
                long lcm = (long)(a + i) / g * (b + i);
                if (lcm < min)
                {
                    min = lcm;
                    k = i;
                }

            }
            Console.WriteLine(k);
        }
    }
}


using System;
class Program {
static void Main() {
   int[] a=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
int[] b=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
int n = int.Parse(Console.ReadLine());
n-=Math.Ceiling((double)(a[0]+a[1]+a[2])/5)+Math.Ceiling((double)(b[0]+b[1]+b[2])/10);
Console.WriteLine(n <0?"NO":"YES");
}
}


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

namespace _100853_Codeforce
{

    class Program
    {
        private const string FILENAME = "distance4";

        private const string INPUT = FILENAME + ".in";

        private const string OUTPUT = FILENAME + ".out";

        static StreamReader reader = null;
        static StreamWriter writer = null;

        private static void Main(string[] args)
        {

            int[,] mass = new int[4, 4];

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

            for (int i = 0; i < mass.Length; i++)
                arr.Add(Console.ReadLine());

            mass = ReadINT2XArray(arr);

            bool one = false;
            if (mass[0,3] == 1)
            {
                one = true;
                if (mass[0,1] == 0 && mass[0,2] == 0 && mass[0,0] == 0 && mass[1,0] == 0 && mass[2,1] == 0 && mass[3,2] == 0)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            if (mass[1,3] == 1)
            {
                one = true;
                if (mass[1,1] == 0 && mass[1,2] == 0 && mass[1,0] == 0 && mass[2,0] == 0 && mass[3,1] == 0 && mass[0,2] == 0)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            if (mass[2,3] == 1)
            {
                one = true;
                if (mass[2,1] == 0 && mass[2,2] == 0 && mass[2,0] == 0 && mass[3,0] == 0 && mass[0,1] == 0 && mass[1,2] == 0)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            if (mass[3,3] == 1)
            {
                one = true;
                if (mass[3,1] == 0 && mass[3,2] == 0 && mass[3,0] == 0 && mass[0,0] == 0 && mass[1,1] == 0 && mass[2,2] == 0)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }

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

        }

        static int[] CopyOfRange(int[] src, int start, int end)
        {
            int len = end - start;
            int[] dest = new int[len];
            Array.Copy(src, start, dest, 0, len);
            return dest;
        }

        static string StreamReader()
        {

            if (reader == null)
                reader = new StreamReader(INPUT);
            string response = reader.ReadLine();
            if (reader.EndOfStream)
                reader.Close();
            return response;

        }

        static void StreamWriter(string text)
        {

            if (writer == null)
                writer = new StreamWriter(OUTPUT);
            writer.WriteLine(text);

        }

        public static int BFS(int start, int end, int[,] arr)
        {
            Queue<KeyValuePair<int, int>> queue = new Queue<KeyValuePair<int, int>>();
            List<bool> visited = new List<bool>();
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                visited.Add(false);
            }

            queue.Enqueue(new KeyValuePair<int, int>(start, 0));
            KeyValuePair<int, int> node;
            int level = 0;
            bool flag = false;

            while (queue.Count != 0)
            {
                node = queue.Dequeue();
                if (node.Key == end)
                {
                    return node.Value;
                }
                flag = false;
                for (int i = 0; i < arr.GetLength(0); i++)
                {

                    if (arr[node.Key, i] == 1)
                    {
                        if (visited[i] == false)
                        {
                            if (!flag)
                            {
                                level = node.Value + 1;
                                flag = true;
                            }
                            queue.Enqueue(new KeyValuePair<int, int>(i, level));
                            visited[i] = true;
                        }
                    }
                }

            }
            return 0;

        }

        private static void Write(string source)
        {
            File.WriteAllText(OUTPUT, source);
        }

        private static string ReadString()
        {
            return File.ReadAllText(INPUT);
        }

        private static void WriteStringArray(string[] source)
        {
            File.WriteAllLines(OUTPUT, source);
        }

        private static string[] ReadStringArray()
        {
            return File.ReadAllLines(INPUT);
        }

        private static int[] GetIntArray()
        {
            return ReadString().Split(' ').Select(int.Parse).ToArray();
        }

        private static double[] GetDoubleArray()
        {
            return ReadString().Split(' ').Select(double.Parse).ToArray();
        }

        private static int[,] ReadINT2XArray(List<string> lines)
        {
            int[,] arr = new int[lines.Count, lines.Count];

            for (int i = 0; i < lines.Count; i++)
            {
                int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

                for (int j = 0; j < lines.Count; j++)
                {
                    arr[i, j] = row[j];
                }
            }

            return arr;
        }

    }

    public class Vector
    {
        public double x { get; set; }
        public double y { get; set; }

        public static Vector zero = new Vector(0, 0);

        public Vector(double x, double y)
        {
            this.x = x;
            this.y = y;
        }

        public double Length(Vector zero)
        {
            return Math.Sqrt((this.x - zero.x) * (this.x - zero.x) + (this.y - zero.y) * (this.y - zero.y));
        }

        public override string ToString()
        {
            return string.Format("{0} {1}", x, y).Replace(',', '.');
        }
    }

}


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

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            var matrix = new int[4,4];
            for (int i = 0; i < 4; i++)
            {
                var tempArr = Array.ConvertAll(Console.ReadLine().Split(),Convert.ToInt32);
                for (int j = 0; j < 4; j++)
                {
                    matrix[i, j] = tempArr[j];
                }
            }
            var resArr = new bool[4];

            var p_0 = matrix[0, 3];
            var p_1 = matrix[1, 3];
            var p_2 = matrix[2, 3];
            var p_3 = matrix[3, 3];

            if (p_0 == 1)
            {
                if (matrix[0, 0] == 0 && matrix[0, 1] == 0 && matrix[0, 2] == 0 &&
                    matrix[1,0] == 0 && matrix[2,1] == 0 && matrix[3,2] == 0)
                {
                    resArr[0] = true;
                }
                else
                {
                    resArr[0] = false;
                }
            }
            else
            {
                resArr[0] = true;
            }

            if (p_1 == 1)
            {
                if (matrix[1, 0] == 0 && matrix[1, 1] == 0 && matrix[1, 2] == 0 &&
                    matrix[2, 0] == 0 && matrix[3, 1] == 0 && matrix[0, 2] == 0)
                {
                    resArr[1] = true;
                }
                else
                {
                    resArr[1] = false;
                }
            }
            else
            {
                resArr[1] = true;
            }

            if (p_2 == 1)
            {
                if (matrix[2, 0] == 0 && matrix[2, 1] == 0 && matrix[2, 2] == 0 &&
                    matrix[3, 0] == 0 && matrix[0, 1] == 0 && matrix[1, 2] == 0)
                {
                    resArr[2] = true;
                }
                else
                {
                    resArr[2] = false;
                }
            }
            else
            {
                resArr[2] = true;
            }

            if (p_3 == 1)
            {
                if (matrix[3, 0] == 0 && matrix[3, 1] == 0 && matrix[3, 2] == 0 &&
                    matrix[0, 0] == 0 && matrix[1, 1] == 0 && matrix[2, 2] == 0)
                {
                    resArr[3] = true;
                }
                else
                {
                    resArr[3] = false;
                }
            }
            else
            {
                resArr[3] = true;
            }

            if(resArr.Any(x=>x == true))
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }
        }
    }
}


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

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

            var n = int.Parse(Console.ReadLine());
            var t = Console.ReadLine();
            string[] mon = t.Split(new char[] { ' ' });
            int[] money = new int[n];
            int[] kh = new int[n];
            for(var i = 0; i < mon.Length; i++) {
                money[i] = int.Parse(mon[i]);
                }
            Array.Sort(money);
            if(n > 1) {
                for(var i = 0; i < n; i++) {
                    var k = money[i];
                    for(var j = 0; i < n; j++) {
                        if(k == money[j]) {
                            kh[i]++;
                            }
                        else
                            break;
                        }
                    }

                }

            Array.Sort(kh);
            Console.WriteLine(kh[n-1]+1);
         //  Console.ReadKey();
                }
        }
    }


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int[] a = new int[t];
            int temp = 0;
            for (int i=0; i<t; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }
            int[] b = new int[100];
            for (int i=0; i<t; i++)
            {
                b[a[i]]++;
            }
            for (int i = 0; i < 100; i++)
                if (b[i] > temp) temp = b[i];
            Console.WriteLine(temp);
        }
    }
}


using System;
using System.Linq;
using System.Runtime.Intrinsics.X86;
using static System.Console;
namespace test
{
    class Program
    {
        private static string[] a = new string[3];
        private static bool b = false;
        static void Main()
        {
            a[0] = ReadLine();
            a[1] = ReadLine();
            a[2] = ReadLine();
            check("rock", "scissors");
            check("scissors", "paper");
            check("paper", "rock");
            if (b == false)
                WriteLine("?");
        }
        private static void check(string ar, string br)
        {
            int index = 4;
            int licznik = 0;
            for (int i = 0; i < 3; i++)
            {
                if (a[i].Equals(ar)) index = i;
                else if (a[i].Equals(br)) licznik++;
            }
            if (licznik == 2 && index != 4) winner(index);
        }
        private static void winner(int i)
        {
            b = true;
            if (i == 0) WriteLine("F");
            if (i == 1) WriteLine("M");
            if (i == 2) WriteLine("S");
        }
    }
}


// Rock-paper-scissors - CodeForces
// Status: Unsolved

using System;

namespace ConsoleApp {
  class Program {

    static Func<string> insr =
      () => Console.ReadLine().Replace("\n", "").ToString();

    static bool twoEq(int a, int b, int c) {
      return !((a == b && b == c) || (a != b && a != c && b != c));
    }

    static int convert(string s) {
      switch (s) {
        case "rock":
          return 2;
        case "scissors":
          return 1;
        case "paper":
          return 0;
      }
      return 0;
    }

    static bool check(int a, int b) {
      return a > b || a == 0 && b == 2;
    }

    static int Main(string[] args) {
      int f = convert(insr());
      int m = convert(insr());
      int s = convert(insr());
      // if (!twoEq(f, m, s)) {
      //   Console.WriteLine("?");
      //   Environment.Exit(0);
      // }
      if (f == m && check(s, f)) {
        Console.WriteLine("S");
      } else if (f == s && check(m, f)) {
        Console.WriteLine("M");
      } else if (s == m && check(f, s)) {
        Console.WriteLine("F");
      } else {
        Console.WriteLine("?");
      }
      return 0;
    }
  }
}


using System;

namespace _4A_watermelon
{
    class Program
    {
        static void Main(string[] args)
        {
            string line= Clonsole.ReadLine();
            string[]tok=line.split(' ');
            int n=int.Parse(tok[0]),a=int.Parse(tok[1]);
                     Console.WriteLine("{0}",n-a);

        }
    }
}


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("{1} ", arr[i, j]);
                    }
                    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, 3);
            //Console.ReadLine();
            //
        }
    }
}