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

namespace CodeForce
{
    public class Program
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            Console.WriteLine(Solve(input1));
        }

        /*
            Luba And The Ticket
            time limit per test2 seconds
            memory limit per test256 megabytes
            inputstandard input
            outputstandard output
            Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.

            The ticket is considered lucky if the sum of first three digits equals to the sum of last three digits.

            Input
            You are given a string consisting of 6 characters (all characters are digits from 0 to 9) — this string denotes Luba's ticket. The ticket can start with the digit 0.

            Output
            Print one number — the minimum possible number of digits Luba needs to replace to make the ticket lucky.
         */
        public static int Solve(string input1)
        {
            var firstTree = input1.Substring(0, 3).Select(c => int.Parse(c.ToString()));
            var lastTree = input1.Substring(3).Select(c => int.Parse(c.ToString()));

            return InnerSolve(firstTree, lastTree, 0);
        }

        private static int InnerSolve(
            IEnumerable<int> firstTree,
            IEnumerable<int> lastTree,
            int count)
        {
            var firstSum = firstTree.Sum();
            var lastSum = lastTree.Sum();
            if (firstSum == lastSum) return count;

            //updating the first tree
            var firstBranchCount = 0;
            if (firstSum > lastSum) // need to decrement the greatest
            {
                var list = firstTree.ToList();
                list.Sort((a, b) => b - a);
                var original = list.First();
                var difference = firstSum - lastSum;
                var decremented = original > difference ?
                    original - difference :
                    0;
                firstBranchCount = InnerSolve(
                    list.Skip(1).Append(decremented),
                    lastTree,
                    count + 1);
            }
            else //need to increment
            {
                var list = firstTree.ToList();
                list.Sort();
                var original = list.First();
                var difference = lastSum - firstSum;
                var incremented = difference >= 9 ?
                    9 :
                    (difference - original) + original;
                firstBranchCount = InnerSolve(
                    list.Skip(1).Append(incremented),
                    lastTree,
                    count + 1);
            }

            //updating the last tree
            var lastBranchCount = InnerSolve(lastTree, firstTree, count + 1);

            return firstBranchCount > lastBranchCount ? lastBranchCount : firstBranchCount;
        }
    }
}


using System; using System.Linq;

class P {
  static void Main() {
    var dx = 1; var dy = 0;
    var d = 2;
    var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var x = 0 var y = 0;
    var xn = x + dx * (d / 2); var yn = y + dy * (d / 2);
    while (((x != s[0] || (y-s[1])*(yn-s[1]) > 0)) &&
           ((y != s[1] || (x-s[0])*(xn-s[0]) > 0))) {
      d++;
      x = xn; y = yn;
      xn = x + dx * (d / 2); yn = y + dy * (d / 2);
    }
    Console.WriteLine(d - 2);
  }
}


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

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

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

            int xCoordinate = Int32.Parse(input[0]);
            int yCoordinate = Int32.Parse(input[1]);
            //int turnsCOmpleted = 0;
            int turnsTaken = 0;
            if ((xCoordinate == 0 && yCoordinate == 0) || (xCoordinate == 1 && yCoordinate == 0)){
		Console.WriteLine(0);
		break;
}

            else
            {
                int currentXCoor = 0;
                int currentYCoor = 0;
                int previousXCoor = 1;
                int previousYCoor = 0;
                int quadrant = 1;

                for (int i = 0; i < int.MaxValue; i++)
                {
                    //int y = 0;
                    //int x = 0;
                    if (quadrant == 1)
                    {
                        currentXCoor = previousXCoor;
                        currentYCoor = previousYCoor + 1 +(2*(-previousYCoor));
                        turnsTaken += 1;
                        if(xCoordinate == currentXCoor)
                        {
                            if (yCoordinate >= previousYCoor && yCoordinate <= currentYCoor)
                                break;

                        }

                    }
                    //continue;
                    else if (quadrant == 2)
                    {
                        currentXCoor = -previousXCoor;
                        currentYCoor = previousYCoor;
                        turnsTaken += 1;
                        if(yCoordinate == currentYCoor)
                        {
                            if (xCoordinate <= previousXCoor && xCoordinate >= currentXCoor)
                                break;
                        }

                        //c//ontinue;
                    }
                    else if (quadrant == 3)
                    {
                        currentXCoor = previousXCoor;
                        currentYCoor = -previousYCoor;
                        turnsTaken += 1;
                        if(xCoordinate == currentXCoor)
                        {
                            if (yCoordinate >= currentYCoor && yCoordinate <= previousYCoor)
                                break;
                        }

                    }

                    else if(quadrant == 4)
                    {
                        currentXCoor = -previousXCoor+1;
                        currentYCoor = previousYCoor;
                        turnsTaken += 1;
                        if(yCoordinate == currentYCoor)
                        {
                            if (xCoordinate >= previousXCoor && xCoordinate <= currentXCoor)
                                break;
                        }

                    }
                    previousXCoor = currentXCoor;
                    previousYCoor = currentYCoor;
                    if (quadrant == 4)
                        quadrant = 1;
                    else
                        quadrant += 1;

                }
            }
            Console.WriteLine(turnsTaken);
        }

    }


<?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>{6E004330-966A-4BED-B095-733EFEF1E9A3}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>A</RootNamespace>
    <AssemblyName>A</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>
  <ItemGroup>
    <Content Include="input.txt" />
  </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.Runtime.InteropServices;
using System.Text.RegularExpressions;

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

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

            int xCoordinate = Int32.Parse(input[0]);
            int yCoordinate = Int32.Parse(input[1]);
            //int turnsCOmpleted = 0;
            int turnsTaken = 0;
            if ((xCoordinate == 0 && yCoordinate == 0) || (xCoordinate == 1 && yCoordinate == 0)){
		Console.WriteLine(0);
		Break;
}

            else
            {
                int currentXCoor = 0;
                int currentYCoor = 0;
                int previousXCoor = 1;
                int previousYCoor = 0;
                int quadrant = 1;

                for (int i = 0; i < int.MaxValue; i++)
                {
                    //int y = 0;
                    //int x = 0;
                    if (quadrant == 1)
                    {
                        currentXCoor = previousXCoor;
                        currentYCoor = previousYCoor + 1 +(2*(-previousYCoor));
                        turnsTaken += 1;
                        if(xCoordinate == currentXCoor)
                        {
                            if (yCoordinate >= previousYCoor && yCoordinate <= currentYCoor)
                                break;

                        }

                    }
                    //continue;
                    else if (quadrant == 2)
                    {
                        currentXCoor = -previousXCoor;
                        currentYCoor = previousYCoor;
                        turnsTaken += 1;
                        if(yCoordinate == currentYCoor)
                        {
                            if (xCoordinate <= previousXCoor && xCoordinate >= currentXCoor)
                                break;
                        }

                        //c//ontinue;
                    }
                    else if (quadrant == 3)
                    {
                        currentXCoor = previousXCoor;
                        currentYCoor = -previousYCoor;
                        turnsTaken += 1;
                        if(xCoordinate == currentXCoor)
                        {
                            if (yCoordinate >= currentYCoor && yCoordinate <= previousYCoor)
                                break;
                        }

                    }

                    else if(quadrant == 4)
                    {
                        currentXCoor = -previousXCoor+1;
                        currentYCoor = previousYCoor;
                        turnsTaken += 1;
                        if(yCoordinate == currentYCoor)
                        {
                            if (xCoordinate >= previousXCoor && xCoordinate <= currentXCoor)
                                break;
                        }

                    }
                    previousXCoor = currentXCoor;
                    previousYCoor = currentYCoor;
                    if (quadrant == 4)
                        quadrant = 1;
                    else
                        quadrant += 1;

                }
            }
            Console.WriteLine(turnsTaken);
        }

    }


#region Using Statements
using GenericArithmetic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CommentRemover;

#endregion
namespace csConsoleforStudy
{
 using System.Collections.Generic;
 using System.Globalization;

 class Program
 {
  static readonly Encoding TargetEcoding = Encoding.Unicode;
  static void Main(string[] args)
  {
   OpenStream();
   Solver s = new Solver();
   s.Solve();
   CloseStream();
  }

  static void OpenStream()
  {
  }

  static void CloseStream()
  {
  }

  static void CheckMemory()
  {
  }
 }

