<?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>{A6433F69-09B1-4B38-A53A-A42C4F36580F}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Плиты</RootNamespace>
    <AssemblyName>Плиты</AssemblyName>
    <TargetFrameworkVersion>v3.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="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;
class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');

        int m=int.Parse(s[0]);
         int n=int.Parse(s[1]);
          int a=int.Parse(s[2]);

         if(m%a==0)
          totalM=m/a;
        else
          totalM=(m/a)+1;

         if(n-a<=0)
         Console.Write(totalM);

         else
         {
             n=n-a;
              if(n%a==0)
              totalN=n/a;
               else
               totalN=n/a+1;
                Console.Write(totalM+totalN);
         }

    }

}


using System;

namespace TheatreSquare{

    class Program{

        static void Main(string[] args){

            string arrayToSplit = Console.ReadLine();

            string[] arraySplited = arrayToSplit.Split(' ');

            int[] arrayConverted = new int[arraySplited.Length];

            for(int i=0;i<arraySplited.Length;i++){

                arrayConverted = Convert.ToDecimal(arraySplited[i]);
            }

            decimal b = Convert.ToDecimal(arrayConverted[0]);
            decimal h = Convert.ToDecimal(arrayConverted[1]);
            decimal square = Convert.ToDecimal(arrayConverted[2]);

            if (square%b==0 && square%h==0){

                Console.WriteLine(1);
            }

            if(b%square!=0 && h%square==0){

               decimal n = b/square;
               int nint = Math.Truncate(n);

                if (n-nint!=0){
                    Console.WriteLine(nint);
                }
                else{
                    Console.WriteLine(nint+1);
                }

                Console.WriteLine(nint+1);
            }

            if (b%square==0 && h%square!=0){
                decimal n = h/square;
               int nint = Math.Truncate(n);

                if (n-nint!=0){
                    Console.WriteLine(nint);
                }
                else{
                    Console.WriteLine(nint+1);
                }

                Console.WriteLine(nint+1);
            }

            if (b%square!=0 && h%square!=0){
                bool IsInt = false;

                decimal n = b/square;
               int nint = Math.Truncate(n);

               decimal j = h/square;
               int jint = Math.Truncate(h);

                Console.WriteLine(jint+nint+1);

            }

        }

    }
}


using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] values = s.Split(' ');
            long  a = int.Parse(values[0]);
            long  b = int.Parse(values[1]);
            long  c = int.Parse(values[2]);
            Console.WriteLine(((a + c - 1) / c) * ((b + c - 1) / c));
            Console.ReadKey();    }
}


using System;
using System.Linq;
class c {
int main(){
var nma=Console.ReadLine()
.Split().Select(e => int.Parse(e));
int n=nma[0];
int m=nma[1];
int a=nma[2];
Console.WriteLine(Math.Floor(n/a)*Math.Floor(m/a));

}

}


using System;

namespace ConsoleApp7
{
    class Program
    {
        private static void Main(string[] args)
        {
            int n = Console.ReadLine();
            int m = Console.ReadLine();
            int a = Console.ReadLine();
            decimal r1 = n/a;
            decimal r2 = m/a;
            if (n % a != 0) r1++;
            if (m % a != 0) r2++;

            Console.WriteLine(r1*r2);
        }
    }
}


using System;
using System.IO;

class TheatreSquare {

    static void Main()
    {
	int length = int.Parse(Console.Read());
	int breadth = int.Parse(Console.Read());
	int side = int.Parse(Console.Read());

	Console.WriteLine( ( ((length + 3)/4) * ((breadth + 3)/4) ).ToString());
    }

}


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)
        {
            int pars;
            int[] sl1 = Console.ReadLine().Split(' ').Select(i => int.TryParse(i, out pars) ? pars : 0).ToArray();
            double ma, na, result;
            ma = Math.Ceiling((double)(sl1[0]) / sl1[2]);
            na = Math.Ceiling((double)(sl1[1]) / sl1[2]);
            result = ma + na;
            decimal dec = decimal.Parse(result, System.Globalization.NumberStyles.Any);
            Console.WriteLine(dec);

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class c {
int main(){
var nma=Console.ReadLine()
.Split().Select(e => int.Parse(e));
int n=nma[0];
int m=nma[1];
int a=nma[2];
Console.WriteLine(Math.Floor(n/a)*Math.Floor(m/a));

}

}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] vars;
            int pars;
            vars = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(i => int.TryParse(i, out pars) ? pars : 0).ToArray();

            int a = vars[0];
            int b = vars[1];
            int c = vars[2];

            if (c == b && c == a)
            {
                Console.WriteLine(1);
                return;
            } else if(c == a || c == b)
                    {
                        Console.WrileLine(Math.Ceiling(a/c));
                        return;
                    } else {
                                float lenth = a > b ? a : b;
                                float width = a > b ? b : a;
                               Console.WriteLine(Math.Ceiling(lenth / c) + Math.Ceiling(width / c));
                           }
        }
    }
}


using System;

namespace ConsoleApplication12
{
    internal class Program
    {
        static void Main(string[] args)
        {
            long k,x,y;
            string[] numbers = Console.ReadLine().Split(' ');
            long n = long.Parse(numbers[0]);
            long m = long.Parse(numbers[1]);
            long a = long.Parse(numbers[2]);
            if (n % a == 0) { x = n / a; }
            else { x = n / a;
                x++;
            }
            if (m % a == 0) { x = n / a; }
            else
            {
                y = m / a;
                y++;
            }
            Console.WriteLine(x * y);

        }
    }
}


using System;

namespace TheatreSquare
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			double bigOne = Math.Pow (10, 9);
			double flagstones = 0;
			int m, n, a;
			Int32.TryParse (Console.ReadLine (), out m) && (m >= 1) && (m <= bigOne);
			Int32.TryParse (Console.ReadLine (), out n) && (n >= 1) && (n <= bigOne);
			Int32.TryParse (Console.ReadLine (), out a) && (a >= 1) && (a <= bigOne);
			double flagstonesInARow = Math.Ceiling (m / (double) a);
			double flagstonesInAColumn = Math.Ceiling (n / (double) a);
			flagstones = flagstonesInARow * flagstonesInAColumn;
			Console.WriteLine(flagstones);
		}
	}
}


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

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

            string x = Console.ReadLine();
            string[] s = x.Split(' ');
            int q = int.Parse(s[0]);
            int y = int.Parse(s[1]);
            int z = int.Parse(s[2]);
            Console.WriteLine(q%z + q%z);
            Console.ReadLine();
        }
    }
}


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace application1

{

    class Program

    {

        static void Main(string[] args)

        {
           int n, m, a;
		   n = Console.Read();
		   m = Console.Read();
		   a = Console.Read();
		   double tempResult1 = Convert.ToDouble((n-1)/a);
		   double tempResult2 = Convert.ToDouble((m-1)/a);
		   double pCount = Math.Ceiling(tempResult) + Math.Ceiling(tempResult2);

           Console.WriteLine(pCount);

        }

    }

}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            double a = double.Parse(args[0]);
            double b = double.Parse(args[1]);
            double d = double.Parse(args[2]);
            a = Math.Ceiling(a/d);
            b = Math.Ceiling(b / d);
            Console.WriteLine(a * b);
            Console.ReadLine();
        }
    }
}


/*
* 1A - Театральная площадь
* http://codeforces.com/problemset/problem/1/A
*/
using System;

namespace RConsole
{
	public class _1A
	{
		public static void Main ()
		{
            string [] input = Console.ReadLine().Split(' ');
            double n = Convert.ToDouble(input[0]);
            double m = Convert.ToDouble(input[1]);
            double a = Convert.ToDouble(input[2]);
            Console.WriteLine((long)Math.Ceiling((long)n / (long)a) * Math.Ceiling((long)m / (long)a));
		}
	}
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            long height_of_rectangle ; //height of rectangle
            long width_of_rectangle; //width of rectangle
            long square;            // square
            long constant_width_of_square; //  constant
            long constant_height_of_square; //  constant

