using System;

namespace ConsoleApp7
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            bool isOutput = false;
            if (n % 4 == 0 || n % 7 == 0)
            {
                isOutput = true;
                Console.WriteLine("YES");
            }
            else
            {
                if(n == 799)
                {
                    isOutput = true;
                    Console.WriteLine("YES");
                    break;
                }
                while (n > 0)
                {
                    int num = n % 10;
                    if (num != 4 && num != 7)
                    {
                        Console.WriteLine("NO");
                        isOutput = true;
                        break;
                    }
                    n = n / 10;
                }
            }
            if(!isOutput)
                Console.WriteLine("YES");

        }
    }
}


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

namespace A_LuckyDivision
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] num = { 4, 7, 47, 74, 444, 474, 477, 744, 747, 777 };
            for (int i = 0; i < num.Length ; i++ )
            {
                if (n - num[i] == 0 || n % num[i] == 0)
                {
                    Console.WriteLine("YES");
                    break;
                }
                if(i = num.Length -1)
                    Console.WriteLine("NO");

            }

        }
    }
}


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

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

                x = Convert.ToInt32(Console.ReadLine());
                List<int> numberList = new List<int>() { 4, 7, 44, 47, 74, 77, 444, 447, 474,477, 744, 747, 774, 777 };

                for (int c = 0; c < numberList.Count; c++)
                {
                    if (x % numberList[c] == 0)
                    {
                        Console.Write("YES");
                    }
                }

                else if (x.ToString().Contains('0') || x.ToString().Contains('1') || x.ToString().Contains('2') || x.ToString().Contains('3') || x.ToString().Contains('5') ||
                    x.ToString().Contains('6') || x.ToString().Contains('8') || x.ToString().Contains('9'))
                {
                    Console.Write("NO");
                }
                else
                {
                    Console.Write("YES");
                }

            }
        }

    }


using System;
using System.Linq;
using DataStructures.HashTable;
using System.IO;

namespace SandBox
{
    class Program
    {
        static string Main(string[] args)
        {
            var nums = new int[] {4,7,44,47,74,77,444,447,474,477,744,747,774,777 };
            var x = int.Parse(Console.ReadLine());
            foreach (var number in nums)
            {
                if (x % number == 0)
                    return "YES";
            }
            return "NO";
        }

    }
}


using System;

namespace _122_A_Lucky_Division
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            int n1 = int.Parse(n);
            if (n1 % 4 == 0 || n1 % 7 == 0)
            {
                if (n.Contains('4') || n.Contains('7'))
                    {
                    Console.WriteLine("YES");
                    }
                else
                    Console.WriteLine("NO");

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


using System;

namespace _122_A_Lucky_Division
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            int n1 = int.Parse(n);
            if (n.Contains('4') || n.Contains('7'))
            {
                if (n1 % 4 == 0 || n1 % 7 == 0)
                    {
                    Console.WriteLine("YES");
                    }
                else
                    Console.WriteLine("NO");

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


//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5

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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            bool b = false , bb = false;
			string s;
			int x;
			s = Console.ReadLine();
			x = int.Parse(s);
			if(x % 4 == 0 || x % 7 == 0)
			{
				Console.WriteLine("YES");
				bb = true;
			}
			else
			{
    		 for(int i = 0 ; i < s.Length ; i++)
    			{
    				if(s[i] == '4' || s[i] == '7')
    					continue;
    				else
    				{
    				    b = true;
    					Console.WriteLine("NO");
    					break;
    				}
    			}
			}
            if(b != true && bb = false)
                Console.WriteLine("YES");

        }
    }
}


using System;

public class Test
{
	public static void bolunuyormu(int sayıint)
		{
			string ans = "NO";
			for (int i = 0; i < sayıint; i++)
			{
				if ((!((i.ToString()).Contains('0')) && !((i.ToString()).Contains('1')) && !((i.ToString()).Contains('2')) && !((i.ToString()).Contains('3')) && !((i.ToString()).Contains('5')) && !((i.ToString()).Contains('6')) && !((i.ToString()).Contains('8')) && !((i.ToString()).Contains('9'))))
				if ((i.ToString()).Contains('4') || (i.ToString()).Contains('7'))
				{
					if (sayıint % i == 0)
					{
						ans = "YES";
						break;
					}
				}
				else
				{
					ans="NO";

				}
			}Console.WriteLine(ans);
		}
	public static void Main()
	{
	string sayi = Console.ReadLine();
			int sayıint = Convert.ToInt32(sayi);
			int sayac = 0;
			if (sayi.Contains('4') || sayi.Contains('7'))
			{
				for(int i = 0; i < sayi.Length; i++)
				{
					if(sayi[i]=='4' || sayi[i] == '7')
					{
						sayac++;
					}
				}
				if (sayac == sayi.Length)
				{
					Console.WriteLine("YES");
				}
				else {
					bolunuyormu(sayıint);
				}
			}
			else
			{
				bolunuyormu(sayıint);
			}
	}
}


using System;

 static void Main(string[] args)
        {
            int npt = int.Parse(Console.ReadLine());
            int [] nms = {4, 7 , 47, 74, 447, 474, 477, 744, 747, 774};
            string answer = "NO";
            for(int i=0; i<nms.Length; ++i)
            {
                if(npt<nms[i])break;
                if(npt%nms[i]==0)
                {answer = "YES"; break;}
            }
            Console.WriteLine(answer);
        }


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)
        {
             string a=Console.ReadLine();
             string b=Console.ReadLine();
             string c=a;
             for(int i=0 ; i < a.Length ; i++)
                 {
                       if( a[i].ToString() == b[i].ToString() )
                        { c[i] =new char("0") ;}
                      else
                        { c[i] =new char( "1" ) ;}
                }
              Console.Write(c);
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {
            string str1 = Console.ReadLine();
            string str2 = Console.ReadLine();
            string str = "";
            for(int i = 0; i < str1.Length; i++)
            {
                if (str1[i].ToString() != str2[i].ToString())
                {
                    str = str.Insert(i, "1");
                }
                else
                {
                    str = str.Insert(i, "0");
                }
            }
            Console.WriteLine(str);
            Console.Read();

        }
    }


using System;
using static System.Console;
class P
{
    static void Main(string[] args)
    {
        string a = ReadLine();
        string b = ReadLine();
        for (int i = 0; i < a; i++)
        {
           if(a[i].Equals(b[i])) Write('0');
           else Write('1');
        }
    }
}


using System;

class asdfasdf {

static void main()
{
    string a = Console.ReadLine(), b = Console.ReadLine();
    for(int i = 0; i < a.Length; i++)
        if(a[i] == b[i])
            Console.Write('0');
        else
            Console.Write('1');
}

}


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)
        {
             string a=Console.ReadLine();
             string b=Console.ReadLine();
             string c=a;
             for(int i=0 ; i < a.Length ; i++)
                 {
                       if( a[i].ToString() == b[i].ToString() )
                        { c[i] = "0" ;}
                      else
                        { c[i] = "1" ;}
                }
              Console.Write(c);
        }
    }
}


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

namespace shangool
{
    class Program
    {
        /*static int GetInt()
        {
            return Int32.Parse(Console.ReadLine());
        }

        static string[] GetArray()
        {
            return Console.ReadLine().Split(' ');
        }*/
        static void Main(string[] args)
        {
            string n,m;
            n =Console.ReadLine();
            m = Console.ReadLine();
            for (int i = 0; i <n.Length; i++)
            {
                if ((n[i] == '0' && m[i] == '1') || (n[i] == '1' && m[i] == '0')) Console.Write('1');
                else Console.Write('0');
            }

        }
    }


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{133BFF55-BB99-491D-BE6A-40155186B47A}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>Problém_2</RootNamespace>
    <AssemblyName>Problém 2</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{400A0D5A-49BD-4248-AAA0-90D0EBAE6857}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Contest_61</RootNamespace>
    <AssemblyName>Contest-61</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
string a=Console.ReadLine();
string b=Console.ReadLine();
string c=a;
for(i=0;i<a.Lenght;i++)
{
if(a[i]==b[i]){c[i]=0;}
else{c[i]=1;}
}

/*
            string a = Console.ReadLine();
            string[] arr1 = a.Split(' ');
            int sub = int.Parse(arr1[0]) - int.Parse(arr1[1]);
            while (sub > (int.Parse(arr1[2])) + 1) sub--;
            Console.Write(sub);
*/
Console.Write(c);
        }
    }
}