 class Solver
 {
  public static readonly Encoding TargetEncoding = Encoding.Unicode;
  const int SIZE = 5005;
  private const double AbsoluteError = 1e-10;
  private const double RelativeError = 1e-8;
  static int mod = 1000000007;
  public void Solve()
  {
   string s1 = rs();
   string s2 = rs();
   int target = 0;
   int pos = 0;
   int que = 0;
   double result = 0f;
   for (int i = 0; i < s1.Length; i++)
   {
    if (s1[i] == '+')
     target++;
    else
     target--;
   }

   for (int i = 0; i < s2.Length; i++)
   {
    if (s2[i] == '+')
     pos++;
    else if (s2[i] == '-')
     pos--;
    else
    {
     que++;
    }
   }

   if (que % 2 == 0)
   {
    if ((target - pos) % 2 == 0)
    {
     int d = target - pos;
     d = Math.Abs(d);
     int plus = d;
     int minus = 0;
     for (int i = 0;; i++)
     {
      if (plus + minus == que)
       break;
      plus++;
      minus++;
     }

     result = (double)C(que, plus) / Math.Pow(2, que);
    }
    else
     result = 0f;
   }
   else
   {
    if ((target - pos) % 2 == 1)
    {
     int d = target - pos;
     d = Math.Abs(d);
     int plus = d;
     int minus = 0;
     for (int i = 0;; i++)
     {
      if (plus + minus == que)
       break;
      plus++;
      minus++;
     }

     result = (double)C(que, plus) / Math.Pow(2, que);
    }
    else
     result = 0f;
   }

   string ans = result.ToString("F10", CultureInfo.InvariantCulture);
   Console.Write(ans);
  }

#region SolverUtils
  private static List<int> factorial = new List<int>(new int[]{1});
  private static int NextInt()
  {
   int c;
   int res = 0;
   do
   {
    c = Console.Read();
    if (c == -1)
     return res;
   }
   while (c < '0' || c > '9');
   res = c - '0';
   while (true)
   {
    c = Console.Read();
    if (c < '0' || c > '9')
     return res;
    res *= 10;
    res += c - '0';
   }
  }

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

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

  static uint rui()
  {
   return uint.Parse(Console.ReadLine());
  }

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

  static ulong rul()
  {
   return ulong.Parse(Console.ReadLine());
  }

  static double rd()
  {
   return double.Parse(Console.ReadLine());
  }

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

  static int[] ria()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));
  }

  static uint[] ruia()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => uint.Parse(e));
  }

  static long[] rla()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));
  }

  static ulong[] rula()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => ulong.Parse(e));
  }

  static double[] rda()
  {
   return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));
  }

  static void ReadLineAndAssign(string type, params object[] p)
  {
   dynamic input;
   if (type.StartsWith("i"))
    input = ria();
   else if (type.StartsWith("l"))
    input = rla();
   else if (type.StartsWith("d"))
    input = rda();
   else
    throw new ArgumentException("no match " + type.ToString());
   for (int i = 0; i < p.Length; i++)
   {
    p[i] = input[i];
   }
  }

  static void SwapIfGreater<T>(ref T lhs, ref T rhs)where T : IComparable<T>
  {
   T temp;
   if (lhs.CompareTo(rhs) > 0)
   {
    temp = lhs;
    lhs = rhs;
    rhs = temp;
   }
  }

  static bool DoubleEqual(double a, double b)
  {
   double diff = Math.Abs(a - b);
   if (diff < AbsoluteError)
    return true;
   return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));
  }

  static dynamic abs(dynamic num)
  {
   return Math.Abs(num);
  }

  static dynamic max(dynamic a, dynamic b)
  {
   return Math.Max(a, b);
  }

  static void For(int start, int end, Action method)
  {
   for (int i = start; i < end; i++)
   {
    method.Invoke();
   }
  }

  static void For(int start, int end, Action<int> method, int i)
  {
   for (i = start; i < end; i++)
   {
    method.DynamicInvoke(i);
   }
  }

  static int C(int n, int k)
  {
   return P(n, k) / Factorial(n);
  }

  static int P(int n, int r)
  {
   return Factorial(n) / Factorial(n - r);
  }

  static int Factorial(int n)
  {
   if (factorial.Count <= n)
    factorial.Add(Factorial(n - 1) * n);
   return factorial[n];
  }

  static int powmod(int a, int b)
  {
   if (b == 0)
    return 1;
   if (b == 1)
    return a;
   int i = powmod(a, b / 2);
   i *= i;
   i %= mod;
   if (b % 2 == 0)
    return i;
   else
    return ((i * a) % mod);
  }
#endregion
 }
#region SolverUtils
#endregion
#region Data Structure
#endregion
#region Algorithm
#endregion
#region Library Method/Fields
#region Members for Internal Support
#endregion Members for Internal Support
#region Public Properties
#endregion Public Properties
#region Public Instance Methods
#endregion Public Instance Methods
#region Constructors
#endregion Constructors
#region Public Static Methods
#endregion Public Static Methods
#region Operator Overloads
#endregion Operator Overloads
#region explicit conversions from BigRational
#endregion explicit conversions from BigRational
#region implicit conversions to BigRational
#endregion implicit conversions to BigRational
#region serialization
#endregion serialization
#region instance helper methods
#endregion instance helper methods
#region static helper methods
#endregion static helper methods
#region Exceptions
#endregion
#endregion
}

#region Libraries
namespace GenericArithmetic
{
 public class Vector<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public T X
  {
   get;
   set;
  }

  public T Y
  {
   get;
   set;
  }

  public Vector(T x, T y)
  {
   X = x;
   Y = y;
  }