            long num1 = 1; //number of squares for first row in rectangle
            long num2 = 1; // number of squares for first Horizontal in reactangle

            long result; // number of squares which need

            Console.WriteLine("please enter height of rectangle");
                 height_of_rectangle = Convert.ToInt64(Console.ReadLine()); //value of rectangle`s height
            Console.WriteLine("please enter width of rectangle");
                 width_of_rectangle = Convert.ToInt64(Console.ReadLine()); // value of rectangle`s width
            Console.WriteLine("please enter width or height of square");
                 square = Convert.ToInt64(Console.ReadLine()); // value of square`s height/width

                 constant_width_of_square = square;
                 constant_height_of_square = square;

                //number of squares in first row in rectangle

                while (square < width_of_rectangle)
                {
                    num1 = num1 + 1;
                    square = square + constant_width_of_square;
                }

                //number of squares in first Horizontal in reactangle

                while (constant_height_of_square < height_of_rectangle)
                {
                    num2 = num2 + 1;
                    constant_height_of_square = constant_height_of_square + c                    onstant_width_of_square;
                }
            // number of squres in rectangle
                result = num1 * num2;
                Console.WriteLine("number of squares are : " + result);

        }
    }
}


<?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>{26742737-E232-401F-8B31-D5B4AE323617}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>OkayFace</RootNamespace>
    <AssemblyName>OkayFace</AssemblyName>
    <TargetFrameworkVersion>v4.0</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>
  <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 ns{
    class Program{
        public static void Main(){
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int a = int.Parse(s[2]);
            int result;

            if(n%a== 0)result = n/a;
            else result = n/a+1;

            if(m/a == 0)result *= (m/a);
            else result*=(m/a + 1)

            Console.WriteLine(result);
        }
    }
}


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            int a = int.Parse(input[2]);
            int length = n / a;
            int width = m / a;

            if (n % a != 0)
            {
                length += 1;
            }

            if (m % a != 0)
            {
                width += 1;
            }

            int count = length * width;
            Console.WriteLine(count);
        }
    }
}


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace application1

{

    class Program

    {

        static void Main(string[] args)

        {
           Int64 n, m, a;
		   n = Console.Read();
		   m = Console.Read();
		   a = Console.Read();

           Console.WriteLine(Math.Ceiling((n-1)/a) + Math.Ceiling((m-1)/a));

        }

    }

}


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace application1

{

    class Program

    {

        static void Main(string[] args)

        {
           double n = 6, m = 6, a = 4;
           double sMain = n * m;
		   double pCount;
		   double pCount = Math.Ceiling(n/a) + Math.Ceiling(m/a);

           Console.WriteLine(pCount);

        }

    }

}


            int n = Convert.ToInt32(Console.ReadLine());
            List<string> sequence = new List<string>(n);
            string q = Console.ReadLine();
            if (n > q.Length)
            {
                Console.WriteLine("NO");
                return;
            }
            if (n == 1)
            {
                Console.WriteLine("YES");
                Console.WriteLine(q);
                return;
            }
            StringBuilder builder = new StringBuilder();
            int index = 1;
            builder.Append(q[0]);
            while (n > 0 && index < q.Length - 1)
            {
                if (builder.Length == 0 || q[index + 1] != builder[0])
                {
                    if (n == 1)
                    {
                        builder.Append(q.Substring(index));
                        sequence.Add(builder.ToString());
                        n--;
                    }
                    else
                    {
                        builder.Append(q[index++]);
                        sequence.Add(builder.ToString());
                        builder.Clear();
                        n--;
                    }
                }
                else
                {
                    builder.Append(q[index++]);
                }
            }

            if (n == 0)
            {
                Console.WriteLine("YES");
                for (int i = 0; i < sequence.Count; i++)
                    Console.WriteLine(sequence[i]);
            }
            else
                Console.WriteLine("NO");


 string[] fline = Console.ReadLine().Split(' ');
            int x = int.Parse(fline[0]);
            if (x % 2 != 0)
            { x++; }
            if (int.Parse(fline[1]) <= x / 2)
            {
                Console.WriteLine(2 * int.Parse(fline[1]) - 1);
            }
            else { Console.WriteLine((2 * int.Parse(fline[1]) - x)); }


using System;
class Sample
{
    public static voi Main()
    {
        String[] ip=Console.ReadLine().Split(' ');
        int ip1=int.Parse(ip[0]);
        int ip2=int.Parse(ip[1]);
        int[] arr=new int[ip1];
        int cnt=0;
        for(int i=1;i<ip1;i+=2)
        {
            arr[cnt++]=i;
        }
        for(int  i=0;i<ip1;i+=2)
        {
            arr[cnt++]=i;
        }

        Console.WriteLine(arr[ip2-1]);
    }

}


 long part,output;
     string s=Console.ReadLine();
     string[] values=s.Split(' ');
     long n=long.Parse(values[0]);
     long k=long.Parse(values[1]);

    if(n%2==0)
    {
        part=n/2;
    }
    else
    {
        part=(n/2)+1;
    }

    if(k<=part)
    {
        output=(2*k)-1;
    }
    else
    {
        output=(k-part)*2;
    }

    Console.WriteLine(output);

   }


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

            int kNumber = 0 ;

            int oddsNum = 0;

            if (n%2==0)
            {
                oddsNum = n / 2;

            }
            else if (n%2!=0)
            {
                oddsNum = (n / 2) + 1;
            }

            int evensNum = n / 2;

            if (k <= oddsNum) {

                kNumber = 1 + (k-1) * 2;

            }
            else
            {
                k = k - oddsNum;
                        kNumber = 2+(k-1)*2;

            }

            Console.WriteLine(kNumber);
            Console.ReadLine();

        }
    }
}


<?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>{5EA0CD21-7B4B-4B4C-BCD6-23884035146C}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>aasddsa</RootNamespace>
    <AssemblyName>aasddsa</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.Linq;
using System.Text;