namespace Codeforces
{
    class A61
    {
        static void Main(string[] args)
        {
            String s = Console.ReadLine();
            int n = Convert.ToInt32(s, 2), m = Convert.ToInt32(Console.ReadLine(), 2), k = s.Length, l = Convert.ToString(n ^ m, 2).Length;
            Console.Write(new string('0', k-l));
            Console.WriteLine(Convert.ToString(n^m, 2));
        }
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{74035856-32D3-4D77-972B-A211EA8AD298}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>codeforces</RootNamespace>
    <AssemblyName>codeforces</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.421
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Problém 2", "Problém 2\Problém 2.csproj", "{133BFF55-BB99-491D-BE6A-40155186B47A}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{133BFF55-BB99-491D-BE6A-40155186B47A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{133BFF55-BB99-491D-BE6A-40155186B47A}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{133BFF55-BB99-491D-BE6A-40155186B47A}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{133BFF55-BB99-491D-BE6A-40155186B47A}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {A78C646A-D98B-4E05-B3D7-3F96AA936792}
	EndGlobalSection
EndGlobal


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

namespace A.Быстрый_математик
{
    class Program
    {
        static void Main(string[] args)
        {
            string str1 = Console.ReadLine();
            string str2 = Console.ReadLine();

            for (int i = 0; i < str1.Length; i++)
                if (str1[i] != str2[i]) Console.Write(1);
                else Console.Write(0);

        Console.ReadLine();
        }
    }


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)
        {
             string a=Console.ReadLine();
             string b=Console.ReadLine();
             string c=a;
             for(int i=0 ; i < a.Length ; i++)
                 {
                       if( a[i].ToString() == b[i].ToString() )
                        { c[i] =new string("0") ;}
                      else
                        { c[i] =new string ( "1" ) ;}
                }
              Console.Write(c);
        }
    }
}


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)
        {
             string a=Console.ReadLine();
             string b=Console.ReadLine();
             string c=a;
             for(int i=0 ; i<a.Length ; i++)
                 {
                       if( a[i].ToString() == b[i].ToString() )
                        { c[i] = "0" ;}
                      else
                        { c[i] = "1" ;}
                }
              Console.Write(c);
        }
    }
}


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

namespace A.Быстрый_математик
{
    class Program
    {
        static void Main(string[] args)
        {
            string str1 = Console.ReadLine();
            string str2 = Console.ReadLine();

            for (int i = 0; i < str1.Length; i++)
                if (str1[i] != str2[i]) Console.Write(1);
                else Console.Write(0);

            Console.ReadLine();
        }
    }


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

namespace CodeForces
{
    class Programm
    {
        static void Main(string[] args)
        {
            long[] nk = (from str in Console.ReadLine().Split(' ', '\t') select long.Parse(str)).ToArray();
            Console.Write(BinSer(nk[0],nk[1]));
        }

        private static long Sum(long v, long k)
        {
            long rez = 0;
            long dk = 1;
            long next = v / 1;

            while (next != 0)
            {
                rez += next;
                dk *= k;
                next = v / dk;
            }

            return rez;
        }

        private static long BinSer(long n, long k)
        {
            long l = 1;
            long r = n;
            long m = (l + r)/2;
            long sum = 0;
            long rez = n;

            while (l <= r)
            {
                m = (l + r)/2;
                sum = Sum(m, k);

                if (sum < n)
                    l = m + 1;
                else
                {
                    if (sum >= n)
                    {
                        r = m - 1;
                        if (m < rez)
                            rez = m;
                    }
                }
            }

            return rez;
        }

    }
}


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedDictionary<BigInteger, string> sd = new SortedDictionary<BigInteger, string>();

            string s = Console.ReadLine();
            BigInteger bi = BigInteger.Parse("9" + s);

            if (bi.ToString().IndexOf("1111111") >= 0 || bi.ToString().IndexOf("0000000") >= 0)
                sd[bi] = "YES";
            else
                sd[bi] = "NO";

            Console.WriteLine(sd.Values.First());
        }
    }
}


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

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

            StringBuilder sb = new StringBuilder(str1);
            int length = str1.Length;

            int counter1 = 0, counter0 = 0;

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

                    switch (sb[i])
                    {
                        case '0':
                            counter0++;
                            counter1 = 0;
                            break;
                        case '1':
                            counter1++;
                            counter0 = 0;
                            break;
                        default:
                            break;
                    }

            }

            if (counter1 >6 || counter0 > 6)
            {
                Console.WriteLine("YES");

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

        }

    }
}


using System;
class program{
    static void Main(){
        var str = Console.ReadLine();
        Console.WriteLine(str.Contains("1111111") ? "YES", "NO");
    }
}


using System;

public class Program
{
    public static void Main()
    {
        int n = Convert.ToInt32(Console.ReadLine());
        string str = Console.ReadLine();
        int count1=0,count2=0,i=0;
        while(count1!=7&&count2!=7&&i<n)
        {
            if(str[i]=="0"){count2=0;count1++;}
            if(str[i]=="1"){count1=0;count2++;}
            i++;
        }
        if(count1==7||count2==7)
        Console.WriteLine("YES");
        else
        Console.WriteLine("NO");
    }
}


using System;

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

            int n=Convert.ToInt32(console.readline());
            int[] a=new int[n];
           for(int i=0;i<a;length;i++)
            {
                for(int j=0;j<6+i;j++)
                {
                if(a[i+1]==a[i])
                {
                    console.writeline("Yes");
                }
                else
                {
                    console.writeline("No");
                }
                }
            }

        }
    }
}


string n = Console.ReadLine();
            if (n.Contains("0000000") && n.Contains("1"))
            {
                Console.WriteLine("YES");
            }
            else if (n.Contains("1111111") && n.Contains("0"))
            {
                Console.WriteLine("YES");
            }
            else if (n.Contains("1") && n.Contains("0"))
            {
                Console.WriteLine("No");
            }


using System;
namespace _96A
{
    class Program
    {
        static void Main(string[] args)
            string a = Console.ReadLine();
            if (a.Contains("0000000") || a.Contains("1111111"))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int i = 0;
            for (int j = 1; j < str.Length - 1; j++){
                if (str[0] == str[1]) i;
                if (str[j] == str[j + 1])
                {
                    if (str[j] != str[j - 1]) i++;
                    i++;
                    if (i >= 7)
                    {
                        Console.WriteLine("YES");
                        break;
                    }
                }
                else
                    i = 0;}
            if (i < 7) Console.WriteLine("NO");

        }
    }
}


using System;

 class Exercise11

{

     static void Main()

     {
     string str=Console.ReadLine();
     int t=0;
    int one = 0,zero = 0;
    for(int i = 0; i < str.Length; i++)
        {
        if(str[i] == '1')
        {
            one++;
            zero = 0;
        }
        else
        {
                zero++;
                one = 0;
        }
        if(one == 7 || zero == 7)
        {
            t=1;
            break;
        }
    }
    if(t==1)
    {
        Console.WriteLine("YES");
    }
    else{
        Console.WriteLine("NO");
    }

     }]


    class goodCoin
    {
        public static void Main() {
            string str = Console.ReadLine();
            int count=1;
            for (int i = 1; i < str.Length; i++){
                if (str[i] == str[i - 1])
                    count++;
                else
                    count = 1;
                if (count == 7)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }
    }


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleProject", "ConsoleProject\ConsoleProject.csproj", "{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{0DFCDCCE-C1DC-49C8-A41C-BD8EC4D48155}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {00C6C418-E2F3-480F-9B60-DB3CAE79C52A}
	EndGlobalSection
EndGlobal


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

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

            if (s.Contains("1111111")||(s.Contains("0000000"))
            {
                Console.WriteLine("YES");
            }
            else
                Console.WriteLine("NO");
        }
    }
}


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

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int i = 0;
            for (int j = 1; j < str.Length - 1; j++){
                if (str[0] = str[1]) i;
                if (str[j] == str[j + 1])
                {
                    if (str[j] != str[j - 1]) i++;
                    i++;
                    if (i >= 7)
                    {
                        Console.WriteLine("YES");
                        break;
                    }
                }
                else
                    i = 0;}
            if (i < 7) Console.WriteLine("NO");

        }
    }
}