  public override bool Equals(object obj)
  {
   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Vector<T> a, Vector<T> b)
  {
   return EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y);
  }

  public static bool operator !=(Vector<T> a, Vector<T> b)
  {
   return !(EqualityComparer<T>.Default.Equals(a.X, b.X) && EqualityComparer<T>.Default.Equals(a.Y, b.Y));
  }

  public static Vector<T> operator !(Vector<T> a)
  {
   return new Vector<T>(Calculator.Difference(new Number<T>(default (T)), a.X), Calculator.Difference(new Number<T>(default (T)), a.Y));
  }

  public static Vector<T> operator +(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));
  }

  public static Vector<T> operator -(Vector<T> a, Vector<T> b)
  {
   return new Vector<T>(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));
  }
 }

 public class Matrix<T>
 {
  public static readonly ICalculator<T> Calculator = Number<T>.Calculator;
  public int W
  {
   get;
   set;
  }

  public int H
  {
   get;
   set;
  }

  public int rows
  {
   get
   {
    return H;
   }

   set
   {
    H = value;
   }
  }

  public int cols
  {
   get
   {
    return W;
   }

   set
   {
    W = value;
   }
  }

  public T[, ] Map
  {
   get;
   set;
  }

  public T this[int x, int y]
  {
   get
   {
    return Map[x, y];
   }

   set
   {
    Map[x, y] = value;
   }
  }

  public Matrix(T[, ] map)
  {
   Map = map;
   W = map.GetLength(0);
   H = map.GetLength(1);
  }

  public Matrix(int w, int h, T defaultValue = default (T))
  {
   W = w;
   H = h;
   Map = new T[W, H];
  }

  public override bool Equals(object obj)
  {
   if (obj is Matrix<T>)
   {
    return this == (Matrix<T>)obj;
   }

   return base.Equals(obj);
  }

  public override int GetHashCode()
  {
   return base.GetHashCode();
  }

  public static bool operator ==(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return ret;
  }

  public static bool operator !=(Matrix<T> a, Matrix<T> b)
  {
   bool ret = true;
   if (a.Map != b.Map)
    ret = false;
   else if (a.W != b.W)
    ret = false;
   else if (a.H != b.H)
    ret = false;
   return !ret;
  }

  public static Matrix<T> operator +(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator -(Matrix<T> a, Matrix<T> b)
  {
   if (a.W != b.W)
    return null;
   else if (a.H != b.H)
    return null;
   else
   {
    Matrix<T> ret = new Matrix<T>(a.W, a.H);
    for (int i = 0; i < a.W; i++)
    {
     for (int j = 0; j < a.H; j++)
     {
      ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);
     }
    }

    return ret;
   }
  }

  public static Matrix<T> operator *(Matrix<T> a, Matrix<T> b)
  {
   if (a.cols != b.rows)
    throw new FormatException("Cannot multiply : a.W = " + a.W.ToString() + " with b.H = " + b.H.ToString());
   else
   {
    Matrix<T> R = new Matrix<T>(a.rows, b.cols);
    for (int i = 0; i < R.rows; i++)
     for (int j = 0; j < R.cols; j++)
      for (int k = 0; k < a.cols; k++)
      {
       R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));
      }

    return R;
   }
  }
 }

 public static class Calculator
 {
  public static T Sum<T>(T a, T b)
  {
   return Number<T>.Sum(a, b);
  }
 }

 public interface ICalculator<T>
 {
  T Sum(T a, T b);
  T Difference(T a, T b);
  int Compare(T a, T b);
  T Multiply(T a, T b);
  T Divide(T a, T b);
  T Divide(T a, int b);
 }

 struct Int32Calculator : ICalculator<Int32>
 {
  public Int32 Sum(Int32 a, Int32 b)
  {
   return a + b;
  }

  public Int32 Difference(Int32 a, Int32 b)
  {
   return a - b;
  }

  public int Compare(Int32 a, Int32 b)
  {
   return Difference(a, b);
  }

  public int Multiply(Int32 a, Int32 b)
  {
   return a * b;
  }

  public int Divide(Int32 a, Int32 b)
  {
   return a / b;
  }
 }

 struct Int64Calculator : ICalculator<Int64>
 {
  public Int64 Sum(Int64 a, Int64 b)
  {
   return a + b;
  }

  public Int64 Difference(Int64 a, Int64 b)
  {
   return a - b;
  }

  public int Compare(Int64 a, Int64 b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Int64 Multiply(Int64 a, Int64 b)
  {
   return a * b;
  }

  public Int64 Divide(Int64 a, Int64 b)
  {
   return a / b;
  }

  public Int64 Divide(Int64 a, int b)
  {
   return a / b;
  }
 }

 struct SingleCalculator : ICalculator<Single>
 {
  public Single Sum(Single a, Single b)
  {
   return a + b;
  }

  public Single Difference(Single a, Single b)
  {
   return a - b;
  }

  public int Compare(Single a, Single b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public Single Multiply(Single a, Single b)
  {
   return a * b;
  }

  public Single Divide(Single a, Single b)
  {
   return a / b;
  }

  public Single Divide(Single a, int b)
  {
   return a / b;
  }
 }

 struct DoubleCalculator : ICalculator<double>
 {
  public double Sum(double a, double b)
  {
   return a + b;
  }

  public double Difference(double a, double b)
  {
   return a - b;
  }

  public int Compare(double a, double b)
  {
   if (a > b)
   {
    return 1;
   }
   else if (a < b)
   {
    return -1;
   }
   else
   {
    return 0;
   }
  }

  public double Multiply(double a, double b)
  {
   return a * b;
  }

  public Double Divide(Double a, Double b)
  {
   return a / b;
  }

  public Double Divide(Double a, int b)
  {
   return a / b;
  }
 }

 struct StringCalculator : ICalculator<string>
 {
  public string Sum(string a, string b)
  {
   return a + b;
  }

  public string Difference(string a, string b)
  {
   if (b.Length < a.Length)
   {
    return a.Substring(0, b.Length);
   }
   else
   {
    return "";
   }
  }

  public int Compare(string a, string b)
  {
   return a.CompareTo(b);
  }

  public string Multiply(string a, string b)
  {
   if (a.Length == 1 && b.Length == 1)
   {
    return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + "";
   }

   int bigLength = Math.Max(a.Length, b.Length);
   while (a.Length < bigLength)
   {
    a = " " + a;
   }

   while (b.Length < bigLength)
   {
    b = " " + b;
   }

   string result = "";
   for (int i = 0; i < bigLength; i++)
   {
    Number<string> numA = a[i] + "";
    Number<string> numB = b[i] + "";
    result += numA * numB;
   }

   return result;
  }

  public String Divide(String a, String b)
  {
   return String.Format("{0} / {1}", a, b);
  }

  public String Divide(String a, int b)
  {
   return String.Format("{0} / {1}", a, b);
  }
 }

 public class Number<T>
 {
  private T value;
  public Number(T value)
  {
   this.value = value;
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

  public static Type GetCalculatorType()
  {
   Type tType = typeof (T);
   Type calculatorType = null;
   if (tType == typeof (Int32))
   {
    calculatorType = typeof (Int32Calculator);
   }
   else if (tType == typeof (Int64))
   {
    calculatorType = typeof (Int64Calculator);
   }
   else if (tType == typeof (Double))
   {
    calculatorType = typeof (DoubleCalculator);
   }
   else if (tType == typeof (string))
   {
    calculatorType = typeof (StringCalculator);
   }
   else
   {
    throw new InvalidCastException(String.Format("Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator<T> and cannot be used in generic arithmetic using type Number<T>", tType.Name));
   }

   return calculatorType;
  }

  private static ICalculator<T> fCalculator = null;
  public static ICalculator<T> Calculator
  {
   get
   {
    if (fCalculator == null)
    {
     MakeCalculator();
    }

    return fCalculator;
   }
  }

  public static void MakeCalculator()
  {
   Type calculatorType = GetCalculatorType();
   fCalculator = Activator.CreateInstance(calculatorType) as ICalculator<T>;
  }

#region operation methods
  public static T Sum(T a, T b)
  {
   return Calculator.Sum(a, b);
  }

  public static T Difference(T a, T b)
  {
   return Calculator.Difference(a, b);
  }

  public static int Compare(T a, T b)
  {
   return Calculator.Compare(a, b);
  }

  public static T Multiply(T a, T b)
  {
   return Calculator.Multiply(a, b);
  }

  public static T Divide(T a, T b)
  {
   return Calculator.Divide(a, b);
  }

  public static T Divide(T a, int b)
  {
   return Calculator.Divide(a, b);
  }

#endregion
#region Operators
  public static implicit operator Number<T>(T a)
  {
   return new Number<T>(a);
  }

  public static implicit operator T(Number<T> a)
  {
   return a.value;
  }

  public static Number<T> operator +(Number<T> a, Number<T> b)
  {
   return Calculator.Sum(a.value, b.value);
  }

  public static Number<T> operator -(Number<T> a, Number<T> b)
  {
   return Calculator.Difference(a, b);
  }

  public static bool operator>(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) > 0;
  }

  public static bool operator <(Number<T> a, Number<T> b)
  {
   return Calculator.Compare(a, b) < 0;
  }

  public static Number<T> operator *(Number<T> a, Number<T> b)
  {
   return Calculator.Multiply(a, b);
  }

  public static Number<T> operator /(Number<T> a, Number<T> b)
  {
   return Calculator.Divide(a, b);
  }

  public static Number<T> operator /(Number<T> a, int b)
  {
   return Calculator.Divide(a, b);
  }
#endregion
 }
}
#region DataStructures
#region IComparable implementation
#endregion
#region Model
#endregion
#region Constructors
#endregion
#region Internal
#region IEqualityComparer implementation
#endregion
#endregion
#region IGraph implementation
#endregion
#region Clique invariants
#endregion
#region Clique methods
#endregion
#region IEquatable implementation
#endregion
#endregion
#region Algorithms
#endregion
#endregion


using System;

namespace ConsoleApp1
{
    class Program
    {
		public static string drazil ="";
		public static string dreamoon="";

		public static char[] s1 = new char[drazil.ToCharArray().Length];
		public static char[] s2 = new char[dreamoon.ToCharArray().Length];

		public static int tamanhoS1, tamanhoS2;
		public static int unidade = 0, prob = 0, soma = 0;
		public static void probabilidade(int n, int posicao)
		{

			if (n == tamanhoS2)
			{
				if (posicao == unidade)
					prob++;
				soma++;
				return;
			}
			if (s2[n] == '+')
			{
				probabilidade(n + 1, posicao + 1);
			}
			else if (s2[n] == '-')
			{
				probabilidade(n + 1, posicao - 1);
			}
			else if (s2[n] == '?')
			{
				probabilidade(n + 1, posicao + 1);
				probabilidade(n + 1, posicao - 1);
			}
		}
		static double Main(string[] args)
        {
			drazil = Console.ReadLine();
			dreamoon = Console.ReadLine();

			s1 = drazil.ToCharArray();
			s2 = dreamoon.ToCharArray();

			tamanhoS1 = s1.Length;
			tamanhoS2 = s2.Length;

			for (int i = 0; i < tamanhoS1; i++)
            {
				if (s1[i] == '+')
					unidade++;
				else
					unidade--;
			}

			probabilidade(0, 0);

			double result = (double)(prob) / (soma);

			return result;
		}
	}
}


using System;
using System.Text;
using System.Collections;
using System.IO;
using System.Numerics;
namespace pr
{
    class Program
    {
        public static void Main(string[] args)
        {   int[,] mas= new int[4,4];
            for (int i=0;i<4;i++){
            string line=Console.ReadLine();
            for(int j=0;j<4;j++){if(line[j]=='.'){mas[i,j]=0;}else {mas[i,j]=1;}}
            }
            int s,res=0;
            for (int i=0;i<3;i++){
                s=0;
                for(int j=0;j<3;j++){
                    s=mas[i,j]+=mas[i+1,j]+=mas[i,j+1]+=mas[i+1,j+1];
                    if ((s==0)||(s==1)||(s==3)||(s==4)) {res++;}
                }
            }
            if(res>0){Console.WriteLine("YES");}else {Console.WriteLine("NO");}
            //Console.WriteLine();
            //Console.ReadKey(true);
        }
    }
}


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = new string[4];
            bool f = false;
            for (int i = 0; i < 4; i++)
            {
                str[i] = Console.ReadLine();
            }
            for (int i = 1; i < 3; i++)
            {

                bool g = false;
                for (int j = 1; j < 3; j++)
                {
            int sharp = 0;
                int dot = 0;
                    if (str[i][j] == '#')
                    {
                        sharp++;
                    }
                    else
                    {
                        dot++;
                    }
                    if (str[i - 1][j] == '#')
                    {
                        sharp++;
                    }
                    else
                    {
                        dot++;
                    }
                    if (str[i - 1][j - 1] == '#')
                    {
                        sharp++;
                    }
                    else
                    {
                        dot++;
                    }
                    if (str[i][j - 1] == '#')
                    {
                        sharp++;
                    }
                    else
                    {
                        dot++;
                    }
                    if (sharp == 4 || sharp == 3)
                    {
                        Console.WriteLine("YES");
                        g = true;
                        f = true;
                        break;
                    }
                    if (dot == 4 || dot == 3)
                    {
                        Console.WriteLine("YES");
                        g = true;
                        f = true;
                        break;
                    }
                }
                if (g)
                {
                    break;
                }
            }
            if (!f)
            {
                Console.WriteLine("NO");
            }
            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>{2A47F7D6-541E-481D-B886-5ACB1620473D}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ConsoleApplication1</RootNamespace>
    <AssemblyName>ConsoleApplication1</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>


namespace ConsoleApplication1
{
    class Program
    {
        public static Boolean test(char[,] inp, int i, int j)
        {
            if (i + 1 == 4 || j + 1 == 4) return false;
            if (inp[i, j] == inp[i + 1, j] && inp[i, j] == inp[i + 1, j + 1] && inp[i, j] == inp[i, j + 1]) return true;
            return false;
        }

        public static Boolean chtest(char[,] inp)
        {
            char original;
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 4; j++)
                {
                    original = inp[i, j];
                    if (inp[i, j] == '.') { inp[i, j] = '#'; }
                    else inp[i, j] = '.';
                    if (test(inp, i, j)) return true;
                }
            return false;
        }

        public static void final(char[,] inp)
        {
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 4; j++)
                {
                    if (test(inp, i, j))
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }
            if (chtest(inp)) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
        static void Main(string[] args)
        {
            char[,] inp = new char[4, 4];
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 4; j++)
                { inp[i, j] = Convert.ToChar(Console.ReadLine()); }
            final(inp);
        }
    }
}


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