namespace CodeForces
{
	class Program
	{
		public static void Main(string[] args)
		{
			EvenOdds();

		}
		public static void EvenOdds(){
			long[] nk = Array.ConvertAll(Console.ReadLine().Split(), x => Convert.ToInt64(x));
			Console.WriteLine(nk[1] > (nk[0]+1)/2 ? (nk[1]-(nk[0]+1)/2)*2:nk[1]*2-1);
		}


using System;

public class Test
{
	public static void Main()
	{
		long[] dizi = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
			long sonuc = 0;
			ArrayList sayilar=new ArrayList();

				if (dizi[0] % 2 == 0)
				{
					if (dizi[1] < dizi[0] / 2)
						sonuc=( 1 + (2 * (dizi[1]-1)));
					else
					{
					sonuc = ((dizi[1] )-(dizi[0] / 2))*2;
					}
				}
				else
				{
					if (dizi[1] <= dizi[0] / 2)
					sonuc = (1 + (2 * (dizi[1] - 1)));
				else
				{
					sonuc = (dizi[1] )-(dizi[0] / 2)*2;
				}
			}

			Console.WriteLine(sonuc);
	}
}


using System;
class Sample
{
    public static void Main()
    {
        String[] ip=Console.ReadLine().Split(' ');
        long n=int.Parse(ip[0]);
        long k=int.Parse(ip[1]);
        int limit=(n+1)/2;
        if(k<=limit)
        {
        Console.WriteLine(2 * k - 1);
        }
        else
        {
            Console.WriteLine(2 * (k-limit));

        }

    }
}


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

namespace codeforces318A
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> nk = Console.ReadLine().Split(" ").Select(x => Int32.Parse(x)).ToList();
            List<int> odd_list = new List<int>();
            List<int> even_list = new List<int>();
            for (int i = 1; i < nk[0]; i++)
            {
                if(i%2 == 0)
                {
                    even_list.Add(i);
                }
                else
                {
                    odd_list.Add(i);
                }
            }
            odd_list.AddRange(even_list);
            Console.WriteLine(odd_list[nk[1]]);
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        public class HeapSorter
        {
            private int[] _arr;
            private int _heapSize;

            public HeapSorter(int[] arr)
            {
                _arr = new int[2 * arr.Length];
                Array.Copy(arr, 0, _arr, 0, arr.Length);
                _heapSize = arr.Length;
            }

            private static void change(int[] arr, int idx1, int idx2)
            {
                int tmp = arr[idx2];
                arr[idx2] = arr[idx1];
                arr[idx1] = tmp;
            }

            private static int parent(int idx)
            {
                if (idx <= 2)
                    return 0;

                return idx / 2;
            }

            private static int left(int idx)
            {
                if (idx == 0)
                    return 1;

                return 2 * idx;
            }

            private static int right(int idx)
            {
                if (idx == 0)
                    return 2;

                return 1 + 2 * idx;
            }

            private static void maxHeapify(int[] arr, int idx, int heapSize)
            {
                int largest = idx;
                int l = left(idx);
                int r = right(idx);

                if (l < heapSize && arr[l] > arr[largest])
                {
                    largest = l;
                }
                if (r < heapSize && arr[r] > arr[largest])
                {
                    largest = r;
                }
                if (largest != idx)
                {
                    int tmp = arr[idx];
                    arr[idx] = arr[largest];
                    arr[largest] = tmp;
                    maxHeapify(arr, largest, heapSize);
                }
            }

            private static bool IsMaxHeap(int[] arr, int idx)
            {
                if (arr.Length < idx)
                    return true;

                int lIdx = left(idx);
                int rIdx = right(idx);

                bool gtLeft = true, gtRight = true;

                if (lIdx < arr.Length) {
                    gtLeft = arr[idx] >= arr[lIdx] && IsMaxHeap(arr, lIdx);
                }

                if (rIdx < arr.Length) {
                    gtRight = arr[idx] >= arr[rIdx] && IsMaxHeap(arr, rIdx);
                }

                return gtLeft && gtRight;
            }

            private static bool IsMaxHeap1(int[] arr)
            {
                for (int i = arr.Length - 1; i > 0; i--)
                    if (arr[parent(i)] < arr[i])
                        return false;

                return true;
            }

            private static void BuildMaxHeap(int[] arr)
            {
                int heapSize = arr.Length;
                for (int i = heapSize / 2; i >= 0; i--)
                {
                    maxHeapify(arr, i, heapSize);
                }
            }

            private static void HeapSort(int[] arr)
            {
                BuildMaxHeap(arr);
                int heapSize = arr.Length;
                for (int i = arr.Length - 1; i > 0; i--)
                {
                    int tmp = arr[0];
                    arr[0] = arr[--heapSize];
                    arr[heapSize] = tmp;
                    maxHeapify(arr, 0, heapSize);
                }
            }

            public bool IsHeapSorted()
            {
                return IsMaxHeap1(_arr);
            }

            public void HeapSort()
            {
                HeapSort(_arr);
            }

            public int HeapMax()
            {
                return _arr[0];
            }

            public int HeapExtractMax()
            {
                int max = _arr[0];
                _heapSize--;
                change(_arr, 0, _heapSize - 1);
                maxHeapify(_arr, 0, _heapSize);
                return max;
            }

            public void IncreaseKey(int idx, int key)
            {
                if (_arr[idx] < key)
                    return;
                _arr[idx] = key;
                for (int i = idx; i > 0; i = parent(i)) {
                    if (_arr[i] > _arr[parent(i)])
                        change(_arr, i, parent(i));
                }
            }

            public void MaxHeapInsert(int key)
            {
                IncreaseKey(_heapSize++, key);
            }
        }

        public class NonConfirmator
        {
            public static UInt34 getPosition(UInt64 n, UInt64 k)
            {
                if ((n+1)/2 >= k) {
                    return 2 * k - 1;
                }
                return k * 2 - ((n + 1) / 2) * 2;
            }
        }

        static void Main(string[] args)
        {
            //int[] arr = new int [] { 23, 17, 14, 6, 13, 10, 1, 5, 7, 12 };
            //int[] arr1 = new int[] { 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 };
            //Console.WriteLine(HeapSorter.IsMaxHeap1(arr1));
            //HeapSorter.BuildMaxHeap(arr1);
            //Console.WriteLine(HeapSorter.IsMaxHeap1(arr1));

            //int[] arr = new int[] { 23, 17, 14, 6, 13, 10, 1, 5, 7, 12 };
            //int[] arr = new int[] { 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 };
            //HeapSorter sorter = new HeapSorter(arr);

            //foreach(int a in arr)
            //    Console.Write(a + " ");
            string str = Console.ReadLine();
            string[] nums = str.Split(new char[] { ' ' });

            Console.WriteLine(NonConfirmator.getPosition(UInt64.Parse(nums[0]), UInt64.Parse(nums[1])));
            Console.ReadLine();
        }
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{F5D71BA1-5FAC-4BFE-BD55-85D7E7B93E19}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>z2</RootNamespace>
    <AssemblyName>z2</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- 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 CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            double n, k;
            string [] input = Console.ReadLine().Split(' ');
            n = Convert.ToInt32(input[0]);
            k = Convert.ToInt32(input[1]);

            //string[] answer = new string[n];

            //for(int i=0; i<=n; i++)
            //{
            //    if(i % 2 == 0)
            //    {
            //        answer[n / 2 + i] = i;
            //    }
            //    else
            //    {

            //    }
            //}

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

            for(int i =1; i <= n; i++)
            {
                if(i % 2 != 0)
                {
                    answer.Add(i.ToString());
                }
            }

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

            Console.WriteLine(answer[k-1]);
            //Console.ReadLine();
        }
    }
}


using System;

public class Program
{
	public static void Main()
	{
		var numbers = Console.ReadLine().ToString().Split();
		var quantity = Convert.ToInt32( numbers[0] );
		var position = Convert.ToInt32( numbers[1] );

		int middle, foundNumber = 0;

		if( quantity % 2 == 0 ){
		    middle = quantity / 2;
		    if( positition <= middle ){
		        foundNumber = 2 * position - 1;
		    }else {
		        foundNumber = (quantity - middle) * 2;
		    }
		}else {
		    middle = ( quantity + 1 ) / 2;
		    if( positition <= middle ){
		        foundNumber = 2 * position - 1;
		    }else {
		        foundNumber = (quantity - middle) * 2;
		    }
		}

	}
}


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)
        {
           long long n = Convert.ToInt64(Console.ReadLine());
           long long k = Convert.ToInt64(Console.ReadLine());
            if(n%2==0)
            {
                if(k<=n/2)
                    Console.WriteLine(k * 2 - 1);
                else
                    Console.WriteLine((k-(n/2))*2);
            }
            else
            {
                if (k <= (n /2)+1)
                    Console.WriteLine(k * 2 - 1);
                else
                    Console.WriteLine((k - ((n /2)+1)) * 2);
            }
            Console.ReadKey();
        }
    }
}