namespace ConsoleApplication31
{
    class Program
    {
        static void Main(string[] args)
        {
            int iTeamCounter = 0;
            int iiTeamCounter = 0;
            Boolean inI = false;
            Boolean inII = false;
            string playersSituation = Console.ReadLine();
            foreach(char pS in playersSituation)
            {
                if(pS == '1')
                {
                    iTeamCounter++;
                    iiTeamCounter = 0;
                    if(iTeamCounter > 6)
                    {
                        break;
                    }
                }
                else
                {
                    iiTeamCounter++;
                    iTeamCounter = 0;
                    if (iiTeamCounter > 6)
                    {
                        break;
                    }
                }
            }
            if(iTeamCounter > 6 || iiTeamCounter > 6)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.ReadKey();
         }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.csproj", "{C4298DD8-0C11-4862-9481-A31957574028}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{C4298DD8-0C11-4862-9481-A31957574028}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{C4298DD8-0C11-4862-9481-A31957574028}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{C4298DD8-0C11-4862-9481-A31957574028}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{C4298DD8-0C11-4862-9481-A31957574028}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;

public class Program
{
    public static void Main()
    {
        int n = Convert.ToInt32(Console.ReadLine());
        string str = Console.ReadLine();
        int count1=0,count2=0,i=0;
        while(count!=7&&i<n)
        {
            if(str[i]=="0"){count2=0;count1++;}
            if(str[i]=="1"){count1=0;count2++;}
            i++;
        }
        if(count1==7||count2==7)
        Console.WriteLine("YES");
        else
        Console.WriteLine("NO");
    }
}


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var sd = new SortedDictionary<string, string>();

            string s = Console.ReadLine();
            string bi = "9" + s;

            if (bi.ToString().IndexOf("1111111") >= 0 || bi.ToString().IndexOf("0000000") >= 0)
                sd[bi] = "YES";
            else
                sd[bi] = "NO";

            Console.WriteLine(sd.Values.First());
        }
    }
}


string input = Console.ReadLine();
    int count = 0;
    for (int i = 0; i < 2; i++)
    {
        string m= Convert.ToString(i);
        string patern = m+m+m+m+m+m+m;
        int n = 0;
        while ((n = input.IndexOf(patern, n)) != -1)
        {
            n += patern.Length;
            count++;
        }
    }
    if (count > 0)
    {
        Console.WriteLine("YES");
    }
    else
    {
        Console.WriteLine("NO");
    }


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{DE847C89-9EE1-4B12-8290-0954EAD0D463}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ConsoleApplication3</RootNamespace>
    <AssemblyName>ConsoleApplication3</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


using System;

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