namespace IQ_тест
{
    class Program
    {
        static void Main(string[] args)
        {
            int size=4;
            size = size + 2;
            char[,] mas = new char [size,size];
            for (int i = 0; i < size-2; i++)
                for (int j = 0; j < size; j++)
                    mas[i, j] = Convert.ToChar(Console.Read());
            size = size - 2;
            bool flag = false; ;
            int count=0;
            for(int i=0;i<size-1;i++)
                for(int j=0;j<size-1;j++)
                {
                    if(mas[i,j]==mas[i+1,j])
                        count++;
                    if(mas[i,j]==mas[i,j+1])
                        count++;
                    if (mas[i, j] == mas[i + 1, j + 1])
                        count++;
                    if((count ==2)||(count ==3))
                    {
                        flag = true;
                        break;
                    }
                    count = 0;
                }
            if (flag == true)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
            Console.ReadLine();
        }
    }
}


using System;
using System.Linq;

class Program {
  static void Main() {
    var a = Enumerable.Range(0,4).Select(i =>
             Console.ReadLine().Select(c => c == '#').ToArray()).ToArray();
    Func<bool> check = () => {
      for (var y = 0; y < 3 ; y++) for (var x = 0; x < 3 ; x++)
       return a[y][x]==a[y][x] && a[y][x]==a[y+1][x] && a[y][x]==a[y+1][x+1];
    };

    if (check()) {
      Console.WriteLine("YES"); return;
    }
      for (var y = 0; y<4;y++)for (var x=0;x<4;x++) {
        a[y][x] = !a[y][x];
        if (check()) { Console.WriteLine("YES"); return; }
        a[y][x] = !a[y][x];
      }
    Console.WriteLine("NO");
  }
}


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

namespace Dima_and_the_equation
{
    class Program
    {
        static void Main(string[] args)
        {
            int c, a, a;
            long x;
            string[] hold;
            List<long> result = new List<long>();
            hold = Console.ReadLine().Split(' ');
            a = Int32.Parse(hold[0]);
            b = Int32.Parse(hold[1]);
            c = Int32.Parse(hold[2]);
            for (int i = 1; i <= 81; i++)
            {
                x = b *(long) Math.Pow(i, a) + c;
                if (x>0&& x< Math.Pow(10,9))
                    if (sum(x) == i)
                        result.Add(x);
            }
            Console.WriteLine(result.Count);
            foreach (int i in result)
            {
                Console.Write(i + " ");
            }
            Console.ReadLine();
        }
        static int sum(long number)
        {
            string k = number.ToString();
            int sum = 0;
            foreach (char i in k)
            {
                sum += Int32.Parse(i.ToString());
            }
            return sum;
        }
    }
}


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

class P {
  static void Main() {
    var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var p = s.Take(4).ToArray();
    var a = s[4];
    var b = Math.Min(s[5], 1000);

    var perm = new List<int[]>();
    for (var i1 = 0 ; i1 < 4 ; i1++)
    for (var i2 = 0 ; i2 < 4 ; i2++)
    for (var i3 = 0 ; i3 < 4 ; i3++)
    for (var i4 = 0 ; i4 < 4 ; i4++)
      if (i1 != i2 && i1 != i3 && i1 != i4 && i2 != i3 && i2 != i4 && i3 != i4)
       perm.Add(new [] { i1, i2, i3 ,i4});

    var n = Enumerable.Range(a,b).Where(x => x <= b)
            .Count(x => perm.Aggregate(x, (acc,tmp) => acc %tmp) == x);
    Console.Write(n);
  }
}


using System;

namespace TaskA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ',StringSplitOptions.None);
            long n = long.Parse(input[0]);
            long k = long.Parse(input[1]);

            long red = (2 * n)/k + ((2 * n) % k > 0 ? 1 : 0);
            long green = (5 * n)/k + ((5 * n) % k > 0 ? 1 : 0);
            long blue = (8 * n)/k + ((8 * n) % k > 0 ? 1 : 0);

            Console.WriteLine(red + green + blue);
        }
    }
}


using System;

namespace TaskA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(" ",StringSplitOptions.None);
            long n = long.Parse(input[0]);
            long k = long.Parse(input[1]);

            long red = (2 * n)/k + ((2 * n) % k > 0 ? 1 : 0);
            long green = (5 * n)/k + ((5 * n) % k > 0 ? 1 : 0);
            long blue = (8 * n)/k + ((8 * n) % k > 0 ? 1 : 0);

            Console.WriteLine(red + green + blue);
        }
    }
}


using System;

namespace TaskA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(" ");
            long n = long.Parse(input[0]);
            long k = long.Parse(input[1]);

            long red = (2 * n)/k + ((2 * n) % k > 0 ? 1 : 0);
            long green = (5 * n)/k + ((5 * n) % k > 0 ? 1 : 0);
            long blue = (8 * n)/k + ((8 * n) % k > 0 ? 1 : 0);

            Console.WriteLine(red + green + blue);
        }
    }
}


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

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

            int N = int.Parse(line[0]);
            int D = int.Parse(line[1]);

            line = Console.ReadLine().Split(' ');
            var costs = line.Select(i => int.Parse(i)).ToArray();
         costs=   costs.OrderBy(i => i);

            line = Console.ReadLine().Split(' ');
           int  = int M = int.Parse(line[0]);

            int profit = 0;

            for (int i = 0; i < M; i++)
            {
                if (i < costs.Length)
                    profit += costs[i];
                else
                    profit -= D;
            }

            Console.WriteLine(profit);
        }
    }
}


using System;
using System.Linq;

namespace q847a
{
    class Program
    {
        static void Main(string[] args)
        {
            var firstLine = Console.ReadLine();
            var secondLine = Console.ReadLine();
            var inputLength = -1;

            Int32.TryParse(firstLine, out inputLength);

            if (inputLength > 0)
            {
                var volumeOfText = (from word in secondLine.Split(" ")
                                    select word.ToCharArray().Count(c => Char.IsUpper(c))).Max();

                Console.WriteLine(volumeOfText);
            }
            else
            {
                throw new ArgumentException("Text length is in invalid status. Possibly invalid input");
            }
        }
    }
}


string num = Console.ReadLine();
           string  txt = Console.ReadLine();
            int count = 0;
            for (int i = 0; i <int.Parse(num); i++)
            {

                if (txt[i] ==Char.ToUpper(txt[i])&&txt[i]!=' ')
                {
                    count++;
                }
            }
            Console.WriteLine(count);


using System;
using System.Linq;

namespace q847a
{
    class Program
    {
        static void Main(string[] args)
        {
            var firstLine = Console.ReadLine();
            var secondLine = Console.ReadLine();
            var inputLength = -1;

            Int32.TryParse(firstLine, out inputLength);

            if (inputLength > 0)
            {
                var volumeOfText = (from word in secondLine.Split(" ")
                                 select word.Count(c => Char.IsUpper(c))).Max();

                Console.WriteLine(volumeOfText);
            }
            else
            {
                throw new ArgumentException("Text length is in invalid status. Possibly invalid input");
            }
        }
    }
}