using System;
class Program
    {
        public static void Main(string[] args)
        {
            int a, b;
            {
                string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                a = int.Parse(input[0]);
                b = int.Parse(input[1]);
            }
            {
                int temp;
                List<int> data = new List<int>();
                data.Add(b);
                while (a < b)
                {
                    if ((temp = b % 10) == 1)
                        b = (b -= 1) / 10;
                    else if (temp % 2 == 0)
                        b /= 2;
                    else break;
                    data.Add(b);
                }
                if (a!=b) Console.WriteLine("NO");
                else
                {
                    Console.WriteLine("YES\n{0}", data.Count);
                    for (int i = data.Count - 1; i > 0; --i)
                        Console.Write("{0} ", data[i]);
                    Console.WriteLine(data[0]);
                }
            }
        }
    }


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

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

            int a = ab[0]; int b = ab[1];

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

            while(b > a)
            {
                operations.Add(b);
                if ((b % 2) == 0)
                    b /= 2;
                else if (b.ToString().EndsWith('1'))
                {
                    b = (b - 1) / 10;
                }
                else
                {
                    Console.WriteLine("NO"); return;
                }
            }

            if (b == a)
            {
                Console.WriteLine("YES");
                Console.WriteLine(operations.Count + 1);
                Console.Write(a); Console.Write(' ');
                for (int i = 1; i <= operations.Count; i++)
                {
                    Console.Write(operations[operations.Count-i]); Console.Write(' ');
                }
            }
        }
    }
}


 int a, b;
            string Result = "NO";
            //int[] posled ;
            List<int> posled = new List<int>();
            Console.WriteLine("Введите a");
            a =int.Parse(Console.ReadLine().ToString());
            Console.WriteLine("Введите b");
            b = int.Parse(Console.ReadLine().ToString());
            int tempVar = b;
            while (tempVar > a)
            {
                posled.Add(tempVar);
                if (tempVar % 2 > 0)
                {
                    tempVar = (tempVar - 1) / 10;
                }
                else
                {
                    tempVar = tempVar / 2;
                }

                if (tempVar < 1)
                {
                    Result = "NO";
                    break;
                }
            }
            if (tempVar == a)
            {
                Result = "YES";
            };
            posled.Add(a);

            Console.WriteLine(Result);
            if (Result == "YES")
            {
                Console.WriteLine(posled.Count());
                for (int i = posled.Count() - 1; i >= 0; i--)
                {
                    Console.Write(posled[i] + " ");
                }

            }


using System;
using System.Collections.Generic;
namespace ConsoleTesting
{
    public static class RP
    {
        private static int ParseTime(string time)
        {
            string[] tmp = time.Split(':');
            int seconds = int.Parse(tmp[2]);
            int minutes = int.Parse(tmp[1]);
            int hours = int.Parse(tmp[0]);

            return ((hours * 60 + minutes) * 60) + seconds;
        }

        private static void Parse(string path)
        {
            string[] lines = System.IO.File.ReadAllLines(path);

            int lastInput = 0;
            int total = 0;
            string lastDate = "";
            Dictionary<string, long> perDay = new Dictionary<string, long>();

            foreach (string line in lines)
            {
                string[] tmp = line.Split('\t');
                bool input = (tmp[2].Length == 24);
                bool output = (tmp[2].Length == 25);
                if (!input && !output) continue;

                int time = ParseTime(tmp[1]);

                if (input)
                {
                    lastDate = tmp[0];
                    lastInput = time;
                }

                if (output && lastInput > 0)
                {
                    if(lastDate != tmp[0]) Console.WriteLine("QWE");
                    total += (time - lastInput);
                    Console.WriteLine(tmp[0]);
                    if (!perDay.ContainsKey(tmp[0])) perDay[tmp[0]] = 0;
                    perDay[tmp[0]] += (time - lastInput);

                    lastInput = 0;
                }
            }

            double hours = total;
            hours = hours / 3600;

            Console.WriteLine(hours);
            Console.WriteLine("-------------------------");

            foreach (string day in perDay.Keys)
            {
                Console.WriteLine(day + " = " + (perDay[day] / 3600.0));
            }
        }

        public static void Process()
        {
            Parse(@"d:\Test\Reports\at_june.txt");

            //Console.Write("Aleksey (Report > 114) Prism > ");
            //Parse(@"d:\v-sers\chichagov2.txt");

            //Console.Write("Victor (Report > ???) Prism > ");
            //Parse(@"d:\v-sers\victor.txt");
        }

    }
}


using System;
namespace ConsoleApplication3
{
    class Program
    {
        // FEDCBA9876543210
        // 0010211201010001
        // 543210

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

            if (n == 3)
            {
                result = 27;
            }
            if (n == 2)
            {
                throw new Exception(n);
            }

            Console.WriteLine(result);

            //if (n == 0)
            //{
            //    Console.WriteLine("1");
            //    return;
            //}
            //var r = 0;

            //while (n > 0)
            //{
            //    switch (n % 16)
            //    {
            //        case 0:
            //        case 4:
            //        case 6:
            //        case 9:
            //        case 10:
            //        case 13:
            //            r++;
            //            break;
            //        case 8:
            //        case 11:
            //            r += 2;
            //            break;
            //    }

            //    n /= 16;
            //}
            //Console.WriteLine(r);
        }
    }
}


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

namespace ConsoleApplication1Bagaeva
{
    class Program
    {
        static void Main(string[] args)
        {
            ulong a = ulong.Parse(Console.ReadLine());
            int c=24+a;
            Console.WriteLine(c);
        }
    }
}


    using System;
    using System.Linq;

    namespace CodeWars
    {
        class _263A
        {
            static void Main()
            {
                var input = new int[5][];
                (int, int) position = (default(int),default(int));
                for (int i = 0; i < 5; i++)
                {
                    input[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                    var index = Array.IndexOf(input[i],1);
                    if (index != -1)
                        position = (index, i);
                }
                Console.WriteLine(Math.Abs(2 - position.Item1) + Math.Abs(2 - position.Item2));
            }
        }
    }


for(var r=0;r<5;i++){var items = console.readline().split(' ');
for(var c=0;c<5;c++){
 if(items[c]=="1"){print(Math.abs(2-c) + Math.abs(2-i))
  break;}
}
}


using System;

public class Test {

	int[][] a = new int[5][5];

	public static void Main() {
		int x = 0, y = 0;
		for (int i = 0; i < 5; i++) {
			string[] l = Console.ReadLine().Split();
			for (int j = 0; j < 5; j++) {
				a[i][j] = Convert.ToInt32(l[j]);
				if (a[i][j] == 1) {
					x = i;
					y = j;
				}
			}
		}

		Console.WriteLine(Math.Abs(x - 2) + Math.Abs(y - 2));
	}
}


using System;

namespace App
{
    class Program
    {
        static void Main()
        {
            var strs = new string[5];
            int row = 0, col = 0;
            for (int i = 0; i < 5; i++)
            {
                strs[i] = Console.ReadLine();
                if (strs[i].Contains('1'))
                {
                    row = i+1;
                    col = strs[i].Replace(" ", "").IndexOf("1")+1;
                }
            }
            Console.WriteLine(Math.Abs(3-row) + Math.Abs(3-col));
        }
    }
}


//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)
        {
            //Your code goes here
            var matrix = new int[5,5];
            for(var index = 0; index < 5; index++)
                matrix[index] = Array.ConvertAll(Console.ReadLine().Split(' '), Int);
            int oneRow=0;
            int oneCol=0
            for(var row = 0; row < 5; row++)
            {
                for(var col = 0; col < 5; col++){
                    if(matrix[row,col] == 1)
                    {
                        oneRow = row;
                        oneCol = col;
                    }
                }
            }

            ConsoleWriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


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

namespace HackerRank
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 0, y = 0;
            for (int i = 0; i < 5; i++)
            {
                string line = Console.ReadLine();
                for (int j = 0; j < 10; j += 2)
                    if (line[j] == '1')
                    {
                        x = j / 2;
                        y = i;
                    }
            }0
            Console.WriteLine(Math.Abs(x - 2) + Math.Abs(y - 2));

        }
    }
}


using System;

namespace _263A.BeautifulMatrix
{
    class Program
    {
        static void Main(string[] args)
        {
            string[][] matrix = new string[5][];
            int row = 0;
            int col = 0;

            for(int i = 0; i < 5;i++){
                matrix[i] = Console.ReadLine().Split(' ');

                if(matrix[i].Contains('1')){
                    row = i;

                    for(int j = 0; j < 5;j++){
                        if(matrix[i][j] == '1'){
                            col = j;
                        }
                    }
                }
            }

            Console.WriteLine(Math.Abs(row - 2) + Math.Abs(col - 2));
        }
    }
}