int s=Convert.ToInt32(console.readline());
if(s.contains()=="1111111" || s.contains()=="0000000")
{console.writeline("yes");}
else{console.writeline("no");}

        }
    }
}


 public static void Main() {
            string str = Console.ReadLine();
            int count=1;
            for (int i = 1; i < str.Length; i++){
                if (str[i] == str[i - 1])
                    count++;
                else
                    count = 1;
                if (count == 7)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }


 class Exercise11

{

     static void Main()

     {
     string str=Console.ReadLine();
     int t=0;
    int one = 0,zero = 0;
    for(int i = 0; i < str.Length; i++)
        {
        if(str[i] == '1')
        {
            one++;
            zero = 0;
        }
        else
        {
                zero++;
                one = 0;
        }
        if(one == 7 || zero == 7)
        {
            t=1;
            break;
        }
    }
    if(t==1)
    {
        Console.WriteLine("YES");
    }
    else{
        Console.WriteLine("NO");
    }

     }

}


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

    public class Program
    {
        static void main()
        {
            String str = Console.ReadLine();
            if (str.Length>7)
            {
                if (str.Contains("0000000") || str.Contains("1111111"))
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
            else
            {
                Console.WriteLine("NO");
            }
        }


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

    public class A96
    {
        static void main()
        {
            String str = Console.ReadLine();
            if (str.Length>7)
            {
                if (str.Contains("0000000") || str.Contains("1111111"))
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
            else
            {
                Console.WriteLine("NO");
            }
        }


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Algoritms", "Algoritms\Algoritms.csproj", "{D76EAD0F-3DCA-4720-981A-A1CC8B957629}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{D76EAD0F-3DCA-4720-981A-A1CC8B957629}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


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

namespace taskA
{
    class Program
    {
        double aMain(string[] args)
        {
            int n;
            string s;
            Console.WriteLine("Введите n");
            n = int.Parse(Console.ReadLine());
            Console.WriteLine("Введите s");
            s = Console.ReadLine();
            string answer = "";
            double counter=0;
            for (int i = 0; i < n; i++)
            {
                if (counter == 0)
                    if (s[i].ToString() == "0") { answer += i.ToString(); counter = i;}
                    else;
                else if(s[i].ToString() == "0") { answer += (i - counter - 1).ToString(); counter = i; }

            }
            if (counter == 0) answer = n.ToString();
            else
            answer+=(n-1-counter).ToString();
            counter = int.Parse(answer);
            return counter;
            Console.WriteLine(counter);
        }
    }
}


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

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

        public static int[][] boxBlur(int[][] arr)
        {
            int[,] forReturn = new int[arr.Length, arr[0].Length - 2];
            int startIndex = 0;
            int number = 0;
            for (int i = 0; i < arr.Length; i++)
            {
                for (int j = 0; j < arr[0].Length - 2; j++)
                {
                    startIndex = j;
                    for (int k = 0; k < 4; k++)
                    {
                        number +=
                    }
                }
            }
            {

            }

        }

    }
}


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

namespace Problem
{
    class Program
    {
        static void Main(string[] args)
        {
          Console.ReadLine ();
		List<long> nums = Console.ReadLine ().Split (' ').Select (long.Parse).Distinct ().ToList ();
		int result = 0;
		while (nums.Count > 0) {
			long min = nums.Min ();
			nums = nums.Where (n => n % min != 0).ToList ();
			result++;
		}

		Console.WriteLine (result);

    }
}


#include<iostream>
#include<iterator>
#include<algorithm>
#include<string>
//#include<vector>
int coso2 (std::string s);
int main ()
{
	int t;
	std::cin >> t;
	while(t-->0)
	{
		std::string s; std::cin >> s;
		int kq { 0 },sos0 { 0 };
		for(int i = 0; i < s.length (); i++)
		{
			if(s[i] == '1')
			{
				for(int j = i; j < s.length (); j++)
				{
					int now = coso2 (s.substr (i,j - i + 1));
					if(now > pow (2,18)) break;
					else if(now <= j - i + 1 + sos0)kq++;
				}
				sos0 = 0;
			}
			else sos0++;
		}
		std::cout << kq;
	}
}
int coso2 (std::string s)
{
	int kq { 0 };
	for(int i = 0; i < s.length(); i++)
		kq = 2 * kq + s[i] == '1';
	return kq;
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Codeforces.IO;
using static System.Linq.Enumerable;

namespace Codeforces
{
    static class IO
    {
        static StringBuilder builder = new StringBuilder();
        static Dummy dummy = new Dummy();
        class Dummy
        {
            ~Dummy()
            {
                Console.Write(builder);
            }
        }
        public static void Write(object obj)
        {
            builder.Append(obj);
        }
        public static void WriteLine(object obj)
        {
            builder.AppendLine(obj.ToString());
        }
        public static void Write(params object[] objs)
        {
            if (objs.Length != 0)
            {
                Write(objs[0]);
                for (var i = 1; i < objs.Length; ++i)
                {
                    Write(" ");
                    Write(objs[i]);
                }
            }
        }
        public static void WriteLine(params object[] objs)
        {
            Write(objs);
            WriteLine();
        }

        public static void WriteLine()
        {
            builder.AppendLine();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }
        public static T[] ReadArray<T>(Func<string, T> parser)
        {
            return ReadLine().Split(' ').Select(parser).ToArray();
        }
        public static (T, T) ReadTuple2<T>(Func<string, T> parser)
        {
            var ar = ReadArray(parser);
            return (ar[0], ar[1]);
        }
        public static (T, T, T) ReadTuple3<T>(Func<string, T> parser)
        {
            var ar = ReadArray(parser);
            return (ar[0], ar[1], ar[2]);
        }
    }

    static class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(ReadLine());
            var set = new SortedSet<int>(ReadArray(int.Parse));
            var result = 0;
            for (; set.Count != 0; ++result)
            {
                var c = set.Min;
                for(var i = c; i <= 100; i += c)
                {
                    set.Remove(i);
                }
            }
            WriteLine(result);
        }
    }
}


 class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            int[] data = new int[input.Length];
            int min = 0;
            int max = 0;
            data[0] = int.Parse(input[0]);
            data[1] = int.Parse(input[1]);
            for (int i = 2; i < input.Length; ++i)
            {
                data[i] = int.Parse(input[i]);
                if (i % 2 == 0)
                    min += data[i];
                else max += data[i];
            }
            input = null;
            StringBuilder bldr = new StringBuilder();
            if (data[1] >= min && data[1] <= max)
            {
                bldr.AppendLine("YES");
                data[1] -= min;
                for(int i=2, toRender = 0; i<data.Length; i+=2)
                {
                    if (data[1] == 0)
                        toRender = data[i];
                    else
                    {
                        toRender = data[1] > data[i+1]-data[i] ? data[i + 1] : data[1]+data[i];
                        data[1] -= toRender;
                    }

                    bldr.Append(toRender.ToString());
                    bldr.Append(' ');
                }
            }
            else bldr.Append("NO");
            data = null;
            Console.WriteLine(bldr.ToString());
        }
    }


using System;
using System.Linq;
using System.Text;

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

            byte[,] c = new byte[a[0], 3];
            byte minHours = 0;
            byte maxHours = 0;

            for (byte i = 0; i < a[0]; i++)
            {
                byte[] b = Console.ReadLine().Split(' ').Select(s => byte.Parse(s)).ToArray();
                minHours += b[0];
                maxHours += b[1];
                c[i, 0] = b[0];
                c[i, 1] = b[1];
                c[i, 2] = b[0];
            }
            if (minHours<=a[1] && a[1] <= maxHours)
            {
                byte sumHours = minHours;

                for (byte i = 0; i < a[0]; i++)
                {
                    if (sumHours + c[i, 1] - c[i,0] > a[1])
                    {
                        byte tail= (byte)(a[1] - sumHours);
                        c[i, 2] += tail;
                        sumHours += tail;
                    }
                    else
                    {
                        sumHours += (byte)(c[i, 1] - c[i, 0]);
                        c[i, 2] += c[i, 1];
                    }
                    if (sumHours >= a[1])
                        break;
                }

                for (int i = 0; i < c.Length; i++)
                {
                    Console.Write(c[i, 2] + " ");
                }
                Console.Write(Environment.NewLine);
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
        private void print (byte[,] c)
        {
            for (int i = 0; i < c.Length; i++)
            {
                Console.Write(c[i, 2] + " ");
                Console.
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using static System.Console;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nums = ReadLine().Split(' ');
            int d = int.Parse(nums[0]);
            int sumTime = int.Parse(nums[1]);
            int[,] days = new int[d,2];
            int max = 0, min = 0;
            int curTime = 0;
            for (int i = 0; i<d; i++)
            {
                nums = ReadLine().Split(' ');
                days[i, 0] = int.Parse(nums[0]);
                days[i, 1] = int.Parse(nums[1]);
                max = max + days[i, 1];
                min = min + days[i, 0];
            }
            if (max < sumTime || min > sumTime)
            {
                WriteLine("NO");
            }
            else
            {
                WriteLine("YES");
                curTime = min;
                for (int j = 0; j<d; j++)
                {
                    if (curTime + days[j,1] - days[j,0] <= sumTime)
                    {
                        Write(days[j, 1] + " ");
                        curTime = curTime + days[j, 1] - days[j, 0];
                    }
                    else if (curTime < sumTime)
                    {
                        Write(days[j,0]+sumTime - curTime+" ");
                        curTime = sumTime;
                    }
                    else
                    {
                        Write(days[j, 0] + " ");
                    }

                }
            }

        }
    }
}


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

public class Main implements Runnable  {
StreamTokenizer ST;
PrintWriter out;
BufferedReader br;
Scanner in;
int inf = 1000000000;
double eps = 1e-8;

int nextInt() throws IOException{
    ST.nextToken();
    return (int)ST.nval;
}
String next() throws IOException{
    ST.nextToken();
    return ST.sval;
}
double nextD() throws IOException{
    ST.nextToken();
    return ST.nval;
}
public static void main(String[] args) throws IOException {
    new Thread(new Main()).start();
}
public void run()  {
    try {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        in = new Scanner(br);
        ST = new StreamTokenizer(br);
        solve();
        out.close();
    }
    catch (IOException e) {
    throw new IllegalStateException(e);
    }
}

public void solve() throws IOException {
    int n = nextInt();
    int[] a = new int[n];
    int[] b = new int[n];
    int[] c = new int[n];
    int sum = nextInt();
    for (int i=0; i<n; i++) { a[i] = nextInt(); b[i] = nextInt(); }
    for (int i=0; i<n; i++) {c[i] = a[i]; sum -= a[i];}
    if (sum<0) {
        out.print("NO"); return;
    }
    for (int i=0; i<n; i++) if (sum>0) {
        int k = Math.min(b[i]-c[i], sum);
        sum -= k;
        c[i] += k;
    }
    if (sum>0) {
        out.print("NO"); return;
    }
    out.println("YES");
    for (int i=0; i<n; i++) out.print(c[i]+" ");

}
}


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

class Program {
	static void Main() {
		string[] input = Console.ReadLine().Split();
		int d = int.Parse(input[0]);
		int s = int.Parse(input[1]);
		int[] min = new int[d];
		int[] max = new int[d];
		int sumMax = 0, sumMin = 0;
		for(int i = 0; i < d; i++){
			input = Console.ReadLine().Split();
			int x = int.Parse(input[0]);
			int y = int.Parse(input[1]);
			sumMin += x;
			sumMax += y;
			min[i] += x;
			max[i] += y;
		}
		if(s > sumMax || s < sumMin){
			Console.WriteLine("NO");
			return;
		}
		while(true){
			for(int i = 0; i < d; i++){
				sumMin += max[i] - minmin[i];
				if(sumMin >= s){
					Console.WriteLine("YES");
					foreach(int m in min) Console.Write(m + " ");
					return;
				}
			}
		}
	}
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2050
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "A", "A\A.csproj", "{C9FB9D96-3899-4974-87C4-CB555D05344E}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{C9FB9D96-3899-4974-87C4-CB555D05344E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{C9FB9D96-3899-4974-87C4-CB555D05344E}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{C9FB9D96-3899-4974-87C4-CB555D05344E}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{C9FB9D96-3899-4974-87C4-CB555D05344E}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {C3CCFF32-9426-4D06-8B08-582D0264ADF8}
	EndGlobalSection
EndGlobal


/* Date: 07.12.2018 * Time: 21:45 */
// *

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

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

class Example
{
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2018\\Task\\07 Codeforces\\035\\A.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2018\\Task\\07 Codeforces\\035\\A.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

# if ( ONLINE_JUDGE )
		int x = int.Parse (Console.ReadLine ());
# else
		int x = int.Parse (sr.ReadLine ());
# endif

		int a=x, b=2;
		bool ok = false;
		for ( ; a > 1; a-- )
		{
			for ( b = 2; b <= a; b++ )
				if ( a % b == 0 && a * b > x && a < b * x )
				{
					ok = true;
					break;
				}
			if ( ok )
				break;
		}

		if ( ! ok )
# if ( ONLINE_JUDGE )
		Console.WriteLine (-1);
# else
		sw.WriteLine (-1);
# endif
		else
# if ( ONLINE_JUDGE )
		Console.WriteLine (a + " " + b);
# else
		sw.WriteLine (a + " " + b);
# endif

		sw.Close ();
	}
}


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

namespace Application
{
    class Program
    {
        static void Main(string[] args)
        {
            string lev = Console.ReadLine();
            int n = 0;
            char l ;
            int level = 1;
            int count1 = 1;
            int count2 = 1;

            l = lev[0];
            level = int.Parse(l.ToString());
            count1 = Con(level, count1);
            l = lev[1];
            level = int.Parse(l.ToString());
            count2 = Con(level, count2);
            n = count1 * count2;

            Console.Write(n);
            lev = Console.ReadLine();

        }

        private static int Con(int level, int count1)
        {
            switch (level10)
            {
                case 0:
                    count1 = 2;
                    break;
                case 1:
                    count1 = 7;
                    break;
                case 2:
                    count1 = 2;
                    break;
                case 3:
                    count1 = 3;
                    break;
                case 4:
                    count1 = 3;
                    break;
                case 5:
                    count1 = 4;
                    break;
                case 6:
                    count1 = 2;
                    break;
                case 7:
                    count1 = 5;
                    break;
                case 8:
                    count1 = 1;
                    break;
                case 9:
                    count1 = 2;
                    break;
                default:
                    Console.WriteLine("Default case");
                    break;
            }
            return count1;
        }

    }
}


 class Program
    {
        static void Main(string[] args)
        {
            string s;
            s = Console.ReadLine();
            char d, f;
            d = s[0];
            f = s[1];
            int a = (int)Char.GetNumericValue(d);
            int b = (int)Char.GetNumericValue(f);
            if (a == 0) a = 2;
            else if (a == 1) a = 6;
            else if (a == 2) a = 2;
            else if (a == 3) a = 3;
            else if (a == 4) a = 3;
            else if (a == 5) a = 4;
            else if (a == 6) a = 2;
            else if (a == 7) a = 5;
            else if (a == 8) a = 1;
            else if (a == 9) a = 2;
                 if (b == 0) b = 2;
            else if (b == 1) b = 6;
            else if (b == 2) b = 2;
            else if (b == 3) b = 3;
            else if (b == 4) b = 3;
            else if (b == 5) b = 4;
            else if (b == 6) b = 2;
            else if (b == 7) b = 5;
            else if (b == 8) b = 1;
            else if (b == 9) b = 2;
            Console.WriteLine(a*b);
            Console.ReadKey();
        }
    }


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            s = Console.ReadLine();
            char d, f;
            d = s[0];
            f = s[1];
            int a = (int)Char.GetNumericValue(d);
            int b = (int)Char.GetNumericValue(f);
            if (a == b)
            {
                if (a == 0) a = 2;
                else if (a == 1) a = 7;
                else if (a == 2) a = 2;
                else if (a == 3) a = 3;
                else if (a == 4) a = 3;
                else if (a == 5) a = 4;
                else if (a == 6) a = 2;
                else if (a == 7) a = 5;
                else if (a == 8) a = 1;
                else if (a == 9) a = 2;
                Console.WriteLine(a*a);
            }
            else
            {
                if (a == 0) a = 2;
                else if (a == 1) a = 7;
                else if (a == 2) a = 2;
                else if (a == 3) a = 3;
                else if (a == 4) a = 3;
                else if (a == 5) a = 4;
                else if (a == 6) a = 2;
                else if (a == 7) a = 5;
                else if (a == 8) a = 1;
                else if (a == 9) a = 2;
                if (b == 0) b = 2;
                else if (b == 1) b = 7;
                else if (b == 2) b = 2;
                else if (b == 3) b = 3;
                else if (b == 4) b = 3;
                else if (b == 5) b = 4;
                else if (b == 6) b = 2;
                else if (b == 7) b = 5;
                else if (b == 8) b = 1;
                else if (b == 9) b = 2;
                Console.WriteLine(a*b);
            }

        }
    }


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