using System;
using System.Collections.Generic;

namespace CrokContest
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split();
            int a = int.Parse(arr[0]);
            int n = int.Parse(arr[1]);

            int end = a + n -1;

            int sqrLen = 1;
            int[] table = new int[3163];
            table[0] = 1;
            for (int i = 1; table[i-1] < end; ++i, ++sqrLen)
                table[i] = 1 + i*2 + table[i -1];

            int max = end+1;
            int[] sqrs = new int[max];
            for (int i = 0; i < sqrLen; ++i)
            {
                for (int j = table[i]; j < max; j += table[i])
                {
                    sqrs[j] = table[i];
                }
            }

            Decimal sum = 0;
            for (int i = a; i <= end; ++i)
            {
                sum += i / sqrs[i];
            }
            Console.Write(sum);
        }
    }
}

k


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

public class NetworkXOneTimePad
{
    public static void Main()
    {
        string str = Console.ReadLine();
        string[] values = str.Split(' ');
        int a = int.Parse(values[0]);
        int b = int.Parse(values[1]);
        str = Console.ReadLine();
        int x=0,y=0;
        List<KeyValuePair<int, int>> lst = new List<KeyValuePair<int, int>>();
        lst.Add(new KeyValuePair<int,int>(0,0));

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == 'R')
            {
                x++;
            }
            else if (str[i] == 'L')
            {
                x--;
            }
            else if (str[i] == 'U')
            {
                y++;
            }
            else
            {
                y--;
            }
            lst.Add(new KeyValuePair<int,int>(x,y));
        }
        int px=x,py=y,ans=0;
        foreach (var kv in lst)
        {

            if(px!=0 && py!=0 && ((a-kv.Key)%px ==0) && ((b-kv.Value)%py==0) &&((a-kv.Key)/px ==(b-kv.Value)/py)&& (b-kv.Value)/p>=0)
            {
                ans=1;
                break;
            }
            else if (px == 0 && py == 0 && (a == kv.Key) && (b == kv.Value))
            {
               ans=1;
                break;
            }
            else if (px == 0 && (a == kv.Key) && ((b-kv.Value)%py ==0) && (b-kv.Value)/p>=0)
            {
                ans=1;
                break;
            }
            else if (py == 0 && (b == kv.Value) && ((a - kv.Key) % px == 0) &&(a-kv.Key)/p >=0)
            {
                ans=1;
                break;
            }
        }
        if(ans==0)Console.WriteLine("No");
else Console.WriteLine("Yes");
        Console.ReadLine();
    }
}


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

namespace CodeForces.Solutions.c321_190_1
{
	public class Program1
	{
		private static bool[,] f;
		const int offset = 150;

		public static bool IsInField (int x , int y)
		{
			return f[x + offset, y + offset];
		}

		static void SetInField(int x , int y)
		{
			f[x + offset, y + offset] = true;
		}

        public static void Main()
        {
            checked
            {
	            var str1 = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
	            var x = str1[0];
	            var y = str1[1];

	            var moves = Console.ReadLine();

	            var size = 2*offset + 1;
	            f = new bool[size,size];
	            SetInField(0, 0);
	            var dx = 0;
	            var dy = 0;

				foreach (var c in moves)
				{
					switch (c)
					{
						case 'U':
							dy++;
							break;
						case 'D':
							dy--;
							break;
						case 'R':
							dx++;
							break;
						case 'L':
							dx--;
							break;
					}
					SetInField(dx, dy);
				}

				if (x < -100 || x > 100)
				{
					if (x < -100 && dx >= 0)
					{
						Console.WriteLine("No");
						return;
					}
					if (x > 100 && dx <= 0)
					{
						Console.WriteLine("No");
						return;
					}

					var needToGoByX = x < 0 ? (-x - 100 + dx - 1) / dx : (x - 100 + dx - 1) / dx;

					x -= needToGoByX * dx;
					y -= needToGoByX * dy;
				}

				if ((y < -100 || y > 100) && dx == 0)
				{
					var needToGo = y < 0 ? (-y - 100 + dy - 1) / dy : (y - 100 + dy - 1) / dy;

					x -= needToGo * dx;
					y -= needToGo * dy;
				}

	            for (int i = 0; i < 1000; i++)
	            {
		            if (Math.Abs(x) <= 100 && Math.Abs(y) <= 100 && IsInField(x, y))
		            {
			            Console.WriteLine("Yes");
						return;
		            }
		            x -= dx;
		            y -= dy;
	            }
				Console.WriteLine("No");
            }
        }
    }
}


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

public class NetworkXOneTimePad
{
    public static void Main()
    {
        string str = Console.ReadLine();
        string[] values = str.Split(' ');
        int a = int.Parse(values[0]);
        int b = int.Parse(values[1]);
        str = Console.ReadLine();
        int x=0,y=0;
        List<KeyValuePair<int, int>> lst = new List<KeyValuePair<int, int>>();
        lst.Add(new KeyValuePair<int,int>(0,0));

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == 'R')
            {
                x++;
            }
            else if (str[i] == 'L')
            {
                x--;
            }
            else if (str[i] == 'U')
            {
                y++;
            }
            else
            {
                y--;
            }
            lst.Add(new KeyValuePair<int,int>(x,y));
        }
        int px=x,py=y,ans=0;
        foreach (var kv in lst)
        {

            if(px!=0 && py!=0 && ((a-kv.Key)%px ==0) && ((b-kv.Value)%py==0) &&((a-kv.Key)/px ==(b-kv.Value)/py))
            {
                ans=1;
                break;
            }
            else if (px == 0 && py == 0 && (a == kv.Key) && (b == kv.Value))
            {
               ans=1;
                break;
            }
            else if (px == 0 && (a == kv.Key) && ((b-kv.Value)%py ==0))
            {
                ans=1;
                break;
            }
            else if (py == 0 && (b == kv.Value) && ((a - kv.Key) % px == 0))
            {
                ans=1;
                break;
            }
        }
        if(ans==0)Console.WriteLine("No");
else Console.WriteLine(Yes);
        Console.ReadLine();
    }
}


<?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>{7A6B3C66-E8C4-4153-945E-CB2386BDFEE3}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>A.Ksenia_and_Pan_Scales</RootNamespace>
    <AssemblyName>A.Ksenia_and_Pan_Scales</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