using System;

class Program
{
    static void Main()
    {
        var row = 1;
        var moves = 0;
        while(true)
        {
            var input = Console.ReadLine().Replace(" ", "");
            var col = input.IndexOf("1");
            if (col >= 0)
                {
                    return (3 - row) + (3 - col + 1);
                }
            row++;
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new string[5][];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine().Split(' ');

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                if(matrix[row].IndexOf("1") != -1){
                    oneRow = row;
                    oneCol = col;
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


using System;

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

            int y = -2;
            int x = 10;
            bool set = false;

            for (int i = 0; i < 5; i++)
            {
                if (set)
                {
                    Console.ReadLine();
                                    }
                else
                {

                    string input = Console.ReadLine().Trim();
                    if (input.Contains('1'))
                    {

                        x = input.IndexOf('1')-2;
                        set = true;
                    }
                    else
                    {
                        y++;
                    }

                }
            }

            Console.WriteLine(Math.Abs(x) + Math.Abs(y));
            Console.ReadLine();

        }
    }
}


using System;

namespace _263A_A_Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i=1; i<=5; i++)
            {
                string s1 = Console.ReadLine();
                string[] s1values = s1.Split(' ');

                for (int j=1; j<=5; j++)
                {
                    int x = int.Parse(s1values[j-1]);  [B]// System.FormatException: "Входная строка имела неверный формат."[/B]
                    if (x==1)
                    {
                        Console.Write(Math.Abs(i-3)+ Math.Abs(j - 3));
                    }
                }
            }
        }
    }
}


using System;

namespace CSharpEdu
{
    class ClassCS
    {
        struct point
        {
            public int h;
            public int v;
        }
        static int abs (int x)
        {
            return x > 0 ? x : -x;
        }
        static void Main()
        {
            string s;
            int i, j, tmp;
            bool flag = false;
            point Imlookingfor1;
            for (i = 1; i <= 5; ++i)
            {
                s = Console.ReadLine();
                tmp = 0;
                for (j = 0; j<s.Length; ++j)
                {
                    if (s[j] != 32)
                    {
                        tmp++;
                    }
                    if (s[j] == '1')
                    {
                        Imlookingfor1.h = i;
                        Imlookingfor1.v = tmp;
                        flag = true;
                        break;
                    }
                }
                if (flag) break;
            }
            int res = abs(Imlookingfor1.h - 3) + abs(Imlookingfor1.v - 3);
            Console.Write(res);
            //Console.ReadKey();
        }
    }
}


using System;
using System.Linq;

namespace A._Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            byte rows = 5, columns = 5;
            int[,] matrix = new int[rows, columns];
            int xIndex = 0, yIndex = 0;
            for (int i = 0; i < rows; i++)
            {
                int[] numbers = Console.ReadLine()
                    .Split(" ")
                    .Select(int.Parse)
                    .ToArray();

                for (int j = 0; j < columns; j++)
                {
                    matrix[i, j] = numbers[j];
                    if (numbers[j] == 1)
                    {
                        xIndex = i;
                        yIndex = j;
                    }
                }

            }

            int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);

            Console.WriteLine(numberOfMoves);

        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new string[5][];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine().Split(' ');

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                if(matrix[row].indexOf("1") != -1){
                    oneRow = row;
                    oneCol = col;
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new string[5];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine();

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                var col = matrix[row].IndexOf("1")
                if(col != -1){
                    oneRow = row;
                    oneCol = col;
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


using System;
using System.Linq;

namespace _263A._Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            int[][] matrix = new int[5][];
            int rowIndex = -1;
            int columnIndex = -1;
            int count = 0;

            for (int i = 0; i < 5; i++)
            {
                matrix[i] = Console.ReadLine().Split(" ").Select(Int32.Parse).ToArray();
                if (matrix[i].Contains(1))
                {
                    for (int columns = 0; columns < 5; columns++)
                    {
                        if (matrix[i][columns] == 1)
                        {
                            rowIndex = i;
                            columnIndex = columns;
                        }
                    }
                }
            }

            while (matrix[2][2] != 1)
            {
                if (rowIndex > 2)
                {
                    matrix = swapRow(matrix, -1, rowIndex);
                    rowIndex -= 1;
                    count++;
                }
                else if (rowIndex < 2)
                {
                    matrix = swapRow(matrix, 1, rowIndex);
                    rowIndex += 1;
                    count++;
                }

                if (columnIndex > 2)
                {
                    matrix = swapColumn(matrix, -1,rowIndex,columnIndex);
                    columnIndex += -1;
                    count++;
                }
                else if (columnIndex < 2)
                {
                    matrix = swapColumn(matrix, 1,rowIndex,columnIndex);
                    columnIndex += 1;
                    count++;
                }

            }
            Console.WriteLine(count);
        }
        public static int[][] swapRow(int[][] matrix, int index, int rowIndex)
        {
            int[] temp = matrix[rowIndex];
            matrix[rowIndex] = matrix[rowIndex + index];
            matrix[rowIndex + index] = temp;
            return matrix;
        }

        public static int[][] swapColumn(int[][] matrix, int index,int rowIndex ,int columnIndex)
        {
            matrix[rowIndex][columnIndex + index] = 1;
            matrix[rowIndex][columnIndex] = 0;
            return matrix;
        }
    }
}


using System;
using System.Linq;

namespace A._Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            byte rows = 5, columns = 5;
            int[,] matrix = new int[rows, columns];
            int xIndex = 0, yIndex = 0;
            for (int i = 0; i < rows; i++)
            {
                string[] line = Console.ReadLine().Split(" ");
                int[] numbers = line.Select(int.Parse).ToArray();

                for (int j = 0; j < columns; j++)
                {
                    matrix[i, j] = numbers[j];
                    if (numbers[j] == 1)
                    {
                        xIndex = i;
                        yIndex = j;
                    }
                }

            }

            int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);

            Console.WriteLine(numberOfMoves);

        }
    }
}


using System;
    internal class Program
    {
        private static void Main(string[] args)
        {
            var s = "";
            var y = 0;
            var x = 0;
            for (int i = 0; i < 5; i++)
            {
                s = Console.ReadLine();
                if (s.Contains('1'))
                {
                    x = s.Replace(" ", "").IndexOf('1') + 1;
                    y = i + 1;
                }
            }
            Console.WriteLine(Math.Abs(3 - x) + Math.Abs(3 - y));
        }
    }


using System;
using System.Linq;

namespace A._Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            byte rows = 5, columns = 5;
            int[,] matrix = new int[rows, columns];
            int xIndex = 0, yIndex = 0;
            for (int i = 0; i < rows; i++)
            {
                var line = Console.ReadLine().Split(" ");
                int[] numbers = line.Select(i => Int32.Parse(i)).ToArray();

                for (int j = 0; j < columns; j++)
                {
                    matrix[i, j] = numbers[j];
                    if (numbers[j] == 1)
                    {
                        xIndex = i;
                        yIndex = j;
                    }
                }

            }

            int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);

            Console.WriteLine(numberOfMoves);

        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new string[5];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                if(matrix[row].IndexOf("1") != -1){
                    oneRow = row;
                    oneCol = col;
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


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

namespace W0lf
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 0, y = 0;
            for(int i = 0; i < 5; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                for(int j = 0; j < 5; j++)
                {
                    if(s[j] == '1')
                    {
                        x = int.Parse(s[j]);
                        y = int.Parse(s[i]);
                        f = Math.Abs(3-x)+Math.Abs(3-y);
                    }
                }
            }
            Console.WriteLine(f);
            Console.ReadLine();
        }
    }
}


using System;