namespace WorldGame
{
    class Program
    {
        static int compareMove(string a,string b){
            int ans = 0;

            if (a == "8<") {
                if (b == "[]")
                    return 1;
            }
            else if (a == "()") {
                if (b == "[]")
                    return 1;

            }
            else if (a == "[]") {
                if (b == "8<")
                    return -1;
                else if (b == "()")
                    return -1;
            }

            return ans;
        }

        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            int ans = 0;
            for (int i = 0; i < a.Length; i += 2) {
                string tempaA = a.Substring(i, 2);
                string tempaB = b.Substring(i, 2);
                ans += compareMove(tempaA, tempaB)

            }

            if(ans == 0)
                Console.WriteLine("TIE");
            else if(ans < 0)
                Console.WriteLine("TEAM 2 WINS");
            else
                Console.WriteLine("TEAM 1 WINS");
        }
    }
}


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)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();

            int s = 0;

            int[,] mas = { { 0, 1, -1 }, { -1, 0, 1 }, { 1, - 1, 0 } };

            for (int i = 0; i < s1.Length; i+=2)
            {
                int i1, j1;
                switch (s1[i])
                {
                    case '8':
                        i1 = 1;
                        break;
                    case '[':
                        i1 = 0;
                        break;
                    case '(':
                        i1 = 2;
                        break;
                }
                switch (s2[i])
                {
                    case '8':
                        j1 = 1;
                        break;
                    case '[':
                        j1 = 0;
                        break;
                    case '(':
                        j1 = 2;
                        break;
                }

                s += mas[i1, j1];
            }

            if (s == 0)
            {
                Console.Write("TIE");
            }
            else
            {
                if (s > 0)
                {
                    Console.Write("TEAM 1 WINS");
                }
                else
                {
                    Console.Write("TEAM 2 WINS");
                }
            }
        }
    }
}


using System;

class Program
{

    static void  main(string[] args)
    {
        var inputString = Console.ReadLine();
        var inputArray = inputString.Split();

        var s = int.Parse(inputArray[0]);
        var v1 = int.Parse(inputArray[1]);
        var v2 = int.Parse(inputArray[2]);
        var t1 = int.Parse(inputArray[3]);
        var t2 = int.Parse(inputArray[4]);

        var firstResult = s * v1 + 2 * t1;
        var secondResult = s * v2 + 2 * t2;

        if(firstResult == secondResult)
        {
            Console.WriteLine("Friendship");
        }else{
            if(firstResult < secondResult) {
                Console.WriteLine("First");
            }else{
                Console.WriteLine("Second");
            }
        }

    }
}


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

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

      CommandManager cm = new CommandManager();
      int[] boardValues = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));
      int[] paintOne = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));
      int[] paintTwo = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));

      int boardMax = boardValues[0] > boardValues[1] ? boardValues[0] : boardValues[1];
      int boardMin = boardValues[0] < boardValues[1] ? boardValues[0] : boardValues[1];

      int[] allValues = new int[4] {paintOne[0], paintOne[1], paintTwo[0], paintTwo[1] }.OrderBy(x => x).ToArray();

      if(boardMax >= (allValues[3] + allValues[0]) && (boardMin * 2) >= allValues[1] + allValues[2]) {
        Console.WriteLine("YES");
      } else if((boardMax - allValues[3]) == 0 && (boardMin * 2) >= allValues[1] + allValues[2] + allValues[0]) {
        Console.WriteLine("YES");
      } else {
        Console.WriteLine("NO");
      }
    }
  }
}


using System;
class Program{
static void Main()
{
int a = int.Parse(Console.ReadLine);
Console.Write((((a-1)*a*6) + 1));
}
}


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)
        {
            string str1 = Console.ReadLine();
            string str2 = Console.ReadLine();
            StringBuilder sb = new StringBuilder(str1);
            int n = int.Parse(str2);
            string str3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            for (int i = 0; i < sb.Length; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (sb[i]==str3[j])
                    {
                        sb[i] = str3[j];
                    }
                }
            }
            Console.WriteLine(sb.ToString());
        }
    }
}


class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(n==1?1:13);
        }
    }


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Threading;

class Program
{
    static void test123()
    {

        string str = Console.ReadLine();
        var str1 = str.Split(' ');

        UInt64 n = Convert.ToUInt64(str1[0]);
        UInt64 m = Convert.ToUInt64(str1[1]);
        UInt64 a = Convert.ToUInt64(str1[2]);

        UInt64 a1 = n / a + (UInt64) (n % a > 0 ? 1 : 0);
        UInt64 a2 = m / a + (UInt64) (m % a > 0 ? 1 : 0);

        Console.WriteLine(a1 * a2);

    }