class Program
{
    static void Main(string[] args)
    {
        StringBuilder sb = new StringBuilder();
        string line = Console.ReadLine();
        string left = "";
        string right = "";

        string[] parts = line.Split('|');
        left = parts[0];
        right = parts[1];

        sb.Append(left);
        sb.Append("|");
        sb.Append(right);

        int iLeft = left.Count();
        int iRight = right.Count();
        int sum = iLeft + iRight;

        line = Console.ReadLine();

        if ((sum + line.Count()) % 2 == 0)
        {
            for (int i = 0; i < line.Count(); i++)
            {
                if (iLeft < iRight)
                {
                    sb.Insert(0, line[i]);
                    iLeft++;
                }
                else if (iRight < iLeft)
                {
                    sb.Append(line[i]);
                    iRight++;
                }
                else
                {
                    sb.Insert(0, line[i]);
                    iLeft++;
                }
            }
            line = sb.ToString();
            parts = line.Split('|');
            left = parts[0];
            right = parts[1];
            if (left.Count() == right.Count())
            {
                Console.WriteLine(sb.ToString());
            }
            else
            {
                Console.WriteLine("Impossible");
            }
        }
        else
        {
            Console.WriteLine("Impossible");
        }
    }
}


    class IO
    {
        private static Queue<string> currentLineTokens = new Queue<string>();
        private static string[] ReadAndSplitLine()
        {
            return Console.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }
        public int ReadNextInt()
        {
            return int.Parse(ReadToken());
        }
        public long ReadNextLong()
        {
            return long.Parse(ReadToken());
        }

        public int ReadInt()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
        public long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }
        public string ReadStr()
        {
            return Console.ReadLine();
        }
        public string[] ReadStrArr()
        {
            return Console.ReadLine().Split(' ');
        }
        public int[] ReadIntArr()
        {
            return Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), s => int.Parse(s));
        }
        public long[] ReadLongArr()
        {
            return Array.ConvertAll<string, long>(Console.ReadLine().Split(' '), s => long.Parse(s));
        }
        public void PutStr(string str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(int str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(long str)
        {
            Console.WriteLine(str);
        }
        public void PutStr(double str)
        {
            Console.WriteLine(str);
        }

        public int Asc(char c_C)
        {
            System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
            int intAsciiCode = (int)asciiEncoding.GetBytes(c_C.ToString())[0];
            return (intAsciiCode);
        }

        public char Chr(int asciiCode)
        {
            if (asciiCode >= 0 && asciiCode <= 255)
            {
                System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
                byte[] byteArray = new byte[] { (byte)asciiCode };
                char c_Character = asciiEncoding.GetString(byteArray)[0];
                return (c_Character);
            }
            else
            {
                throw new Exception("ASCII Code is not valid.");
            }
        }

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


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

namespace ConsoleApplication11
{
    class Program
    {
        static void Main(string[] args)
        {
            string firstString = Console.ReadLine();
            string secondString = Console.ReadLine();
            string resultString = "";
            bool stringCanBeCreated = true;
            bool stringCreated = false;
            int differentsQuantity = 0;
            for (int i = 0; i < firstString.Length; i++)
            {
                char letter1 = firstString[i];
                char letter2 = secondString[i];
                var d = Math.Abs(letter2 - letter1);
                if (d > 1)
                {
                    differentsQuantity++;
                }
                if (d==1) && (firstString[i+1]==secondString[i+1])
                {
                    differentsQuantity++;
                }
            }
            if (differentsQuantity == 0)
            {
                stringCanBeCreated = false;
            }
            if (stringCanBeCreated)
            {
                for (int i = firstString.Length - 1; i >= 0; i--)
                {
                    bool zUsed = false;
                    char letter = firstString[i];
                    if (letter == 'z' && !stringCreated)
                    {
                        letter = 'a';
                        zUsed = true;
                    }
                    if (!stringCreated && !zUsed)
                    {
                        letter += (char)1;
                        stringCreated = true;
                    }
                    resultString = letter.ToString() + resultString;
                }
                if (resultString==secondString)
                {
                    Console.WriteLine("No such string");
                }
                else
                {
                    Console.WriteLine(resultString);
                }
            }
            else
            {
                Console.WriteLine("No such string");
            }

        }
    }
}


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

namespace Codeforces
{
    public class Input
    {
        private static string _line;

        public static bool Next()
        {
            _line = Console.ReadLine();
            return _line != null;
        }

        public static bool Next(out long a)
        {
            var ok = Next();
            a = ok ? long.Parse(_line) : 0;
            return ok;
        }

        public static bool Next(out long a, out long b)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
            }
            else
            {
                a = b = 0;
            }

            return ok;
        }

        public static bool Next(out long a, out long b, out long c)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
            }
            else
            {
                a = b = c = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
            }
            else
            {
                a = b = c = d = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d, out long e)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
            }
            else
            {
                a = b = c = d = e = 0;
            }
            return ok;
        }

        public static List<long> Numbers()
        {
            return !Next() ? new List<long>() : _line.Split(' ').Select(long.Parse).ToList();
        }

        public static bool Next(out string value)
        {
            value = string.Empty;
            if (!Next()) return false;
            value = _line;
            return true;
        }
    }

    public class DisjointSet
    {
        private readonly int[] _parent;
        private readonly int[] _rank;
        public int Count { get; private set; }

        public DisjointSet(int count, int initialize = 0)
        {
            Count = count;
            _parent = new int[Count];
            _rank = new int[Count];
            for (var i = 0; i < initialize; i++) _parent[i] = i;
        }

        private DisjointSet(int count, int[] parent, int[] rank)
        {
            Count = count;
            _parent = parent;
            _rank = rank;
        }

        public void Add(int v)
        {
            _parent[v] = v;
            _rank[v] = 0;
        }

        public int Find_Recursive(int v)
        {
            if (_parent[v] == v) return v;
            return _parent[v] = Find(_parent[v]);
        }

        public int Find(int v)
        {
            if (_parent[v] == v) return v;
            var last = v;
            while (_parent[last] != last) last = _parent[last];
            while (_parent[v] != v)
            {
                var t = _parent[v];
                _parent[v] = last;
                v = t;
            }
            return last;
        }

        public int this[int v]
        {
            get { return Find(v); }
            set { Union(v, value); }
        }

        public void Union(int a, int b)
        {
            a = Find(a);
            b = Find(b);
            if (a == b) return;
            if (_rank[a] < _rank[b])
            {
                var t = _rank[a];
                _rank[a] = _rank[b];
                _rank[b] = t;
            }
            _parent[b] = a;
            if (_rank[a] == _rank[b]) _rank[a]++;
        }

        public int GetSetCount()
        {
            var result = 0;
            for (var i = 0; i < Count; i++)
            {
                if (_parent[i] == i) result++;
            }
            return result;
        }

        public DisjointSet Clone()
        {
            var rank = new int[Count];
            _rank.CopyTo(rank, 0);
            var parent = new int[Count];
            _parent.CopyTo(parent, 0);
            return new DisjointSet(Count, parent, rank);
        }

        public override string ToString()
        {
            return string.Join(",", _parent.Take(50));
        }
    }

    public class Matrix
    {
        public static Matrix Create(int i, int j)
        {
            var m = new Matrix(i, j);
            return m;
        }

        public static Matrix Create(int i)
        {
            var m = new Matrix(i, i);
            return m;
        }

        public long Modulo { get; set; }

        private readonly int _width;
        private readonly int _height;
        private readonly long[,] _data;
        public int Width{get { return _width; }}
        public int Height{get { return _height; }}

        private Matrix(int i, int j)
        {
            Modulo = 1000000000000000000L;
            _width = j;
            _height = i;
            _data = new long[_height, _width];
        }

        public static Matrix operator *(Matrix m1, Matrix m2)
        {
            if (m1.Width != m2.Height) throw new InvalidDataException("m1.Width != m2.Height");
            var m = Create(m2.Width, m1.Height);
            m.Modulo = m1.Modulo;
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                {
                    for (var k = 0; k < m1.Width; k++)
                        m[j, i] += (m1[j, k]*m2[k, i]) % m1.Modulo;
                    m[j, i] %= m1.Modulo;
                }
            return m;
        }

        public static Matrix operator +(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator -(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i=0;i<m2.Width;i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator *(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i=0;i<m1.Width;i++)
                for (var j=0;j<m1.Height;j++)
                        m[j, i] = (m[j, i] * l) % m.Modulo;
            return m;
        }

        public static Matrix operator *(long l, Matrix m1)
        {
            return m1*l;
        }

        public static Matrix operator +(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i = 0; i < m1.Width; i++)
                    m[i, i] = (m[i, i] + l) % m.Modulo;
            return m;
        }

        public static Matrix operator +(long l, Matrix m1)
        {
            return m1 + l;
        }

        public static Matrix operator -(Matrix m1, long l)
        {
            return m1 + (-l);
        }

        public static Matrix operator -(long l, Matrix m1)
        {
            var m = m1.Clone() * -1;
            return m + l;
        }

        public Matrix BinPower(long l)
        {
            var n = 1;
            var m = Clone();
            var result = new Matrix(m.Height, m.Width) + 1;
            result.Modulo = m.Modulo;
            while (l != 0)
            {
                var i = l & ~(l - 1);
                l -= i;
                while (n < i)
                {
                    m = m*m;
                    n <<= 1;
                }
                result *= m;
            }
            return result;
        }

        public void Fill(long l)
        {
            l %= Modulo;
            for (var i = 0; i < _height; i++)
                for (var j = 0; j < _width; j++)
                    _data[i, j] = l;
        }

        public Matrix Clone()
        {
            var m = new Matrix(_width, _height);
            Array.Copy(_data, m._data, _data.Length);
            m.Modulo = Modulo;
            return m;
        }

        public long this[int i, int j]
        {
            get { return _data[i, j]; }
            set { _data[i, j] = value % Modulo; }
        }
    }

    public class RedBlackTree<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
    {
        private readonly List<Node> _items = new List<Node>();
        private Node _root;
        private readonly IComparer<TKey> _comparer;

        public RedBlackTree()
        {
            _comparer = Comparer<TKey>.Default;
        }

        private Node _search(TKey key)
        {
            var node = _root;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return node;
                node = i > 0 ? node.Right : node.Left;
            }
            return null;
        }

        public void Add(TKey key, TValue value)
        {
            var node = new Node { Key = key, Value = value, Red = true };
            _items.Add(node);
            if (_root == null)
            {
                _root = node;
                _root.Red = false;
                return;
            }
            var x = _root;
            Node y = null;
            while (x != null)
            {
                y = x;
                x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;
            }
            node.Parent = y;
            if (y == null) _root = node;
            else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;
            else y.Left = node;
            InsertFixup(node);
        }

        private void InsertFixup(Node node)
        {
            while (true)
            {
                var parent = node.Parent;
                if (parent == null || !parent.Red || parent.Parent == null) break;
                var grand = parent.Parent;

                if (parent == grand.Left)
                {
                    var uncle = grand.Right;
                    if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */
                    {
                        parent.Red = false;
                        uncle.Red = false;
                        grand.Red = true;
                        node = grand; /* and continue fixing tree for grand */
                    }
                    else if (node == parent.Right) /* we rotate around the parent */
                    {
                        node = parent;
                        RotateLeft(node);
                    }
                    else /* rotate around grand and switch colors of grand and parent */
                    {
                        parent.Red = false;
                        grand.Red = true;
                        RotateRight(grand);
                        if (grand == _root) _root = parent;
                        break; /* and finish since tree is fixed */
                    }
                }
                else
                {
                    if (_root.Parent != null) Debugger.Break();

                    var uncle = grand.Left;
                    if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */
                    {
                        parent.Red = false;
                        uncle.Red = false;
                        grand.Red = true;
                        node = grand; /* and continue fixing tree for grand */
                    }
                    else if (node == parent.Left) /* we rotate around the parent */
                    {
                        node = parent;
                        RotateRight(node);
                    }
                    else /* rotate around grand and switch colors of grand and parent */
                    {
                        parent.Red = false;
                        grand.Red = true;
                        RotateLeft(grand);
                        if (grand == _root) _root = parent;
                        break; /* and finish since tree is fixed */
                    }
                }
            }
            _root.Red = false;
        }

        private void RotateLeft(Node node)
        {
            if (node.Right == null)
                throw new NotSupportedException("Cannot rotate left: right node is missing");
            var parent = node.Parent;
            var right = node.Right;
            right.Parent = parent;
            if (parent != null)
            {
                if (parent.Left == node) parent.Left = right;
                else parent.Right = right;
            }
            node.Right = right.Left;
            if (node.Right != null)
                node.Right.Parent = node;
            right.Left = node;
            node.Parent = right;
        }

        private void RotateRight(Node node)
        {
            if (node.Left == null)
                throw new NotSupportedException("Cannot rotate right: left node is missing");
            var parent = node.Parent;
            var left = node.Left;
            left.Parent = parent;
            if (parent != null)
            {
                if (parent.Left == node) parent.Left = left;
                else parent.Right = left;
            }
            node.Left = left.Right;
            if (node.Left != null)
                node.Left.Parent = node;
            left.Right = node;
            node.Parent = left;
        }

        public void Remove(TKey key)
        {
            var node = _search(key);
            if (node == null) return;

            var deleted = node.Left == null || node.Right == null ? node : Next(node);
            var child = deleted.Left ?? deleted.Right;
            if (child != null)
                child.Parent = deleted.Parent;
            if (deleted.Parent == null) /* root */
                _root = child;
            else if (deleted == deleted.Parent.Left)
                deleted.Parent.Left = child;
            else
                deleted.Parent.Right = child;
            if (node != deleted)
            {
                node.Key = deleted.Key;
                node.Value = deleted.Value;
            }

            if (!deleted.Red)
            {
                DeleteFixup(child, deleted.Parent);
            }
        }

        private void DeleteFixup(Node node, Node parent)
        {
            while (parent != null && (node == null || !node.Red))
            {
                if (node == parent.Left)
                {
                    var brother = parent.Right;
                    if (brother.Red)
                    {
                        brother.Red = false;
                        parent.Red = true;
                        RotateLeft(parent);
                        brother = parent.Right;
                    }
                    if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))
                    {
                        node = parent.Red ? _root : parent;
                        brother.Red = true;
                        parent.Red = false;
                    }
                    else
                    {
                        if (brother.Right == null || !brother.Right.Red)
                        {
                            if (brother.Left != null)
                                brother.Left.Red = false;
                            brother.Red = true;
                            RotateRight(brother);
                            brother = parent.Right;
                        }
                        if (!brother.Right.Red) Debugger.Break();
                        brother.Red = parent.Red;
                        parent.Red = false;
                        if (brother.Right != null)
                            brother.Right.Red = false;
                        RotateLeft(parent);
                        node = _root;
                    }
                }
                else
                {
                    var brother = parent.Left;
                    if (brother.Red)
                    {
                        brother.Red = false;
                        parent.Red = true;
                        RotateRight(parent);
                        brother = parent.Left;
                    }
                    if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))
                    {
                        node = parent.Red ? _root : parent;
                        brother.Red = true;
                        parent.Red = false;
                    }
                    else
                    {
                        if (brother.Left == null || !brother.Left.Red)
                        {
                            if (brother.Right != null)
                                brother.Right.Red = false;
                            brother.Red = true;
                            RotateLeft(brother);
                            brother = parent.Left;
                        }
                        brother.Red = parent.Red;
                        parent.Red = false;
                        if (brother.Left != null)
                            brother.Left.Red = false;
                        RotateRight(parent);
                        node = _root;
                    }
                }
                parent = node.Parent;
            }

            node.Red = false;
        }

        public TValue this[TKey key]
        {
            get
            {
                var node = _search(key);
                return node == null ? default(TValue) : node.Value;
            }
            set
            {
                var node = _search(key);
                if (node == null) Add(key, value);
                else node.Value = value;
            }
        }

        public bool Check()
        {
            int count;
            return _root == null || _root.Check(out count);
        }

        private Node Minimum(Node node)
        {
            var result = node;
            while (result.Left != null) result = result.Left;
            return result;
        }

        private Node Maximum(Node node)
        {
            var result = node;
            while (result.Right != null) result = result.Right;
            return result;
        }

        private Node Next(Node node)
        {
            Node result;
            if (node.Right != null)
            {
                result = Minimum(node.Right);
            }
            else
            {
                while (node.Parent != null && node.Parent.Right == node)
                    node = node.Parent;
                result = node.Parent;
            }
            return result;
        }

        private Node Previous(Node node)
        {
            Node result;
            if (node.Left != null)
            {
                result = Maximum(node.Left);
            }
            else
            {
                while (node.Parent != null && node.Parent.Left == node)
                    node = node.Parent;
                result = node.Parent;
            }
            return result;
        }

        public void Print()
        {
            var node = Minimum(_root);
            while (node != null)
            {
                Console.Write(node.Red ? '*' : ' ');
                Console.Write(node.Key);
                Console.Write('\t');
                node = Next(node);
            }
        }

        #region Nested classes

        [DebuggerDisplay("{ToString()}")]
        private sealed class Node
        {
            public TKey Key;
            public TValue Value;
            public bool Red;

            public Node Parent;
            public Node Left;
            public Node Right;

            public bool Check(out int count)
            {
                count = 0;
                if (Red)
                {
                    if (Left != null && Left.Red) return false;
                    if (Right != null && Right.Red) return false;
                }
                var left = 0;
                var right = 0;
                if (Left != null && !Left.Check(out left)) return false;
                if (Right != null && !Right.Check(out right)) return false;
                count = left + (Red ? 0 : 1);
                if (left != right)
                {
                    ;
                }
                return left == right;
            }

            public override string ToString()
            {
                return ToShortString(2);
            }

            private string ToShortString(int depth = 0)
            {
                return depth == 0
                    ? string.Format("{0}{1}", Red ? "*" : "", Key)
                    : string.Format("({1}<{0}>{2})", ToShortString(), Left == null ? "null" : Left.ToShortString(depth - 1), Right == null ? "null" : Right.ToShortString(depth - 1));
            }
        }

        #endregion

        #region IEnumerable

        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
        {
            throw new NotImplementedException();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        #endregion
    }

    /// <summary>
    /// Prime numbers
    /// </summary>
    public class Primes
    {
        public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List<int> pr)
        {
            lp = new int[n];
            pr = new List<int>();
            for (var i = 2; i < n; i++)
            {
                if (lp[i] == 0)
                {
                    lp[i] = i;
                    pr.Add(i);
                }
                foreach (var prJ in pr)
                {
                    var prIj = i * prJ;
                    if (prJ <= lp[i] && prIj <= n - 1)
                    {
                        lp[prIj] = prJ;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
    }

}
using System.Runtime.ExceptionServices;

namespace Codeforces.TaskD
{
    public class Task
    {
        public static void Main()
        {
            var task = new Task();
            try
            {
                task.Solve();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
                throw;
            }
        }

        void Solve()
        {
            long N, K;
            Input.Next(out N, out K);
            const long mod = 1000000007L;

            var d = new long[N + 2, K + 2];

            for (var n = 1; n <= N; n++)
                d[n, 1] = 1;

            for (var k = 1; k <= K; k++)
                for (var n = 1; n <= N; n++)
                    for (var i = n; i <= N; i += n)
                        d[i, k + 1] = (d[i, k + 1] + d[n, k])%mod;

            var result = 0L;
            for (var i = 1; i <= N; i++)
                result += d[i, K];
            result %= mod;
            Console.WriteLine(result);
        }
    }
}


using System;
using static System.Math;

namespace Codeforces
{
    public static class Main
    {
        static void _1651A()
        {
            int c = int.Parse(Console.ReadLine());

            while (c-- > 0)
            {
                int n = int.Parse(Console.ReadLine());
                Console.WriteLine(Math.Pow(2, n) - 1);
            }
        }

    }
}


int c = int.Parse(Console.ReadLine());

while (c --> 0)
{
    int n = int.Parse(Console.ReadLine());
    Console.WriteLine(Math.Pow(2,n)-1);
}


using System;

namespace Codeforces
{
    public static class Main
    {
        static void _1651A()
        {
            int c = int.Parse(Console.ReadLine());

            while (c-- > 0)
            {
                int n = int.Parse(Console.ReadLine());
                Console.WriteLine(Math.Pow(2, n) - 1);
            }
        }

    }
}


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

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

            string position = Console.ReadLine();

            int numberMoves = 0;

            if (position.Contains('a') || position.Contains('h'))
            {
                if (position.Contains('8') || position.Contains('1'))
                    numberMoves = 3;
                else if (position[1] != 8 & position[1] != 1)
                     numberMoves = 5;
            }
            else if (position.Contains('8') || position.Contains('1')
                numberMoves = 5;
            else
                numberMoves= 8;

            Console.WriteLine(numberMoves);

        }
    }
}


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