namespace BeautifulMatrix
{
    class Program
    {
        static void Main(string[] args)
        {
            char[,] Array = new char [5, 5];
            int count = 0;int rowindex = 0;
            int colindex = 0;

            for (int i=0;i<4;i++)
            {
                rowindex = i;
                string value = Console.ReadLine();
                if(value.Contains('1'))
                {
                    colindex = value.IndexOf('1') / 2 + 1;

                }

            }

          //  Console.WriteLine(2-rowindex/2+1+2-colindex);
            Console.WriteLine(rowindex-2+ colindex-2);

        }
    }
}


using System;

namespace BeautifulMatrix
{
    class Program
    {
        static void Main(string[] args)
        {
            char[,] Array = new char [5, 5];
            int count = 0;int rowindex = 0;
            int colindex = 0;

            for (int i=0;i<4;i++)
            {
                rowindex = i;
                string value = Console.ReadLine();
                if(value.Contains('1'))
                {
                    colindex = value.IndexOf('1') / 2 + 1;

                }

            }

          //  Console.WriteLine(2-rowindex/2+1+2-colindex);
            Console.WriteLine(rowindex/2+1-2+ colindex-2);

        }
    }
}


using System;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;

namespace Codeforces
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            for (var i = 0; i < 5; i++)
            {
                var index = Console.ReadLine().Replace(' ', '').IndexOf('1');
                if (index <= 0) continue;

                Console.WriteLine(Math.Abs(3 - index) + Math.Abs(3 - i));
                return;
            }
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new string[5][];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine().Split(" ");

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                if(matrix[row].indexOf("1") != -1){
                    oneRow = row;
                    oneCol = col;
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            byte[,] matr = new byte[5 , 5];
            int i = 0, j = 0;
            for (i=0;i<5;i++)
            {
                string[] temp = Console.ReadLine().Split(' ');
                for (j=0;j<5;j++)
                {
                    matr[i,j] = Byte.Parse(temp[j]);
                }
            }
            for (i=0;i<5;i++)
            {
                for (j=0;j<5;j++)
                {
                    if (matr[i,j]==1)
                    {
                        goto met;
                    }
                }
            }
            met:
            Console.WriteLine(Math.Abs(i - 2)+Math.Abs(j-2));
        }
    }


using System;
using System.Linq;

namespace A._Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            byte rows = 5, columns = 5;
            int[,] matrix = new int[rows, columns];
            int xIndex = 0, yIndex = 0;
            for (int i = 0; i < rows; i++)
            {
                int[] numbers = Console.ReadLine()
                    .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                    .Select(int.Parse)
                    .ToArray();

                for (int j = 0; j < columns; j++)
                {
                    matrix[i, j] = numbers[j];
                    if (numbers[j] == 1)
                    {
                        xIndex = i;
                        yIndex = j;
                    }
                }

            }

            int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);

            Console.WriteLine(numberOfMoves);

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[][] arr = new int[5][];
            for (int i = 0; i < 5; i++)
                arr[i] = new int[5];

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    arr[i][j] = Convert.ToInt32(Console.ReadLine());
                }
            }

            Console.WriteLine(arr[1][2]);
        }
    }
}


using System;
using System.Linq;

namespace A._Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            byte rows = 5, columns = 5;
            int[,] matrix = new int[rows, columns];
            int xIndex = 0, yIndex = 0;
            for (int i = 0; i < rows; i++)
            {
                var line = Console.ReadLine().Split(" ");
                int[] numbers = line.Select(z => Int32.Parse(z)).ToArray();

                for (int j = 0; j < columns; j++)
                {
                    matrix[i, j] = numbers[j];
                    if (numbers[j] == 1)
                    {
                        xIndex = i;
                        yIndex = j;
                    }
                }

            }

            int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);

            Console.WriteLine(numberOfMoves);

        }
    }
}


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

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

                for (int i = 1; i <= 5; i++)
                {
                    for (int j = 1; j <= 5; j++)
                    {
                      NUmberOne=Console.ReadLine();

                      if (NUmberOne == "1")
                      {
                          Result = Math.Abs(i - 3) + Math.Abs(j - 3);
                          Console.WriteLine(Result.ToString());
                          break;

                      }

                    }
                }

            }
        }

    }


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "beutiful matrix", "beutiful matrix\beutiful matrix.csproj", "{C1C1A884-AD91-4664-A2F2-E829F26D75E0}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{C1C1A884-AD91-4664-A2F2-E829F26D75E0}.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 beutiful_matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = new string[5];
            for (int i = 0; i < 5; i++)
            {
                s[i] = Console.ReadLine().Replace(" ", "");
            }

            int x = 0, y = 0;
            for (int i = 0; i < 5; i++)
                for (int j = 0; j < 5; j++)
                    if (s[i][j] == '1')
                    {
                        x = j; y = i;
                    }

            Console.WriteLine(Math.Abs(x - 2) + Math.Abs(y - 2));
        }
    }
}


 {
        static void Main(string[] args)
        {
            int[,] mas = new int[5, 5];
            int k = 0;
            int b = -1;
            int c = -1;
            for (int i = 0; i < 5; i++)
            {
                string s = Console.ReadLine();
                string[] ss = s.Split(' ');

                for (int j = 0; j < 5; j++)
                {
                    mas[i, j] = Convert.ToInt32(ss[j]);
                    if (mas[i, j] == 1)
                    {
                        b = i;
                        c = j;
                    }
                }
            }

            Console.WriteLine(Math.Abs(2 - b) + Math.Abs(2 - c));

        }
    }
}


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

namespace W0lf
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 0, y = 0;
            for(int i = 0; i < 5; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                for(int j = 0; j < 5; j++)
                {
                    if(s[j] == '1')
                    {
                        x = int.Parse(s[j]);
                        y = int.Parse(s[i]);
                        f = Math.Abs(3-x)+Math.Abs(3-y);
                    }
                }
            }
            Console.WriteLine(f);
            Console.ReadLine();
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new string[5][];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine();

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                if(matrix[row].indexOf("1") !== -1){
                    oneRow = row;
                    oneCol = col;
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


using System;
using System.Linq;

namespace BeautifulMatrix
{
    class Program
    {
        private static int SIZE_MATRIX = 5;
        private static int PERFECT_POSITION;
        private static int[,] Matrix;

        static void Main(string[] args)
        {
            Matrix = new int[SIZE_MATRIX, SIZE_MATRIX];
            int[] temp = new int[SIZE_MATRIX], OriginalPos = new int[2];
            PERFECT_POSITION = (SIZE_MATRIX / 2) - 1;
            int steps = 0;

            for (int i = 0; i < SIZE_MATRIX;i++)
            {
                temp = Array.ConvertAll(Console.ReadLine().Split(" "), x => int.Parse(x));

                for (int j = 0;j < SIZE_MATRIX;j++)
                {
                    Matrix[i, j] = temp[j];

                    if (temp[j] == 1)
                    {
                        OriginalPos[0] = i;
                        OriginalPos[1] = j;
                    }
                }
            }

            for (int i = 0; i < 2;i++)
            {
                while (OriginalPos[i] != 2)
                {
                    if (OriginalPos[i] > 2)
                    {
                        OriginalPos[i]--;
                    }
                    else
                    {
                        OriginalPos[i]++;
                    }
                    steps++;
                }
            }

            Console.WriteLine(steps);

        }
    }
}


using System;

namespace _263A___Beautiful_Matrix
{
	class Program
	{
		static void Main(string[] args)
		{
			Matrixen();
		}

		private static void Matrixen()
		{
			(int, int) coords = GetCoords();
			int steps = Math.Abs(coords.Item1 - 3) + Math.Abs(coords.Item2 - 3);

			Console.WriteLine(steps);
		}

		private static (int, int) GetCoords()
		{
			for (int y = 0; y < 5; y++)
			{
				string[] line = Console.ReadLine().Split(' ');

				for (int x = 0; x < 5; x++)
					if (line[x] == "1")
						return (x, y);
			}

			return (0, 0);
		}
	}
}


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

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

          string[] inputs =
          {
              Console.ReadLine().Replace(" ", ""),
              Console.ReadLine().Replace(" ", ""),
              Console.ReadLine().Replace(" ", ""),
              Console.ReadLine().Replace(" ", ""),
              Console.ReadLine().Replace(" ", ""),
          };
          int a = 1;
          for (int i = 0; i < 5; i++)
          {
              if (inputs[i].Contains("1"))
              {
                  int column = inputs[i].IndexOf("1");
                  a = a + i;
                  Console.WriteLine(Math.Abs(3-a)+Math.Abs(2-column));
                  i = 5;
              }

          }

          Console.ReadLine();

        }
    }
}


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