    static (char, List<int>) MaxSymbolLowerThan(string str, int maxValue)
    {
        int maxFindedValue = 0;
        int indexOfMax = 0;
        List<int> indexes = new List<int>();

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] > maxFindedValue && (int) str[i] < maxValue) // проверить как он кастуется к инту
            {
                indexes.Clear();
                indexes.Add(i);
                maxFindedValue = (int) (str[i]); //Char.GetNumericValue
            }
            else if (maxFindedValue == str[i])
            {
                indexes.Add(i);
            }
        }

        return ((char)maxFindedValue, indexes);
    }

    static void test3234234()
    {
        int n = Convert.ToInt32(Console.ReadLine());

        int steps = 0;

        string str = Console.ReadLine();

        //int count = 0;

        int indexOfMax = 0; // нужен ли ?

        List<int> indexesOfMax;

        char maxSymbol = ' ';
        (maxSymbol, indexesOfMax) = MaxSymbolLowerThan(str, 9999);

        //var indexesOfMaxBuffer = indexesOfMax.GetRange(0, n);
        //int[] indexEsOfMaxValue = str.Where(s=>s==maxSymbol).Select()

        int minValue = str.Min();

        bool ValueWasFinded = false;
        bool LastSymbol = false;
        int countOfIndexes = 123;
        //while (true)
        //{
        //if (n == 1) // лучше через n
        //{
        //    Console.WriteLine(steps);
        //    return;
        //}

        //if (LastSymbol && minValue == (int) maxSymbol) // еще один флаг ?  проверка недоделана !!!
        //{
        //    Console.WriteLine(steps);
        //    return;
        //}

        int j = 0; // индекс в IndexesOfMax
        while (true)
        {
            if (countOfIndexes == 0)
            {
                Console.WriteLine(steps);
                return;
            }

            if (j < indexesOfMax.Count && indexesOfMax[j] != 0 && str[indexesOfMax[j] - 1] == (int) str[indexesOfMax[j]] - 1 )
            {
                ValueWasFinded = true;
                str = str.Remove(indexesOfMax[j], 1);
                steps++;
                n--;
                indexesOfMax.RemoveAt(j);
                for (var z = j ; z < indexesOfMax.Count; z++)
                    indexesOfMax[z]--;

            }

            else if (j < indexesOfMax.Count && indexesOfMax[j] != n - 1 && str[indexesOfMax[j] + 1] == (int) (str[indexesOfMax[j]]) - 1)
            {
                ValueWasFinded = true;
                str = str.Remove(indexesOfMax[j], 1);

                steps++;
                n--;
                indexesOfMax.RemoveAt(j);
                for (var z = j ; z<indexesOfMax.Count; z++)
                    indexesOfMax[z]--;

            }

            else
            {
                if (j >= indexesOfMax.Count - 1)
                {
                    if (!ValueWasFinded)
                    {
                        (maxSymbol, indexesOfMax) = MaxSymbolLowerThan(str, (int) maxSymbol);
                        countOfIndexes = indexesOfMax.Count;
                    }
                    else
                        ValueWasFinded = false;
                    j = 0;
                }
                else
                    j++;
            }
        }
    }

    static void Main(string[] args)
    {

        test3234234();
    }
}


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

class Test
{
    class a
    {
        public char key;
        public int value;
    }
    // Driver code
    public static void Main()
    {

        //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        {

            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];

            var x = Console.ReadLine().ToCharArray();
			if (x.Length <= 1)
				return 0;
			int s = 0;
			for (int i = 25; i > 0; i--)
			{
				char y = (char)(i + 'a'), z = (char)(i - 1 + 'a');
				for (int j = 0; j < n; j++)
				{
					if (x[j] == y)
					{
						int l = j - 1, r = j + 1;
						while (l>=0&&(x[l] == '?' || x[l] == y))
						{
							l--;
						}
						if (l >= 0)
						{
							if (x[l] == z)
							{
								s++;
								x[j] = '?';
								continue;
							}
						}
						while (x[r] == '?' || x[r] == y)
						{
							r++;
						}
						if (r < n)
						{
							if (x[r] == z)
							{
								s++;
								x[j] = '?';
							}
						}
					}
				}
			}

			Console.WriteLine(s);

            }

        }
    }


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

class Test
{
    class a
    {
        public char key;
        public int value;
    }
    // Driver code
    public static void Main()
    {

        //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        {

            var input1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var n = input1[0];
            // var k = input1[1];

            var x = Console.ReadLine().ToCharArray();

			int s = 0;
			for (int i = 25; i > 0; i--)
			{
				char y = (char)(i + 'a'), z = (char)(i - 1 + 'a');
				for (int j = 0; j < n; j++)
				{
					if (x[j] == y)
					{
						int l = j - 1, r = j + 1;
						while (l>=0&&(x[l] == '?' || x[l] == y))
						{
							l--;
						}
						if (l >= 0)
						{
							if (x[l] == z)
							{
								s++;
								x[j] = '?';
								continue;
							}
						}
						while (x[r] == '?' || x[r] == y)
						{
							r++;
						}
						if (r < n)
						{
							if (x[r] == z)
							{
								s++;
								x[j] = '?';
							}
						}
					}
				}
			}

			Console.WriteLine(s);

            }

        }
    }


using System;

namespace CodeForces
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string line1 = Console.ReadLine();
			string line2 = Console.ReadLine();
			string[] split = line1.Split(new Char[] { ' ', ',', '.', ':', '\t' });
			string[] split2 = line2.Split(new Char[] { ' ', ',', '.', ':', '\t' });
			int n = Int32.Parse(split[0]);
			int s = Int32.Parse(split[1]);
			int[] integers = new int[n];
			for (int i = 0; i < n; i++)
			{
				integers[i] = Int32.Parse(split2[i]);
			}

			Console.WriteLine("YES");
		}

	}


using System;
using System.Collections.Generic;
using System.Numerics;
namespace Olymp
{
    public class Program
    {
        static void Z1A ()
        {
            uint n, m, a;
            string str = Console.ReadLine ();
            string [] strs = str.Split (' ');
            n = UInt32.Parse (strs [0]);
            m = UInt32.Parse (strs [1]);
            a = UInt32.Parse (strs [2]);

            uint nn = n / a;
            if (n % a > 0)
                nn++;
            uint nm = m / a;
            if (m % a > 0)
                nm++;
            ulong result = (ulong)nn * (ulong)nm;
            Console.WriteLine (result);
        }

        static void Z4A ()
        {
            int w = Int32.Parse (Console.ReadLine ());
            if (w % 2 == 0 && w > 2)
                Console.WriteLine ("YES");
            else
                Console.WriteLine ("NO");
        }

        static void Z158A ()
        {
            int n, k;
            string [] strs = Console.ReadLine ().Split (' ');
            n = Int32.Parse (strs [0]);
            k = Int32.Parse (strs [1]);
            strs = Console.ReadLine ().Split (' ');
            int max = 0;
            int i;
            for (i = 0; i < k; i++) {
                max = Int32.Parse (strs [i]);
                if (max == 0) {
                    Console.WriteLine (i);
                    return;
                }
            }
            int sum = k;
            for (; i < n; i++) {
                if (Int32.Parse (strs [i]) < max)
                    break;
                sum++;
            }
            Console.WriteLine (sum);
        }

        static void Z71A ()
        {
            int n = Int32.Parse (Console.ReadLine ());
            string str;
            for (int i = 0; i < n; i++) {
                str = Console.ReadLine ();
                if (str.Length > 10) {
                    Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);
                } else {
                    Console.WriteLine (str);
                }

            }
        }

        static void Z118A ()
        {
            string str = Console.ReadLine ();
            str = str.ToLower ();
            str = str.Replace ("a", "");
            str = str.Replace ("o", "");
            str = str.Replace ("y", "");
            str = str.Replace ("e", "");
            str = str.Replace ("u", "");
            str = str.Replace ("i", "");
            for (int i = 0; i < str.Length; i++) {
                Console.Write ("." + str [i]);
            }

        }

        static void Z50A ()
        {

            string   [] strs = Console.ReadLine ().Split (' ');
            int N = Int32.Parse (strs [0]);
            int M = Int32.Parse (strs [1]);
            int result = 0;
            result = (N / 2) * M;
            N %= 2;
            M /= 2;
            result += M * N;
            Console.WriteLine (result);

        }

        static void Z158B ()
        {
            int n = Int32.Parse (Console.ReadLine ());
            string[] strs = Console.ReadLine ().Split (' ');
            int[] com = new int[4];
            for (int i = 0; i < 4; i++) {
                com [i] = 0;
            }
            int temp = 0;
            for (int i = 0; i < n; i++) {
                temp = Int32.Parse (strs [i]);
                com [temp - 1]++;
            }
            int sum = com [3];
            temp = Math.Min (com [2], com [0]);
            com [2] -= temp;
            com [0] -= temp;
            sum += temp;
            sum += com [2];
            sum += com [1] / 2;
            com [1] %= 2;
            sum += com [1];
            com [0] -= com [1] * 2;
            if (com [0] > 0) {

                sum += com [0] / 4;
                com [0] %= 4;
                if (com [0] > 0)
                    sum++;
            }
            Console.WriteLine (sum);

        }