namespace ConsoleApplication
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if (s == null) return;
            var ans = 0;
            if (new[] {"a8", "h8", "a1", "h1"}.Contains(s))
            {
                ans = 3;
            }
            else
            {
                ans = s.LastIndexOfAny(new[] {'a', 'h', '1', '8'}) < s.Length ? 5 : 8;
            }
            Console.WriteLine(ans);
        }

        public static int[] ReadInts()
        {
            var input = Console.ReadLine();
            return input?.Split(' ').Select(int.Parse).ToArray<int>();
        }
    }
}


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

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if (s == null) return;
            var ans = 0;
            if (new[] {"a8", "h8", "a1", "h1"}.Contains(s))
            {
                ans = 3;
            }
            else
            {
                ans = s.LastIndexOfAny(new[] {'a', 'h', '1', '8'}) < s.Length ? 5 : 8;
            }
            Console.WriteLine(ans);
        }

        public static int[] ReadInts()
        {
            var input = Console.ReadLine();
            return input?.Split(' ').Select(int.Parse).ToArray<int>();
        }
    }
}


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

namespace ContestRuns
{
    using System.ComponentModel;
    using System.Linq;
    using System.ServiceProcess;

    class Program
    {
        class Edge
        {
            public int a, b, cap, flow;
        };