namespace CF {
    class Program {

        static void Main(string[] args) {

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

            var line1 = reader.ReadLine().Replace(" ","");
            var line2 = reader.ReadLine().Replace(" ","");
            var line3 = reader.ReadLine().Replace(" ","");
            var line4 = reader.ReadLine().Replace(" ","");
            var line5 = reader.ReadLine().Replace(" ","");

            int i = 0;
            int j = 0;
            int ii = 0;

            if ((ii = line1.IndexOf('1')) > 0) {
                i = ii;
                j = 1;
                i++;
            }
            if ((ii = line2.IndexOf('1')) > 0) {
                i = ii;
                j = 2;
                i++;
            }
            if ((ii = line3.IndexOf('1')) > 0) {
                i = ii;
                j = 3;
                i++;
            }
            if ((ii = line4.IndexOf('1')) > 0) {
                i = ii;
                j = 4;
                i++;
            }
            if ((ii = line5.IndexOf('1')) > 0) {
                i = ii;
                j = 5;
                i++;
            }

            Console.WriteLine((Math.Abs(i - 3) + Math.Abs(j - 3)));

ANSW:

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

    }

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

    static class ReaderExtensions {

        public static string ReadToken(this TextReader reader) {
            int val;
            var builder = new StringBuilder();
            while (true) {
                val = reader.Read();
                if (val == ' ' || val == -1) {
                    if (builder.Length == 0) continue;
                    break;
                }
                if (val == 13) {
                    reader.Read();
                    if (builder.Length == 0) continue;
                    break;
                }
                builder.Append((char)val);
            }
            return builder.ToString();
        }

        public static T Read<T>(this TextReader reader) {
            return (T)Convert.ChangeType(reader.ReadToken(), typeof(T));
        }

        public static T[] ReadArr<T>(this TextReader reader) {
            return reader.ReadLine()
                .Split(' ').Select(str =>
                    (T)Convert.ChangeType(str, typeof(T))
                ).ToArray();
        }

    }

    static class LinqExtensions {
        /// <summary>Value / Index</summary>
        public static IEnumerable<Pair<T, int>> SelectIndexes<T>(this IEnumerable<T> collection) {
            return collection.Select((v, i) => new Pair<T, int>(v, i));
        }
        public static IEnumerable<T> SelectValues<T>(this IEnumerable<Pair<T, int>> collection) {
            return collection.Select(p => p.First);
        }
    }

}


using System;

namespace BeautifulMatrix
{
    class Program
    {
        static void Main(string[] args)
        {
            int oneI = 0, oneJ = 0;
            for (int i = 0; i < 5; i++)
            {
                var line = Console.ReadLine().Split(" ");
                for (int j = 0; j < line.Length; j++)
                {
                    if(line[j] == "1")
                    {
                        oneI = i;
                        oneJ = j;
                        break;
                    }
                }
            }

            Console.WriteLine(Math.Abs(2 - oneI) + Math.Abs(2 - oneJ));
        }
    }
}


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

namespace ConsoleApp73
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] mas = new int[5, 5];
            int k = 0;
            int b = -1;
            int c = -1;
            for (int i = 0; i < 5; i++)
            {
                string s = Console.ReadLine();
                string[] ss = s.Split(' ');

                for (int j = 0; j < 5; j++)
                {
                    mas[i, j] = Convert.ToInt32(ss[j]);
                    if (mas[i, j] == 1)
                    {
                        b = i;
                        c = j;
                    }
                }
            }

            Console.WriteLine(Math.Abs(2 - b) + Math.Abs(2 - c));

        }
    }
}


 class Program_8
    {
        public static void Main()
        {
            string [] _arr = new string[5];

            for (int i = 0; i < 5; i++)
            {
                _arr[i] = ReadLine();
            }

            int[,] arr = new int[5,5];

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0 , k=0 ; j < 5 && k < 5 ; k+=2 , j++)
                {
                    arr[i, j] = ToInt32( (_arr[i][k]).ToString() );
                }
            }

            int index_rows = 0 , index_coulmn = 0;
            for (int i = 0; i < 5 ; i++)
            {
                for (int j = 0; j < 5 ; j++)
                {
                    if(arr[i,j]==1)
                    {
                        index_coulmn = j ;
                        index_rows = i ;
                        break;
                    }
                }
            }
        }
        static int count = 0;
        public static void Result(int i, int j)
        {

            if(i==2 && j==2)
            {
                Console.WriteLine(count);
                return;
            }

            else if(i>2||i<2)
            {
                i = (i > 2) ? i - 1 : i + 1;
                count++;
                Result(i,j);
            }

            else if(j>2||j<2)
            {
                j = (j > 2) ? j - 1 : j + 1;
                count++;
                Result(i,j);
            }

        }

    }


    class Program
    {
        static void Main(string[] args)
        {
            int row,column = 0;

            for (row = 1; row <= 5; row++)
            {
                var numbersArray = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

                var index = numbersArray.IndexOf(1);

                if (index != -1)
                {
                    column = index + 1;
                    break;
                }

            }

            Console.WriteLine(Math.Abs(3-row) + Math.Abs(3-column));
        }
    }


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

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

            int[] a = new int[n];

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }
            int max = a[0];
            int indexMax = 0;
            for (int i = 1; i < n; i++)
            {
                if (a[i] < max)
                {
                    max = a[i];
                    indexMax = i;
                }
            }
            Console.WriteLine(indexMax);

            for (int i = 0; i < n; i++)
            {
                Console.Write(a[i] - indexMax + " ");
            }
        }


using System;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int res;
            for (int i = 0; i < 5; i++)
            {
                int[] a = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
                for (int j = 0; j < 5; j++)
                {
                    if (a[j] == 1)
                    {
                        res = Math.Abs(2 - i) + Math.Abs(2 - j);
                        break;
                    }
                }
            }
            Console.WriteLine(res);
        }
    }
}


 using System;
 using System.Console;
 using System.Convert;

 class Program_8
    {
        public static void Main()
        {
            string [] _arr = new string[5];

            for (int i = 0; i < 5; i++)
            {
                _arr[i] = ReadLine();
            }

            int[,] arr = new int[5,5];

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0 , k=0 ; j < 5 && k < 5 ; k+=2 , j++)
                {
                    arr[i, j] = ToInt32( (_arr[i][k]).ToString() );
                }
            }

            int index_rows = 0 , index_coulmn = 0;
            for (int i = 0; i < 5 ; i++)
            {
                for (int j = 0; j < 5 ; j++)
                {
                    if(arr[i,j]==1)
                    {
                        index_coulmn = j ;
                        index_rows = i ;
                        break;
                    }
                }
            }
        }
        static int count = 0;
        public static void Result(int i, int j)
        {

            if(i==2 && j==2)
            {
                Console.WriteLine(count);
                return;
            }

            else if(i>2||i<2)
            {
                i = (i > 2) ? i - 1 : i + 1;
                count++;
                Result(i,j);
            }

            else if(j>2||j<2)
            {
                j = (j > 2) ? j - 1 : j + 1;
                count++;
                Result(i,j);
            }

        }

    }