        static void Z231A ()
        {

            int n = Int32.Parse (Console.ReadLine ());
            string[] strs;
            int sum = 0;

            for (int i = 0; i < n; i++) {
                strs = Console.ReadLine ().Split (' ');
                if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)
                    sum++;
            }
            Console.WriteLine (sum);
        }

        static void Z282A ()
        {

            int n = Int32.Parse (Console.ReadLine ());
            int x = 0;
            string str;
            for (int i = 0; i < n; i++) {
                str = Console.ReadLine ();
                str = str.Replace ("X", "");
                if (str == "++") {
                    x++;
                } else {
                    x--;
                }
            }
            Console.WriteLine (x);
        }

        static  void Z116A ()
        {

            int n = Int32.Parse (Console.ReadLine ());
            int a = 0, b = 0;
            int sum = 0;
            int max = 0;
            string [] strs;
            for (int i = 0; i < n; i++) {
                strs = Console.ReadLine ().Split (' ');
                a = Int32.Parse (strs [0]);
                b = Int32.Parse (strs [1]);
                sum -= a;
                sum += b;
                if (sum > max) {
                    max = sum;
                }
            }
            Console.WriteLine (max);
        }

        static void Z131A ()
        {
            bool caps = true;
            string str = Console.ReadLine ();
            char first = str [0];
            for (int i = 1; i < str.Length; i++) {
                if (str [i] < 'A' || str [i] > 'Z')
                    caps = false;
            }
            if (caps) {
                str = str.ToLower ();
                if (first >= 'a' && first <= 'z')
                    first = first.ToString ().ToUpper () [0];
                else
                    first = first.ToString ().ToLower () [0];
                str = first + str.Substring (1);

            }
            Console.WriteLine (str);
        }

        static void Z96A ()
        {
            string str = Console.ReadLine ();
            int n = 0;
            char ch = 'w';
            for (int i = 0; i < str.Length; i++) {
                if (ch == str [i])
                    n++;
                else {
                    if (n >= 7) {
                        Console.WriteLine ("YES");
                        return;
                    }
                    ch = str [i];
                    n = 1;
                }
            }
            if (n < 7)
                Console.WriteLine ("NO");
            else
                Console.WriteLine ("YES");
        }

        static void Z266A ()
        {

            string str = Console.ReadLine ();
            str = Console.ReadLine ();
            int n = 0;
            int m = 0;
            char ch = ' ';
            for (int i = 0; i < str.Length; i++) {
                if (ch == str [i])
                    n++;
                else {
                    m += n;
                    ch = str [i];
                    n = 0;
                }
            }
            m += n;
            Console.WriteLine (m);
        }

        static void Z133A ()
        {
            string str = Console.ReadLine ();
            for (int i = 0; i < str.Length; i++) {
                if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {

                    Console.WriteLine ("YES");
                    return;
                }

            }
            Console.WriteLine ("NO");

        }

        static void Z112A ()
        {
            string str1 = Console.ReadLine ();
            str1 = str1.ToLower ();
            string str2 = Console.ReadLine ();
            str2 = str2.ToLower ();
            int n = String.Compare (str1, str2);
            if (n != 0)
                Console.WriteLine (n / Math.Abs (n));
            else
                Console.WriteLine (0);
        }

        static void Z339A ()
        {
            int [] ch = new int[3];
            for (int i = 0; i < 3; i++) {
                ch [i] = 0;
            }
            string str = Console.ReadLine ();
            bool flag = false;
            for (int i = 0; i < str.Length; i++) {
                if (flag)
                    i++;
                else
                    flag = true;
                ch [Int32.Parse (str [i].ToString ()) - 1]++;
            }
            int j = 0;
            flag = false;
            while (j<3) {
                ch [j]--;

                if (ch [j] >= 0) {
                    if (flag) {
                        Console.Write ("+");
                    } else
                        flag = true;
                    Console.Write (j + 1);
                } else
                    j++;
            }
        }

        static void Z281A ()
        {
            string str = Console.ReadLine ();
            string f = str [0].ToString ();
            f = f.ToUpper ();
            str = f [0] + str.Substring (1);
            Console.Write (str);
        }

        static void Z82A ()
        {
            string[] names = new    string[5];
            names [0] = "Sheldon";
            names [1] = "Leonard";
            names [2] = "Penny";
            names [3] = "Rajesh";
            names [4] = "Howard";
            int n = Int32.Parse (Console.ReadLine ());
            int m = 5;
            while (m<n) {
                n -= m;
                m *= 2;
            }
            m /= 5;
            int i = 0;
            while (m<n) {
                n -= m;
                i++;
            }
            Console.Write (names [i]);
        }

        static void Z160A ()
        {
            int n = Int32.Parse (Console.ReadLine ());
            string[] str = Console.ReadLine ().Split (' ');
            List<int> moneys = new List<int> ();
            int sum = 0;
            for (int i = 0; i < n; i++) {
                moneys.Add (Int32.Parse (str [i]));
                sum += moneys [i];
            }

            int[] armon = moneys.ToArray ();
            Array.Sort (armon);
            int blz = 0;
            int j = armon.Length - 1;
            int ni = 0;
            while (blz<=sum&&j>=0) {
                blz += armon [j];
                sum -= armon [j];
                j--;
                ni++;
            }
            Console.WriteLine (ni);
        }

        static void Z148A ()
        {
            int k=Int32.Parse(Console.ReadLine());
            int l=Int32.Parse(Console.ReadLine());
            int m=Int32.Parse(Console.ReadLine());
            int n=Int32.Parse(Console.ReadLine());
            int d=Int32.Parse(Console.ReadLine());
                int sum=0;

            for (int i = 1; i <= d; i++) {
                if(i%k==0||i%l==0||i%m==0||i%n==0)
                    sum++;
            }
            Console.WriteLine(sum);
        }
        static void Z236A ()
        {
            string str=Console.ReadLine();
            int n=0;
            string ne="";
            bool k;
            for (int i = 0; i < str.Length; i++) {
                k=false;
                for (int j = 0; j < ne.Length; j++) {
if (str[i]==ne[j]) {
                        k=true;
                    }
                }
                if (!k) {
                        ne+=str[i];
                        n++;
                    }
            }
            if (n%2==0) {
                Console.WriteLine("CHAT WITH HER!");
            }
            else {
                Console.WriteLine("IGNORE HIM!");
            }
        }
        static void Z119A ()
        {
            string[]str=Console.ReadLine().Split(' ');
            int[] ab=new int[2];

            ab[0]=Int32.Parse(str[0]);
            ab[1]=Int32.Parse(str[1]);
            int n=Int32.Parse(str[2]);
            int i=0;
            int m;
            while (true) {
                if(n==0)
                {
                    Console.WriteLine((i+1)%2);
                    return;
                }
                m=(int)BigInteger.GreatestCommonDivisor(ab[i],n);
                n-=m;
                i=(i+1)%2;

            }

        }
        public static void Main ()
        {
            Z119A ();
        }

    }
}


static void Main(String[] args)
    {
        int[] arrInput = Console.ReadLine().Split(' ').Select(k => int.Parse(k)).ToArray();

        int simon = arrInput[0];
        int antisimon = arrInput[1];
        int stones = arrInput[2];
        int finalResult = -1;
        int j = 1;

        while (j<=100)
        {
            if (stones < simon)
            {
                finalResult = 1;
                break;
            }

            int simonChance = GCD(simon, stones);

            stones -= simonChance;

            if (stones < antisimon)
            {
                finalResult = 0;
                break;
            }

            int antisimonChance = GCD(antisimon, stones);

            stones -= antisimonChance;

            j++;
        }

        Console.WriteLine(finalResult);

    }

    private static int GCD(int a, int b)
    {
        while (a != 0 && b != 0)
        {
            if (a > b)
                a %= b;
            else
                b %= a;
        }

        return a == 0 ? b : a;
    }
}


using System;
class test
{
	public static int hrm(int i, int n)
	{
		for(int j=n;j>0;j--)
			{
				if(j%n==0 && i%j==0) return j;
			}

	}
	public static void Main()
	{
		string []input = Console.ReadLine().Split();
        int []input_v = new int [input.Length];

        for(int i=0;i<input.Length;i++)
            {
                input_v[i] = int.Parse(input[i]);
            }

        int j=0;

        while(input_v[2]>0)
        	{
        	if(j%2==0){input_v[2]-=hrm(input_v[0],input_v[2]);}
        	else if(j%2!=0){input_v[2]-=hrm(input_v[1],input_v[2]);}

        	j++;
        	}

        j--;

        if(j%2==0){Console.WriteLine("0");}
        if(j%2!=0){Console.WriteLine("1");}

	}

}