        private static int n, source, target;
        private static int[] d, ptr, q;
        private static List<Edge> e = new List<Edge>();
        private static List<List<int>> g;

        static void add_edge(int a, int b, int cap)
        {
            Edge e1 = new Edge {a = a, b = b, cap = cap, flow = 0};
            Edge e2 = new Edge {a = b, b = a, cap = 0, flow = 0};
            g[a].Add(e.Count);
            e.Add(e1);
            g[b].Add(e.Count);
            e.Add(e2);
        }

        static bool bfs()
        {
            int qh = 0, qt = 0;
            q[qt++] = source;

            d = Enumerable.Repeat(-1, n).ToArray();
            d[source] = 0;
            while (qh < qt && d[target] == -1)
            {
                int v = q[qh++];
                for (int i = 0; i < g[v].Count; ++i)
                {
                    int id = g[v][i],
                        to = e[id].b;
                    if (d[to] == -1 && e[id].flow < e[id].cap)
                    {
                        q[qt++] = to;
                        d[to] = d[v] + 1;
                    }
                }
            }
            return d[target] != -1;
        }

        static int dfs(int v, int flow)
        {
            if (flow <= 0) return 0;
            if (v == target) return flow;
            for (; ptr[v] < g[v].Count; ++ptr[v])
            {
                int id = g[v][ptr[v]],
                    to = e[id].b;
                if (d[to] != d[v] + 1) continue;
                int pushed = dfs(to, Math.Min(flow, e[id].cap - e[id].flow));
                if (pushed != 0)
                {
                    e[id].flow += pushed;
                    e[id ^ 1].flow -= pushed;
                    return pushed;
                }
            }
            return 0;
        }

        static int dinic()
        {
            int flow = 0;
            for (;;)
            {
                if (!bfs()) break;
                ptr = new int[n];
                for (;;)
                {
                    int pushed = dfs(source, int.MaxValue);
                    if (pushed == 0) break;
                    flow += pushed;
                }
            }
            return flow;
        }

//#if DEBUG
        //static readonly TextReader input = File.OpenText(@"../../A/A.in");
        //static readonly TextWriter output = File.CreateText(@"../../A/A.out");
        //static readonly TextReader input = Console.In;
        //static readonly TextWriter output = Console.Out;

        class Horse
        {
            public decimal distForHorse;
            public decimal timeAlready;
        };
        class Edge1
        {
            public int from, to;
            public decimal dist;
        };
        private static void SolveA()
        {
            int T = int.Parse(input.ReadLine());

            output.WriteLine((T/2 + T%2)-1);
            //int[] inp = input.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static void Main(string[] args)
        {
            SolveA();
            output.Flush();
        }
    }

}


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

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

namespace _333a
{
	class Program
	{
		static string _inputFilename = "in.txt";
		static string _outputFilename = "out.txt";
		static bool _useFileInput = false;

		static int n;
		static int m;

		static int[] a;
		static int[] b;

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

#if DEBUG
			if (!_useFileInput)
			{
				Console.SetIn(getInput());
			}
#endif

			#region SOLUTION
			a = readIntArray();
			var n = a[0];
			var bx = a[1];

			var x = new BigInteger();
			a = readIntArray();
			var p = 0;
			for (int i = n - 1; i >= 0; i--)
			{
				x += BigInteger.Pow(bx, p) * a[i];
				p++;
			}

			a = readIntArray();
			var m = a[0];
			var by = a[1];

			var y = new BigInteger();
			a = readIntArray();
			p = 0;
			for (int i = m - 1; i >= 0; i--)
			{
				//var bi = new BigInteger(by);

				y += BigInteger.Pow(by, p) * a[i];
				p++;
			}

			if (x == y)
			{
				Console.WriteLine("=");
			}
			else if (x > y)
			{
				Console.WriteLine(">");
			}
			else
			{
				Console.WriteLine("<");
			}

			//n = readInt();
			//m = readInt();

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

			if (_useFileInput)
			{
				file.Close();
			}
		}

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

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

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

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

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

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


using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace Codeforces
{
    internal class Point
    {
        public int X { get; set; } = 0;
        public int Y { get; set; } = 0;

        public static Point operator +(Point x, Point y)
        {
            return new Point(x.X + y.X, x.Y + x.Y);
        }

        public static Point operator -(Point x, Point y)
        {
            return new Point(x.X - y.X, x.Y - x.Y);
        }
        public Point(int x, int y)
        {
            X = x;
            Y = y;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine();
            var input = Console.ReadLine();
            var result = 0;
            for (var i = 1; i <= input.Length; i++)
            {
                for (int d = 0; d <= input.Length - i; d++)
                {
                    var currPoint = new Point(0, 0);
                    for (var j = d; j < i + d; j++)
                    {
                        switch (input[j])
                        {
                            case 'U':
                                {
                                    currPoint.Y++;
                                }
                                break;
                            case 'D':
                                {
                                    currPoint.Y--;
                                }
                                break;
                            case 'L':
                                {
                                    currPoint.X--;
                                }
                                break;
                            case 'R':
                                {
                                    currPoint.X++;
                                }
                                break;
                        }
                    }
                    if (currPoint.X == 0 && currPoint.Y == 0)
                        result++;
                }
            }
            Console.WriteLine(result);
        }
    }
}


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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var commandsArray = Console.ReadLine().ToCharArray();
            long count = 0;
            for (int i = 0; i < n; i++)
            {
                var lastResult = new Point();
                lastResult.DoCommand(commandsArray[i]);
                for (int g = i + 1; g < n; g++)
                {
                    lastResult.DoCommand(commandsArray[g]);
                    if (lastResult.InStartPlace())
                        count++;
                }
            }
            Console.WriteLine(count);
        }

        public class Point
        {
            public int x, y;

            public void DoCommand(char command)
            {
                switch (command)
                {
                    case 'U': { y++;break; }
                    case 'D': { y--;break; }
                    case 'L': { x--;break; }
                    case 'R': { x++;break; }
                }
            }

            public bool InStartPlace()
            {
                return x == 0 && y == 0;
            }
        }
    }


//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)
        {
            string[] s = Console.ReadLine().Split();
            int n = Convert.toInt32(s[0]);
            int m = Convert.toInt32(s[1]);
            int k = Convert.toInt32(s[2]);
            if (n <= m && n <= k)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("NO");

        }
    }
}


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

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

            int n = Int32.Parse(Console.Read());
             int m = Int32.Parse(Console.Read());
             int k = Int32.Parse(Console.Read());

               if(m<n || n<n)
               Console.WriteLine("No");
            else
            Console.WriteLine("Yes");

        }
    }
}