using System;
using System.Linq;

namespace A._Beautiful_Matrix
{
    class Program
    {
        static void Main(string[] args)
        {
            byte rows = 5, columns = 5;
            int[,] matrix = new int[rows, columns];
            int xIndex = 0, yIndex = 0;
            for (int i = 0; i < rows; i++)
            {
                int[] numbers = Console.ReadLine()
                    .Split(" ", StringSplitOptions.RemoveEmptyEntries)
                    .Select(int.Parse)
                    .ToArray();

                for (int j = 0; j < columns; j++)
                {
                    matrix[i, j] = numbers[j];
                    if (numbers[j] == 1)
                    {
                        xIndex = i;
                        yIndex = j;
                    }
                }

            }

            int numberOfMoves = Math.Abs(2 - xIndex) + Math.Abs(2 - yIndex);

            Console.WriteLine(numberOfMoves);

        }
    }
}


using System;

namespace App
{
    class Program
    {
        static void Main()
        {
            var strs = new string[5];
            int row = 0, col = 0;
            for (int i = 0; i < 5; i++)
            {
                strs[i] = Console.ReadLine();
                if (strs[i].Contains('1'))
                {
                    row = i+1;
                    col = strs[i].Replace(" ", "").IndexOf('1')+1;
                }
            }
            Console.WriteLine(Math.Abs(3-row) + Math.Abs(3-col));
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new char[5][];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine().Split(' ');

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                for(var col = 0; col < 5; col++){
                    if(matrix[row][col] == "1")
                    {
                        oneRow = row;
                        oneCol = col;
                    }
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


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

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

int[] a = new int[n];

for (int i = 0; i < n; i++)
{ a[i] = Convert.ToInt32(s[i]);
}
int max = a[0];
int indexMax = 0;
for (int i = 1; i < n; i++)
{ if (a[i] < max)
{ max=a[i];
indexMax = i;
} }
Console.WriteLine(indexMax);

for (int i=0; i<n; i++)
{
Console.Write(a[i]-indexMax +" ");


[12:05, 09.01.2020] +7 928 068-88-00: 263)using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp73
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] mas = new int[5, 5];
            int k = 0;
            int b = -1;
            int c = -1;
            for (int i = 0; i < 5; i++)
            {
                string s = Console.ReadLine();
                string[] ss = s.Split(' ');

                for (int j = 0; j < 5; j++)
                {
                    mas[i, j] = Convert.ToInt32(ss[j]);
                    if (mas[i, j] == 1)
                    {
                        b = i;
                        c = j;
                    }
                }
            }

            Console.WriteLine(Math.Abs(2 - b) + Math.Abs(2 - c));

        }
    }
}
[12:05, 09.01.2020] +7 928 068-88-00: 617)using System;

namespace ConsoleApp14
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int p = 0, q = 0, r = 0, s = 0, t = 0, u = 0;
            p = n / 5;
            q = n % 5;
            if (q % 4 == 0)
            {
                r = q / 4;
            }
            else if (q % 3 == 0)
            {
                s = q / 3;
            }
            else if (q % 2 == 0)
            {
                t = q / 2;
            }
            else if (q % 1 == 0)
            {
                u = q / 1;
            }
            Console.WriteLine(p + r + s + t + u);
        }
    }
}
[12:05, 09.01.2020] +7 928 068-88-00: 217)using System;

class Exercise11
{
    static void Main()
    {
        int y = Convert.ToInt32(Console.ReadLine());
        int a, b, c, d;
        while (true)
        {
            y = y + 1;
            a = y / 1000;
            b = y / 100 % 10;
            c = y / 10 % 10;
            d = y % 10;
            if (a != b && a != c && a != d && b != c && b != d && c != d)
            {
                break;
            }
        }
         Console.WriteLine(y);
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
            var matrix = new char[5][];
            for(var index = 0; index < 5; index++)
                matrix[index] = Console.ReadLine().Split(' ');

            int oneRow=0;
            int oneCol=0;
            for(var row = 0; row < 5; row++)
            {
                for(var col = 0; col < 5; col++){
                    if(matrix[row][col] == '1')
                    {
                        oneRow = row;
                        oneCol = col;
                    }
                }
            }

            Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));
        }
    }
}


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


<?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>{4FF9A221-BF93-4E52-87F2-DF2B3113D292}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>vsaya_i_noski</RootNamespace>
    <AssemblyName>vsaya i noski</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</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>


int howSocks(int n,int m)
{
int tmp=n/m;
if(tmp<m)
return n+tmp;
else
return n+howSocks(tmp,m);
}
int main()
{
var a = System.Console.ReadLine().Split(' ').Select(x =>         System.Convert.ToInt32(x)).ToArray();
System.Console.WriteLine(howSocks(a[0],a[1]));
return 0;
}


public class Oleg
{
	public static void Main()
	{
		var input = System.Console.ReadLine().Split(null as char[]);
		long a, b;
		a = int.Parse(input[0]);
		b = int.Parse(input[1]);

		while(a != 0 && b != 0)
		{
			if (a >= 2*b)
			{
				a -= 2*b;
				continue;
			}
			else if(b >= 2*a)
			{
				b -= 2*a;
				continue;
			}
			else
			{
				break;
			}
		}

		Console.WriteLine(a + " " + b);
	}
}


#include <stdio.h>
void main()
{
    int n, m, moves;
    scanf("%d %d", &n , &m);

    if(m <=n)
    {
    moves = (n % 2) + (n / 2);
        while(moves % m != 0)
            moves++;

    printf("%d", moves);
    }
    else
        printf("-1");
}


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

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

            string Input1;
            Input1 = Console.ReadLine();
            string[] split = Input1.Split(' ');
            int n, m, output=0;
            n = Convert.ToInt32(split[0]);
            m = Convert.ToInt32(split[1]);
            double x=0;

                if (m > n) {
                    Console.WriteLine("-1");
                }
                else
                {
                  x= m*2;
                  x=n/m;
                  x=Math.Ceiling(x);
                  Console.writeLine(x);
                }

        }

    }
}


/*

 */
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;

public class Solver
{
    public void Solve()
    {
        bool ismagic(string s)
        {
            int i = 0;
            while (i < s.Length)
            {
                if (s[i] != '1')
                    return false;
                int j = i + 1;
                while (j < s.Length && s[j] == '4' && j - i <= 2)
                    j++;
                i = j;
            }
            return true;
        }
        Write(ismagic(ReadToken()) ? "YES" : "NO");
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
        Debug.Listeners.Clear();
        Debug.Listeners.Add(new ConsoleTraceListener());
        Trace.Listeners.Clear();
        Trace.Listeners.Add(new ConsoleTraceListener());

        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        new Solver().Solve();
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


var incomeString = Read<string>();
            List<string> magicNumbers = new List<string>() {"144", "14", "1"};
            string temp = incomeString;
            while (temp.Contains(magicNumbers[0]) ||
                temp.Contains(magicNumbers[1]) ||
                temp.Contains(magicNumbers[2]))
            {
                for (int i = 0; i < magicNumbers.Count; i++)
                {
                    if (temp.Contains(magicNumbers[i]))
                    {
                        temp = temp.Replace(magicNumbers[i], "");
                    }
                }
            }
            if (string.IsNullOrEmpty(temp))
            {
                Console.Write("YES");
                return;
            }
            Console.Write("NO");


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

namespace Интернет_адрес
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            s = Console.ReadLine();
            if (s[0] == 'f')
                s = s.Insert(3, "://");
            if (s[0] == 'h')
                s = s.Insert(4, "://");
            s = s.Insert(s.IndexOf("ru"), ".");
            if(s[s.LastIndexOf("ru") + 1].CompareTo(' ') != 0)
            {
                s = s.Insert(s.IndexOf("ru") + 2, "/");
            }
            Console.WriteLine(s);
        }
    }
}