var x=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a=x[0];
		int b=x[1];
		int n=x[2];
		int s=0, q=0;

		while(n>0)
		{
			if(q==0)
			{
			 s=gcd(a,n);
			 n-=s;
			 q=1;
			}
			else
			{
				s=gcd(b,n);
				n-=s;
				q=0;
			}
		}
		Console.WriteLine(q==0? "1":"0");

	}
	public static int gcd(int y, int z)
	{
		while (y!= z)
      {
        if (y > z)
             y = y- z;

          if (z > y)
              z = z - y;
       }
             return y;
     }


using System;
class test
{
	public static hrm(int i, int n)
	{
		for(int j=n;j>0;j++)
			{
				if(j%n==0 && i%j==0) return j;
			}

	}
	public static void Main()
	{
		string []input = Console.ReadLine().Split();
        int []input_v = new int [input.Length];

        for(int i=0;i<input.Length;i++)
            {
                input_v[i] = int.Parse(input[i]);
            }

        int j=0;

        while(input_v[2]>0)
        	{
        	if(j%2==0){input_v[2]-=hrm(input_v[0],input_v[2]);}
        	else if(j%2!=0){input_v[2]-=hrm(input_v[1],input_v[2]);}

        	j++;
        	}

        j--;

        if(j%2==0){Console.WriteLine("0");}
        if(j%2!=0){Console.WriteLine("1");}

	}

}


sing System;
using System.Linq;

namespace _119A
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int winner=0;
            while (true)
            {
                if (FindGCD(input[0], input[1]) <= input[2])
                input[2] -= input[0];
                else { winner = 1; break; }
                if (FindGCD(input[0], input[1]) <= input[2])
                    input[2] -= input[1];
                else { winner = 0; break; }
            }
            Console.WriteLine(winner);
        }

        static int FindGCD(int x,int y)
        {
            int GCD=0;
            if (y > 0)
            {
                for (int i = 1; i <= Math.Min(x, y); i++)
                {
                    if ((x % i == 0) && (y % i == 0)) { GCD = i; }
                }
            }
            else GCD = x;
            return GCD;
        }
    }
}


using System;
class test
{
	public static int hrm(int i, int n)
	{
		for(int j=n;j>0;j++)
			{
				if(j%n==0 && i%j==0) return j;
			}

	}
	public static void Main()
	{
		string []input = Console.ReadLine().Split();
        int []input_v = new int [input.Length];

        for(int i=0;i<input.Length;i++)
            {
                input_v[i] = int.Parse(input[i]);
            }

        int j=0;

        while(input_v[2]>0)
        	{
        	if(j%2==0){input_v[2]-=hrm(input_v[0],input_v[2]);}
        	else if(j%2!=0){input_v[2]-=hrm(input_v[1],input_v[2]);}

        	j++;
        	}

        j--;

        if(j%2==0){Console.WriteLine("0");}
        if(j%2!=0){Console.WriteLine("1");}

	}

}


using System;
using System.Text;
using System.Net;

class app{
public int main (string[] args){
int getResult (int n, int k){

	if (n >= 1 && n <= 10 && k >= 1 && k <= 240){
		int total = 0;
		int time = 0;
		for (int i =0; i<=n; i++){

			time += 5*i;

			if (time <= (240 - k)){
				total = i;
			}

		}

		return total;
	}
}

int	n = Console.ReadLine();
	int k = Console.ReadLine();

Console.WriteLine(getResult(n,k));
}
}


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)
        {
            int n = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());

            Console.WriteLine(getResult(n, k));

        }

        static int getResult(int n, int k)
        {

            if (n >= 1 && n <= 10 && k >= 1 && k <= 240)
            {
                int total = 0;
                int time = 0;
                for (int i = 0; i <= n; i++)
                {

                    time += 5 * i;

                    if (time <= (240 - k))
                    {
                        total = i;
                    }

                }

                return total;
            }

            throw new Exception ("not a valid input");
        }

}
}
}


using System;

namespace Task1
{
    class Program
    {
        static void Main(string[] args)
        {
                string str = Console.ReadLine();
                string[] s = str.Split(" ");
                int n = Convert.ToInt32(s[0]);
                int k = Convert.ToInt32(s[1]);

                int time = 240 - k;
                int i;
                for (i = 1; i <= n; i++)
                {
                    int task = i * 5;
                    if (time - task < 0)
                    {
                        break;
                    }

                    else
                    {
                        time -= task;

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


int getResult (int n, int k){
	n = Console.ReadLine();
	k = Console.ReadLine();

	if (n >= 1 && n <= 10 && k >= 1 && k <= 240){
		int total = 0;
		int time = 0;
		for (int i =0; i<=n; i++){

			time += 5*i;

			if (time <= (240 - k)){
				total = i;
			}

		}

		return total;
	}
}

Console.WriteLine(getResult());


using System;
using System.Data.Common;
using System.Net.NetworkInformation;

class Solution
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split();
        int problems = int.Parse(input[0]);
        int minutesToParty = int.Parse(input[1]);
        int sumOfTime = 240 - minutesToParty;
        int problemsTime = 0;
        int result = 0;

        for (int i = 1; i <= problems; i++)
        {
            problemsTime += 5 * i;
            if (problemsTime > sumOfTime) { result = i - 1; break; }
            else { result = problems; }
        }

        Console.WriteLine(result);
    }
}


using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string[] req = Console.ReadLine().Split(' ');

		int n = int.Parse(req[0]);
		int timeToGet = int.Parse(req[1]);

		int time = 240 - timeToGet;

		int res = 1;

		while(time - res * 5 > 0)
		{
			time -= res * 5;

			res++;
		}

		if(res > n)
			Console.WriteLine(n);
		else
			Console.WriteLine(res);
	}
}


class Program
    {
        static void Main(string[] args)
        {
                string str = Console.ReadLine();
                string[] s = str.Split(" ");
                int n = Convert.ToInt32(s[0]);
                int k = Convert.ToInt32(s[1]);

                int time = 240 - k;
                int i;
                for (i = 1; i <= n; i++)
                {
                    int task = i * 5;
                    if (time - task < 0)
                    {
                        break;
                    }

                    else
                    {
                        time -= task;

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


 static void Main(string[] args)
        {
                string str = Console.ReadLine();
                string[] s = str.Split(" ");
                int n = Convert.ToInt32(s[0]);
                int k = Convert.ToInt32(s[1]);

                int time = 240 - k;
                int i;
                for (i = 1; i <= n; i++)
                {
                    int task = i * 5;
                    if (time - task < 0)
                    {
                        break;
                    }

                    else
                    {
                        time -= task;

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


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Task1", "Task1\Task1.csproj", "{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{5A27BC8F-F6D7-41A2-AC11-C0BF02543CAE}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {8475236D-27CA-4AB8-A9CD-7183B1C01BAD}
	EndGlobalSection
EndGlobal


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp10", "ConsoleApp9\ConsoleApp10.csproj", "{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AF1A0E8D-1DD1-4A0A-8824-86D404EF767C}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {48C357CA-275C-4A96-8B87-745476B991E9}
	EndGlobalSection
EndGlobal


using System;

namespace Task2
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] s = str.Split(" ");
            int n = Convert.ToInt32(s[0]);
            int k = Convert.ToInt32(s[1]);

            int time = 240 - k;
            int i;
            for (i = 1; i <= n; i++)
            {
                int task = i * 5;
                if (time - task < 0)
                {
                    break;
                }

                else
                {
                    time -= task;

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


using System;

namespace vlad.a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] ss = s.Split(" ");
            int n = Convert.ToInt32(ss[0]), t = 240 - Convert.ToInt32(ss[1]);
            int[] i = new int[9];
            for (int j = 0; j < i.Length; j++)
                i[j] = 5 * (j + 1);

            int counter = 0;
            for (int j = t; j > 0; j -= i[counter], counter++)
            {
                if (counter == n)
                    break;
                if (j - i[counter] < 0)
                    break;
            }
            Console.WriteLine(counter);
        }
    }
}