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

namespace TaskC
{
    class Program
    {
        static void Main(string[] args)
        {
            new Solver().Solve().OutputResult();
        }

        private class ExtendedReader : StreamReader
        {
            private static readonly char Separator = ' ';

            public ExtendedReader(Stream stream) : base(stream) { }
            public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }
            public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }
            public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }
            public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }
            public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }
            public ExtendedReader(string path) : base(path) { }
            public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }
            public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }
            public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }
            public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }

            public char ReadChar()
            {
                return (char)this.Read();
            }

            public double ReadDoubleFromArray()
            {
                StringBuilder sb = new StringBuilder();
                char ch = this.ReadChar();
                while (ch != Separator && ch != '\n')
                {
                    sb.Append(ch);
                    ch = this.ReadChar();
                }
                return Convert.ToDouble(sb.ToString());
            }

            public int ReadInt()
            {
                return int.Parse(this.ReadLine());
            }

            public Int64 ReadInt64()
            {
                return Int64.Parse(this.ReadLine());
            }

            public int[] ReadIntArray()
            {
                return this.ReadLine().Split(' ').Select(int.Parse).ToArray();
            }

            public char[] ReadCharArray()
            {
                return this.ReadLine().ToCharArray();
            }

            public string ReadString()
            {
                return this.ReadLine();
            }

            public Int64[] ReadInt64Array()
            {
                return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();
            }

            public Double[] ReadDoubleArray()
            {
                return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();
            }
        }

        private abstract class SolverBase
        {
            protected readonly ExtendedReader _reader;
            protected readonly TextWriter _writer;

            protected SolverBase()
            {
#if DEBUG
                _reader = new ExtendedReader(@"input.txt");
                //_writer = new StreamWriter(@"output.txt");
                _writer = new StreamWriter(Console.OpenStandardOutput());
#else
                _reader = new ExtendedReader(Console.OpenStandardInput());
                _writer = new StreamWriter(Console.OpenStandardOutput());
#endif
            }

            public abstract Solver Solve();

            public abstract void OutputResult();
        }

        private class Solver : SolverBase
        {
            private long result = 0;

            public override Solver Solve()
            {
                // link to task: http://codeforces.com/problemset/problem/681/C

                var input = _reader.ReadIntArray();
                var n = input[0];
                var m = input[1];
                var maxN = n / 7 + 1;
                var maxM = m / 7 + 1;
                var numbers = new HashSet<int>();

                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        if (i == j) continue;
                        numbers.Clear();
                        if (ToSeven(i, maxN, numbers) && ToSeven(j, maxM, numbers))
                        {
                            result++;
                        }
                    }
                }

                return this;
            }

            private bool ToSeven(int val, int max, HashSet<int> nums)
            {
                for (int i = max - 1; i >= 0; i--)
                {
                    var value = val % 7;
                    if (nums.Contains(value)) return false;
                    val /= 7;
                    nums.Add(value);
                }

                return true;
            }

            public override void OutputResult()
            {
                string answer = result.ToString();

                _writer.WriteLine(answer);
                _writer.Dispose();
            }
        }
    }
}


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

namespace _686C
{
    class Program
    {
        static int[] powers7 = new[] { 7, 49, 343, 2401, 16807, 117649, 823543, 5764801, 40353607, 282475249 };

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]), m = int.Parse(input[1]);
            long answer = 0;
            int firstDigits = Digits(n), secondDigits = Digits(m);
            if (firstDigits + secondDigits <= 7)
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        bool[] used = new bool[7];
                        bool correct = true;
                        for (int a = i, k = 0; k != firstDigits; a /= 7, k++)
                        {
                            if (!used[a % 7])
                            {
                                used[a % 7] = true;
                            }
                            else
                            {
                                correct = false;
                                break;
                            }
                        }
                        if (!correct) continue;

                        for (int b = j, k = 0; k != secondDigits; b /= 7, k++)
                        {
                            if (!used[b % 7])
                            {
                                used[b % 7] = true;
                            }
                            else
                            {
                                correct = false;
                                break;
                            }
                        }
                        if (correct) answer++;
                    }
                }
            }

            Console.WriteLine(answer);
            //Console.ReadLine();
        }

        static int Digits(int number)
        {
            for (int i = 0; i < powers7.Length; i++)
            {
                if (number <= powers7[i])
                {
                    return i + 1;
                }
            }
            return -1;
        }
    }
}


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

namespace CF317
{
	internal class Program
	{
		private static void Main(string[] args)
		{
			var sr = new InputReader(Console.In);
			//var sr = new InputReader(new StreamReader("input.txt"));
			var task = new Task();
			using (var sw = Console.Out)
			//using (var sw = new StreamWriter("output.txt"))
			{
				task.Solve(sr, sw);
				//Console.ReadKey();
			}
		}
	}

	internal class Task
	{
		private long result = 0L;
		private List<int> daysInSeven;
		private List<int> minsInSeven;
		private string firstStr;
		private string secondStr;

		public void Solve(InputReader sr, TextWriter sw)
		{
			var input = sr.ReadArray(Int64.Parse);
			var n = input[0] - 1;
			var m = input[1] - 1;
			daysInSeven = ToSevenBase(n);
			minsInSeven = ToSevenBase(m);
			var reversed = daysInSeven.ToArray().Reverse();
			firstStr = reversed.Aggregate("", (curr, item) => curr + item);
			reversed = minsInSeven.ToArray().Reverse();
			secondStr = reversed.Aggregate("", (curr, item) => curr + item);
			var leftCount = daysInSeven.Count;
			var rightCount = minsInSeven.Count;
			if (leftCount + rightCount > 7) {
				rightCount -= 7 - leftCount;
			}
			if (rightCount < 0) {
				rightCount = 0;
			}
			Generate(0, 0, leftCount, rightCount, leftCount + rightCount, new char[leftCount + rightCount]);

			sw.WriteLine(result);
		}

		private void Generate(int currLeft, int currRight, int leftCount, int rightCount, int totalMax, char[] array)
		{
			if (currLeft + currRight == totalMax) {
				var contains = new int[7];
				for (var i = 0; i < array.Length; i++) {
					contains[array[i] - '0']++;
				}
				var isDifferent = contains.All(item => item <= 1);
				if (isDifferent) {
					var leftStr = new String(array, 0, leftCount);
					var rightStr = new String(array, leftCount, rightCount);
					var leftVal = Int64.Parse(leftStr);
					var rightVal = Int64.Parse(rightStr);
					var firstVal = Int64.Parse(firstStr);
					var secondVal = Int64.Parse(secondStr);
					if (leftVal <= firstVal && rightVal <= secondVal) {
						result++;
					}
				}
			}
			else {
				for (var i = 0; i < 7; i++) {
					array[currLeft + currRight] = (char) ('0' + i);
					if (currLeft < leftCount)
						Generate(currLeft + 1, currRight, leftCount, rightCount, totalMax, array);
					else
						Generate(currLeft, currRight + 1, leftCount, rightCount, totalMax, array);
				}
			}
		}

		private List<int> ToSevenBase(long n)
		{
			const int b = 7;
			var list = new List<int>();
			var curr = (int)n;
			while (curr > 0) {
				list.Add(curr % b);
				curr /= b;
			}

			return list;
		}
	}
}

internal class InputReader : IDisposable
{
	private bool isDispose;
	private readonly TextReader sr;

	public InputReader(TextReader stream)
	{
		sr = stream;
	}

	public void Dispose()
	{
		Dispose(true);
		GC.SuppressFinalize(this);
	}

	public string NextString()
	{
		var result = sr.ReadLine();
		return result;
	}

	public int NextInt32()
	{
		return Int32.Parse(NextString());
	}

	public long NextInt64()
	{
		return Int64.Parse(NextString());
	}

	public string[] NextSplitStrings()
	{
		return NextString()
			.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
	}

	public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
	{
		return NextSplitStrings()
			.Select(s => func(s, CultureInfo.InvariantCulture))
			.ToArray();
	}

	public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
	{
		return
			str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
				.Select(s => func(s, CultureInfo.InvariantCulture))
				.ToArray();
	}

	protected void Dispose(bool dispose)
	{
		if (!isDispose) {
			if (dispose)
				sr.Close();
			isDispose = true;
		}
	}

	~InputReader()
	{
		Dispose(false);
	}
}


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

namespace ConsoleApplication38
{
    class Program
    {
        static void Main(string[] args)
        {
            int d = 0;
            string[] arr = Console.ReadLine().Split();
            int a = int.Parse(arr[0]);
            int b = int.Parse(arr[1]);
            int c = int.Parse(arr[2]);

            for (int i = 1; i < c; i++)
            {
                if (i%a==0&&i%b==0)
                    d++;
            }
            Console.WriteLine(d);

        }
    }
}


using System;

namespace CodeForces
{
	public class A
	{
		static void Main()
		{
			var n = int.Parse( Console.ReadLine() );
			if ( n == 1 )
			{
				Console.WriteLine( 0 );
				return;
			}
			int res = int.MaxValue;
			for ( int i = 1; i < n; ++i )
			{
				var x = i;
				var cur = 0;
				var y = n;
				while ( x > 0 && y > 0 )
				{
					if ( x > y )
					{
						cur += x / y;
						x %= y;
					}
					else
					{
						cur += y / x;
						y %= x;
					}
				}
				res = Math.Min( res, cur );
			}
			Console.WriteLine( res - 1 );
		}
	}
}


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

namespace Codeforces
{

    class Program
    {
        public void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (n == 1)
            {
                Console.WriteLine("YES");
                return;
            }
            var pos1 = 0;
            var pos2 = n - 1;
            var i = 1;
            while (i < n)
            {
                if (!(arr[i] > arr[i - 1]))
                    break;
                i++;
            }
            pos1 = i;
            i = n - 1;
            while (i>=0)
            {
                if (!(arr[i - 1] > arr[i]))
                    break;
                i--;
            }
            pos2 = i;

            var val = arr[pos1];
            for(int j = pos1; j <= pos2; j++)
            {
                if (arr[j] != val)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");
        }

        static void Main(string[] args)
        {
            var p = new Program();
            p.Solve();
            //Console.ReadLine();
        }
    }

}


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

namespace Problem492A {
    class Program {
        static void Main(string[] args) {
            List<int[]> pyramid = generateLevelRequirements();
            int cubes = Convert.ToInt32(Console.ReadLine());
            int pyramidL = pyramid.Count;

            int height = 0;
            int cubes2 = 0;
            int index = 0;
            while (cubes2 <= cubes) {
                cubes2 = pyramid[index][1];
                height = pyramid[index][0];
                index++;
            }

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

        private static List<int[]> generateLevelRequirements() {
            int height = 1;
            int cubes = 1;

            List<int[]> result = new List<int[]>();

            while (cubes <= 10000) {
                int[] tmpInfo = new int[2];
                tmpInfo[0] = height;
                tmpInfo[1] = cubes;

                result.Add(tmpInfo);
                height++;

                int nextLevelCubes = height * (height + 1) / 2;
                cubes += nextLevelCubes;
            }
            return result;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using CompLib.Util;
using System.Threading;
using CompLib.Mathematics;

public class Program
{
    private long N, K, A, B;
    private long Min, Max;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        K = sc.NextInt();
        A = sc.NextInt();
        B = sc.NextInt();

        /*
         * n*k都市 1ごとに円周上
         *
         * n軒 kごとにファストフード店
         *
         * sからlkmごとの都市にsに戻るまで行く
         *
         * sから最寄りのファストフード店までa
         * s+lからb
         *
         * 通った都市の最大、最小
         */
        Min = int.MaxValue;
        Max = int.MinValue;
        F((A + B) % K);
        F((A - B) % K);
        F((-A + B) % K);
        F((-A - B) % K);
        /*
         * a,bも右
         * s % k = a
         * (s + l) % k = b
         *
         * (b - a)%k = l % k
         *
         *
         */

        Console.WriteLine($"{Min} {Max}");
    }

    void F(long l)
    {
        while (l <= 0) l += K;
        for (int i = 0; i < 10000000; i++)
        {
            // Console.WriteLine(l);
            var gcd = MathEx.GCD(N * K, l);
            Min = Math.Min(Min, N * K / gcd);
            Max = Math.Max(Max, N * K / gcd);
            l += K;
        }
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

// https://bitbucket.org/camypaper/complib
namespace CompLib.Mathematics
{
    using System;
    using System.Collections.Generic;

    #region GCD LCM

    /// <summary>
    /// 様々な数学的関数の静的メソッドを提供します．
    /// </summary>
    public static partial class MathEx
    {
        /// <summary>
        /// 2 つの整数の最大公約数を求めます．
        /// </summary>
        /// <param name="n">最初の値</param>
        /// <param name="m">2 番目の値</param>
        /// <returns>2 つの整数の最大公約数</returns>
        /// <remarks>ユークリッドの互除法に基づき最悪計算量 O(log N) で実行されます．</remarks>
        public static int GCD(int n, int m)
        {
            return (int) GCD((long) n, m);
        }

        /// <summary>
        /// 2 つの整数の最大公約数を求めます．
        /// </summary>
        /// <param name="n">最初の値</param>
        /// <param name="m">2 番目の値</param>
        /// <returns>2 つの整数の最大公約数</returns>
        /// <remarks>ユークリッドの互除法に基づき最悪計算量 O(log N) で実行されます．</remarks>
        public static long GCD(long n, long m)
        {
            n = Math.Abs(n);
            m = Math.Abs(m);
            while (n != 0)
            {
                m %= n;
                if (m == 0) return n;
                n %= m;
            }

            return m;
        }

        /// <summary>
        /// 2 つの整数の最小公倍数を求めます．
        /// </summary>
        /// <param name="n">最初の値</param>
        /// <param name="m">2 番目の値</param>
        /// <returns>2 つの整数の最小公倍数</returns>
        /// <remarks>最悪計算量 O(log N) で実行されます．</remarks>
        public static long LCM(long n, long m)
        {
            return (n / GCD(n, m)) * m;
        }
    }

    #endregion

    #region PrimeSieve

    public static partial class MathEx
    {
        /// <summary>
        /// ある値までに素数表を構築します．
        /// </summary>
        /// <param name="max">最大の値</param>
        /// <param name="primes">素数のみを入れた数列が返される</param>
        /// <returns>0 から max までの素数表</returns>
        /// <remarks>エラトステネスの篩に基づき，最悪計算量 O(N loglog N) で実行されます．</remarks>
        public static bool[] Sieve(int max, List<int> primes = null)
        {
            var isPrime = new bool[max + 1];
            for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;
            for (int i = 2; i * i <= max; i++)
                if (!isPrime[i]) continue;
                else
                    for (int j = i * i; j <= max; j += i)
                        isPrime[j] = false;
            if (primes != null)
                for (int i = 0; i <= max; i++)
                    if (isPrime[i])
                        primes.Add(i);

            return isPrime;
        }
    }

    #endregion
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


// Problem: 893B - Beautiful Divisors
// Author: Gusztav Szmolik

using System;

class BeautifulDivisors
    {
    static int Main ()
        {
        string[] words = ReadSplitLine (1);
        if (words == null)
            return -1;
        uint n;
        if (!UInt32.TryParse (words[0], out n))
            return -1;
        if (n < 1 || n > 100000)
            return -1;
        uint ans = 0;
        for (ushort i = 1; i <= n && ans == 0; i++)
            {
            if (n%i > 0)
                continue;
            uint divisor = n/i;
            uint tmpConvBin = divisor;
            byte countZero = 0;
            byte countOne = 0;
            bool solved = true;
            bool procZero = true;
            while (tmpConvBin > 0 && solved)
                {
                byte digitBin = Convert.ToByte (tmpConvBin%2);
                tmpConvBin /= 2;
                if (digitBin == 0)
                    {
                    if (procZero)
                        countZero++;
                    else
                        solved = false;
                    }
                else
                    {
                    if (procZero)
                        {
                        procZero = false;
                        countOne = 1;
                        }
                    else
                        {
                        countOne++;
                        if (countOne > countZero+1)
                            solved = false;
                        }
                    }
                }
            if (solved && countOne == countZero+1)
                ans = divisor;
            }
        Console.WriteLine (ans > 0 ? ans : 1);
        return 0;
        }

    static string[] ReadSplitLine (uint numWordNeed)
        {
        string line = Console.ReadLine ();
        if (line == null)
            return null;
        char[] delims = new char[2] {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        return (words.Length == numWordNeed ? words : null);
        }
    }


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

namespace Beautiful_Divisors
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            for(int i=n;i>0;i--)
            {
                string binary = Convert.ToString(i, 2);
                int ones = 0;
                int zeroes = 0;
                bool flag = false;
                bool correct = true;
                int count = 0;
                while(count!=binary.Length)
                {
                    if (!flag)
                    {
                        if(binary[count]=='1')
                        {
                            ones++;
                            count++;
                        }
                        else
                        {
                            zeroes++;
                            flag = true;
                            count++;
                        }
                    }
                    else
                    {
                        if(binary[count]=='0')
                        {
                            zeroes++;
                            count++;
                        }
                        else
                        {
                            correct = false;
                            break;
                        }
                    }
                }
                if(correct&&ones-1==zeroes)
                {
                    Console.WriteLine(i);
                    break;
                }

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


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

class Solver
{
    //  test
    static CodeforcesUtils CF = new CodeforcesUtils( new[]{

@"
12:00
"
,
@"
04:30
"
,
@"
08:17
"

    });

    public void Solve()
    {
        var ss = CF.ReadLine().Split(':');
        int h = int.Parse(ss[0]);
        int m = int.Parse(ss[1]);

        double d1 = 360.0*(h%12)/12+360.0/12*m/60;
        double d2 = 360 * m / 60;
        CF.WriteLine(d1 + " " + d2);
    }

    #region test

    static void Main(string[] args)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ru-RU");

#if DEBUG
        for (int t=0;t<CF.TestCount;t++ )
        {
            CF.Test(t);
            new Solver().Solve();
        }
#else
        new Solver().Solve();
#endif
        CF.Close();
    }

    static void TLE()
    {
        for (; ; ) ;
    }

    class CodeforcesUtils
    {
        public void Test(int t)
        {
            _lines = new List<string>();
            string[] ss = _test_input[t].Replace("\n", "").Split('\r');
            for (int i = 0; i < ss.Length; i++)
            {
                if (
                    (i == 0 || i == ss.Length - 1) &&
                    ss[i].Length == 0
                    )
                    continue;

                _lines.Add(ss[i]);
            }
        }

        public int TestCount
        {
            get
            {
                return _test_input.Length;
            }
        }

        public string ReadLine()
        {
#if DEBUG
            string s = null;
            if (_lines.Count > 0)
            {
                s = _lines[0];
                _lines.RemoveAt(0);
            }
            return s;

#else
            //return _sr.ReadLine();
        return Console.In.ReadLine();
#endif
        }

        public void WriteLine(object o)
        {
#if DEBUG
            System.Diagnostics.Trace.WriteLine(o);
#else
            //_sw.WriteLine(o);
        Console.WriteLine(o);
#endif
        }

        public void Write(object o)
        {
#if DEBUG
            System.Diagnostics.Trace.Write(o);
#else
                //_sw.Write(o);
        Console.Write(o);
#endif
        }

        string[] _test_input;

        List<string> _lines;

#if DEBUG
        public CodeforcesUtils(string[] test_input)
        {
            _test_input = test_input;
        }
#else

        public CodeforcesUtils(string[] dummy)
        {
            //_sr = new System.IO.StreamReader("input.txt");
            //_sw = new System.IO.StreamWriter("output.txt");
        }
#endif

        public void Close()
        {
            if( _sr!= null)
                _sr.Close();
            if( _sw != null)
                _sw.Close();
        }

        System.IO.StreamReader _sr=null;
        System.IO.StreamWriter _sw=null;

    }

    #endregion
}


using System;

namespace CFAlgo
{
    class Program
    {
        static void Main(string[] args)
        {
            int nr = int.Parse(Console.ReadLine());
            string text = Console.ReadLine();

            var steps = new int[] { 0, 2, 5, 9, 14, 20, 27, 35, 44, 54 };
            for(int i = 0; steps[i] < nr; ++i)
            {
                Console.Write(text[steps[i]]);
            }

        }
    }
}


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

namespace ProgrammingContest.Codeforces.Round82 {
    class A {
        static void Mai() {
            char s = Console.ReadLine()[0];
            var xs = Console.ReadLine().Split(' ');

            Dictionary<char, int> dic = new Dictionary<char, int>();

            for (int i = 6; i < 10; i++)
                dic[(char)(i + '0')] = i;

            string str = "TJQKA";
            for (int i = 0; i < str.Length; i++)
                dic[str[i]] = i + 10;

            Console.WriteLine(
                s == xs[0][1] && s != xs[1][1] ||
                xs[0][1] == xs[1][1] && dic[xs[0][0]] > dic[xs[1][0]] ?
                "YES" : "NO");
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            string[] ss = reader.ReadLine().Split(' ');
            int n = int.Parse(ss[0]);
            int t = int.Parse(ss[2]);
            double p = double.Parse(ss[1], CultureInfo.InvariantCulture);
            double q = 1 - p;
            var nn = new double[n + 1];
            nn[0] = 1;

            for (int i = 0; i < t; i++)
            {
                nn[n] += p*nn[n - 1];

                for (int j = n - 1; j > 0; j--)
                {
                    nn[j] = q*nn[j] + p*nn[j - 1];
                }

                nn[0] *= q;
            }

            writer.WriteLine("{0}", (nn.Sum()).ToString("#0.0000000", CultureInfo.InvariantCulture));
            writer.Flush();
        }
    }
}


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

namespace soldier_games
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //int max = 0;
            //int killed = 0;
            //int i, j, k = 0;

            //for (i = 1; i <= n/2; i++)
            //{
            //    killed += i;
            //    for (j = 1; j <= n - i; j++)
            //    {
            //        killed += j;
            //        for (k = 1; k <= n - j && k <= n - i; k++)
            //        {

            //            killed += k;
            //            if (killed > max)
            //            {
            //                max = killed;
            //            }
            //            killed -= k;
            //        }
            //        killed -= j;
            //    }
            //    killed -= i;
            }
            Console.WriteLine(n/2*3);
        }
    }
}
//        static int getmax(int n)
//        {
//            int max = 0;
//            int killed = 0;
//            int i, j, k = 0;

//            for ( i = 1; i <=n; i++)
//            {
//                killed += i;
//                for ( j = 1; j <= n - i ; j++)
//                {
//                    killed +=  j;
//                    for ( k = 1; k <= n - j &&k<=n-i ; k++)
//                    {

//                        killed += k;
//                        if (killed > max)
//                        {
//                            max = killed;
//                        }
//                        killed -= k;
//                    }
//                    killed -= j;
//                }
//                killed -=i ;
//            }
//            return max;
//        }

//    }
//}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double pi=3.14159265358979323846264338327950288;
            int[] R = new int[6];
            string [] a=Console.ReadLine().Split(' ');
            for (int i = 0; i < 6; i++)
                R[i] = int.Parse(a[i]);

            double s1 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[0] * R[1]);
            double s2 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[2] * R[3]);
            double s3 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[4] * R[5]);
            double s4 = Math.Abs((R[0] + 0.5 * R[1]) * (R[5] + R[4]) * Math.Cos(30.0 / 180.0 * pi)
                - R[1] * Math.Sin(60.0 / 180.0 * pi) *0.5* (-R[5]  + R[4]));
            double s = s1 + s2 + s3 + s4;
            double k = s / Math.Sin(60.0 / 180.0 * pi);
            Console.WriteLine(k);
           /* int n = (int)k;
            if (k - 0.5 < n)

                Console.WriteLine(n);
            else
                Console.WriteLine(n+1);*/

            //Console.WriteLine("n={0} k={1}",n, k);
          //Console.ReadKey();

        }
    }
}


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

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public PairVariable()
    {
        a = b = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;
    }

    public int CompareTo(PairVariable other)
    {
        return other.a.CompareTo(this.a);
    }
}

namespace ConsoleApplication254
{

    class Program
    {
		static double scalar(int x1,int y1,int x2,int y2,int x3,int y3)
		{
			return (x2-x1)*(x3-x2)+(y2-y1)*(y3-y2);
		}
        static bool foo(double d1, double d2, double d3)
        {
            double a1=(d1*d1)+(d3*d3)-(d2*d2);
			double a2=(d2*d2)+(d3*d3)-(d1*d1);
			bool f=a1>0&&a2>0;
			return f;
        }
        static void Main(string[] args)
        {
			string[]ss=Console.ReadLine().Split();
			int[]m=new int[6];
			for(int i=0; i<6; i++)
			{
				m[i]=int.Parse(ss[i]);
			}
			Array.Sort(m);
			if(m[0]==m[6-1])
			{
				Console.WriteLine(6*m[0]);
			}
			else
			{
				Console.WriteLine(13*(m[6-1]/2));
			}

		}
    }
}


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

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

namespace _307d
{
	class Program
	{
		static string _inputFilename = "input.txt";
		static string _outputFilename = "output.txt";
#if DEBUG
        static bool _useFileInput = false;
#else
		static bool _useFileInput = false;
#endif

		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

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

		static void solution()
		{
			#region SOLUTION
			var d = readLongArray();
			var n = d[0];
			var k = d[1];
			var l = (int)d[2];
			var m = d[3];

			if (l == 0)
			{
				Console.WriteLine(0);
				return;
			}

			for (int i = l; i < 64; i++)
			{
				if (((1L << i) & k) != 0)
				{
					Console.WriteLine(0);
					return;
				}
			}

			var fim = new Matrix { _11 = 0, _12 = 1, _21 = 1, _22 = 1 };
			//fim.Print();
			var sq = pow(fim, n - 1, m);
			//sq.Print();

			var fn0 = (sq._21 + sq._22) % m;
			var fn1 = (sq._11 + sq._12) % m;
			var fr = (fn0 + fn1) % m;

			//var fi = new int[n + 1];
			//fi[0] = 1;
			//fi[1] = 1;
			//for (int i = 2; i < n + 1; i++)
			//{
			//	fi[i] = fi[i - 1] + fi[i - 2];
			//}

			var nc = pow(2, n, m);
			nc -= fr;
			if (nc < 0)
			{
				nc += m;
			}
			//nc *= ((n - 1) % m);
			nc %= m;

			var res = 1L;
			for (int i = 0; i < l; i++)
			{
				if (((1L << i) & k) != 0)
				{
					res *= nc;
					res %= m;
				}
				else
				{
					res *= fr;
					res %= m;
				}
			}

			Console.WriteLine(res);

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

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

		class Matrix
		{
			public long _11;
			public long _12;
			public long _21;
			public long _22;

			public void Mult(Matrix x, long mod)
			{
				var __11 = (_11 * x._11) % mod + (_12 * x._21) % mod;
				var __12 = (_11 * x._21) % mod + (_12 * x._22) % mod;
				var __21 = (_21 * x._11) % mod + (_22 * x._21) % mod;
				var __22 = (_21 * x._21) % mod + (_22 * x._22) % mod;

				_11 = __11 % mod;
				_12 = __12 % mod;
				_21 = __21 % mod;
				_22 = __22 % mod;
			}

			public void Square(long mod)
			{
				Mult(this, mod);
			}

			public void Print()
			{
				Console.WriteLine("{0} {1}", _11, _12);
				Console.WriteLine("{0} {1}", _21, _22);
				Console.WriteLine();
			}
		}

		static Matrix pow(Matrix x, long p, long mod)
		{
			//p %= mod;

			var res = new Matrix() { _11 = 1, _22 = 1 };
			var a = new Matrix() { _11 = x._11, _12 = x._12, _21 = x._21, _22 = x._22 };
			while (true)
			{
				if (p % 2 == 1)
				{
					res.Mult(a, mod);
					p--;
				}

				if (p == 0)
				{
					break;
				}

				p /= 2;
				a.Square(mod);
			}

			return res;
		}

		static long pow(long x, long p, long mod)
		{
			x %= mod;
			//p %= mod;

			var res = 1L;
			var a = x;
			while (true)
			{
				if (p % 2 == 1)
				{
					res *= a;
					res %= mod;
					p--;
				}

				if (p == 0)
				{
					break;
				}

				p /= 2;
				a *= a;
				a %= mod;
			}

			return res;
		}

		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
	}
}


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

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

namespace _307d
{
	class Program
	{
		static string _inputFilename = "input.txt";
		static string _outputFilename = "output.txt";
#if DEBUG
        static bool _useFileInput = false;
#else
		static bool _useFileInput = false;
#endif

		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

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

		static void solution()
		{
			#region SOLUTION
			var d = readLongArray();
			var n = d[0];
			var k = d[1];
			var l = (int)d[2];
			var m = d[3];

			for (int i = l; i < 64; i++)
			{
				if (((1L << i) & k) != 0)
				{
					Console.WriteLine(0);
					return;
				}
			}

			var fim = new Matrix { _11 = 0, _12 = 1, _21 = 1, _22 = 1 };
			//fim.Print();
			var sq = pow(fim, n - 1, m);
			//sq.Print();

			var fn0 = (sq._21 + sq._22) % m;
			var fn1 = (sq._11 + sq._12) % m;
			var fr = (fn0 + fn1) % m;

			var fi = new int[n + 1];
			fi[0] = 1;
			fi[1] = 1;
			for (int i = 2; i < n + 1; i++)
			{
				fi[i] = fi[i - 1] + fi[i - 2];
			}

			var nc = pow(2, n, m);
			nc -= fr;
			if (nc < 0)
			{
				nc += m;
			}
			//nc *= ((n - 1) % m);
			nc %= m;

			var nmod = n % m;
			var res = 1L;
			for (int i = 0; i < l; i++)
			{
				if (((1L << i) & k) != 0)
				{
					res *= nc;
					res %= m;
				}
				else
				{
					res *= fr;
					res %= m;
				}
			}

			Console.WriteLine(res);

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

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

		class Matrix
		{
			public long _11;
			public long _12;
			public long _21;
			public long _22;

			public void Mult(Matrix x, long mod)
			{
				var __11 = (_11 * x._11) % mod + (_12 * x._21) % mod;
				var __12 = (_11 * x._21) % mod + (_12 * x._22) % mod;
				var __21 = (_21 * x._11) % mod + (_22 * x._21) % mod;
				var __22 = (_21 * x._21) % mod + (_22 * x._22) % mod;

				_11 = __11 % mod;
				_12 = __12 % mod;
				_21 = __21 % mod;
				_22 = __22 % mod;
			}

			public void Square(long mod)
			{
				Mult(this, mod);
			}

			public void Print()
			{
				Console.WriteLine("{0} {1}", _11, _12);
				Console.WriteLine("{0} {1}", _21, _22);
				Console.WriteLine();
			}
		}

		static Matrix pow(Matrix x, long p, long mod)
		{
			//p %= mod;

			var res = new Matrix() { _11 = 1, _22 = 1 };
			var a = new Matrix() { _11 = x._11, _12 = x._12, _21 = x._21, _22 = x._22 };
			while (true)
			{
				if (p % 2 == 1)
				{
					res.Mult(a, mod);
					p--;
				}

				if (p == 0)
				{
					break;
				}

				p /= 2;
				a.Square(mod);
			}

			return res;
		}

		static long pow(long x, long p, long mod)
		{
			x %= mod;
			//p %= mod;

			var res = 1L;
			var a = x;
			while (true)
			{
				if (p % 2 == 1)
				{
					res *= a;
					res %= mod;
					p--;
				}

				if (p == 0)
				{
					break;
				}

				p /= 2;
				a *= a;
				a %= mod;
			}

			return res;
		}

		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;

public class Program
{
	public static void Main()
	{
		int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
		int n = input[0];
		int m = input[1];
		Dictionary<int, List<int>> edges = new Dictionary<int, List<int>>();
		Dictionary<int, int> children = new Dictionary<int, int>(n - 1);
		Dictionary<int, int> levels = new Dictionary<int, int>(n);
		levels.Add(1, 1);

		for (int i = 0; i < n - 1; i++)
		{
			input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
			int u = input[0];
			int v = input[1];

			if (u == 1) children.Add(v, u);
			else if (v == 1) children.Add(u, v);
			else
			{
				if (!edges.ContainsKey(u)) edges.Add(u, new List<int>()); edges[u].Add(v);
				if (!edges.ContainsKey(v)) edges.Add(v, new List<int>()); edges[v].Add(u);
			}
		}

		while(edges.Any())
		{
			// Populate chilren starting from the root
			foreach (int k in children.Keys)
			{
				if (edges.ContainsKey(k))
				{

				}
			}

			/*children.Add(v, u);
			levels.Add(v, levels[u]+1);*/
		}

		for (int i = 0; i < m; i++)
		{
			input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
			int k = input[0];
			HashSet<int> path = new HashSet<int>() { 1 };
			string ans = "YES";

			foreach(int j in input.Skip(1))
			{
				int parentJ = 1;
				if (j != 1) parentJ = children[j];

				if (levels[parentJ] <= path.Count)
				{
					if (!path.Contains(parentJ))
					{
						ans = "NO";
						break;
					}
				}
				else
				{
					List<int> finalizePath = new List<int>();
					finalizePath.Add(parentJ);

					while (levels[finalizePath.Last()] > path.Count)
					{
						finalizePath.Add(children[finalizePath.Last()]);
					}

					if (finalizePath.Last() != path.Last())
					{
						ans = "NO";
						break;
					}
					else
					{
						finalizePath.Remove(path.Last());
						finalizePath.Reverse();
						foreach (int p in finalizePath)
						{
							path.Add(p);
						}
					}
				}
			}

			Console.WriteLine(ans);
		}
	}
}


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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "1111111111", buf = "1111111111";
            int a = Convert.ToInt32(Console.ReadLine());
            for (int i = 1; i <= a; i++)
                for (int j = 1; j <= a; j++)
                {
                    if (i * j == a)
                        str = i.ToString() + j.ToString();
                    if (buf.Length > str.Length)
                        buf = str;
                }
            Console.WriteLine(buf);
            Console.ReadLine();
        }
    }
}


using System;
using System.Linq;

namespace Codeforces
{
	public class C
	{
		const int N = (int)1e6 + 1;
		public static int Main()
		{
			int [] input = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();

			long [] a = new long[N];

			int A = input[0];
			int B = input[1];
			int C = input[2];
			int D = input[3];

			for (int i = A; i <= B; ++i)
			{
				++a[i + B];
				--a[i + C + 1];
			}

			for (int i = 1; i < N; ++i)
			{
				a[i] += a[i - 1];
			}

			for (int i = 1; i < N; ++i)
			{
				a[i] += a[i - 1];
			}

			long result = 0;
			for (int i = C; i <= D; ++i)
			{
				result += a[N - 1] - a[i];
			}

			Console.WriteLine(result);

			return 0;
		}
	}
}


using System;
using System.IO;
using System.Linq;

namespace Codeforces.R1355.C
{
    public static class Solver
    {
        public static void Main()
        {
            using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Solve(Console.In, sw);
            }
        }

        public static void Solve(TextReader tr, TextWriter tw)
        {
            WriteAnswer(tw, Parse(tr));
        }

        private static void WriteAnswer(TextWriter tw, long answer)
        {
            tw.WriteLine(answer);
        }

        private static long Parse(TextReader tr)
        {
            var t = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            return Calc(t[0], t[1], t[2], t[3]);
        }

        public static long Calc(long a, long b, long c, long d)
        {
            var res = 0L;

            for (var x = a; x <= b; ++x)
            {
                var yMin = Math.Max(b, c + 1 - x);
                var zMax = Math.Min(d + 1, x + yMin);
                var zNum = zMax - c;

                var yNum = c + 1 - yMin;

                res += zNum * yNum;
                res += (yNum - 1) * yNum / 2;
            }

            return res;
        }
    }
}


using System;

namespace CSharpPractice
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Int64 input = Int64.Parse(Console.ReadLine());

            Int64 value = input / 2;
            Int64 count = 0;
            decimal range = Math.Ceiling((decimal)value / 2);
            for (Int64 i = 1; i < range; i++)
            {
                if (i + (value - i) == value)
                {
                    count++;
                }
            }
            Console.WriteLine(count);
            Console.ReadLine();
        }
    }
}


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

public class HQ9
{
    public HQ9()
    {
        int i = 0;
        bool output = false;
        string x = Console.ReadLine().Trim();
        for (i = 0; i < x.Length; i++)
        {
            if (x[i] == 'H' || x[i] == 'Q' || x[i] == '9')
            {
                output = true;
                break;
            }
        }
        Console.WriteLine(output ? "YES" : "NO");
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void swap<T>(ref T a, ref T b)
        {
            T c = a;
            a = b;
            b = c;
        }
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            bool flag = false;
            foreach (char i in str)
            {
                if ((i == 'H') | (i == 'Q') | (i == '9'))
                {
                    Console.WriteLine("YES");
                    flag = !flag;
                    break;
                }
            }
            if (!flag)
                {
                    Console.WriteLine("NO");

                }
            }
            //System.Console.ReadKey();
        }
    }
}


using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        string a = sc.Next();
        string b = sc.Next();
        string c = sc.Next();
        // 0
        if (a[1] == b[1] && b[1] == c[1])
        {
            if (a[0] == b[0] && b[0] == c[0])
            {
                Console.WriteLine(0);
                return;
            }

            int min = Math.Min(a[0], Math.Min(b[0], c[0]));
            int max = Math.Max(a[0], Math.Max(b[0], c[0]));
            int mid = a[0] + b[0] + c[0] - min - max;
            if (min + 1 == mid && mid + 1 == max)
            {
                Console.WriteLine(0);
                return;
            }
        }

        // 1
        if (a[1] == b[1] && Math.Abs(a[0] - b[0]) <= 1)
        {
            Console.WriteLine(1);
            return;
        }

        if (b[1] == c[1] && Math.Abs(b[0] - c[0]) <= 1)
        {
            Console.WriteLine(1);

            return;
        }

        if (c[1] == a[1] && Math.Abs(c[0] - a[0]) <= 1)
        {
            Console.WriteLine(1);

            return;
        }
throw  new Exception();
        Console.WriteLine(2);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace codeforce_mahjong
{
    class Program
    {
        private static int koutsu = 0;
        private static int shuntsu = 0;
        private static string[] suit;
        private static int tiles_needed_koutsu = 4;
        private static int tiles_needed_shuntsu = 4;

        public static int Min(int[] a, int n)
        {
            int min = 10;
            for (int i = 0; i < n; ++i)
            {
                if (min > a[i])
                {
                    min = a[i];
                }
            }
            return min;
        }
        private static void Shuntsu()
        {
            int[] s = new int[10];
            int[] p = new int[10];
            int[] m = new int[10];
            int min = 0;
            int[] numbers = { Int16.Parse(suit[0][0].ToString()), Int16.Parse(suit[1][0].ToString()), Int16.Parse(suit[2][0].ToString()) };
            foreach (String x in suit)
            {
                char c;
                switch (x[1])
                {
                    case 's':
                        s[Int16.Parse(x[0].ToString())]++;
                        break;
                    case 'p':
                        p[Int16.Parse(x[0].ToString())]++;
                        break;
                    case 'm':
                        m[Int16.Parse(x[0].ToString())]++;
                        break;

                }
            }
            min = Min(numbers, 3);

            if (p[min] == 1 && p[min + 1] == 1 && p[min + 2] == 1)
            {
                shuntsu++;
            }
            if (s[min] == 1 && s[min + 1] == 1 && s[min + 2] == 1)
            {
                shuntsu++;
            }
            if (m[min] == 1 && m[min + 1] == 1 && m[min + 2] == 1)
            {
                shuntsu++;
            }

            if (p[min] == 1 && p[min + 1] == 1 || p[min] == 1&& p[min + 2] == 1|| p[min+1] == 1 && p[min + 2] == 1)
            {
                tiles_needed_shuntsu = 1;
            }
            else if (s[min] == 1 && s[min + 1] == 1 || s[min] == 1 && s[min + 2] == 1 || s[min + 1] == 1 && s[min + 2] == 1)
            {
                tiles_needed_shuntsu = 1;
            }
            else if (m[min] == 1 && m[min + 1] == 1 || m[min] == 1 && m[min + 2] == 1 || m[min + 1] == 1 && m[min + 2] == 1)
            {
                tiles_needed_shuntsu = 1;
            }
            else
            {
                if(shuntsu== 0)
                {
                    tiles_needed_shuntsu = 2;
                }
            }
        }
        static void Koutsu()
        {
            bool Ok = false;
            int tiles_needed = 2;
            int k = 0;
            if (suit[0].Equals(suit[1]) && suit[0].Equals(suit[2]))
            {
                koutsu++;
            }
            else
            {
                if (suit[0].Equals(suit[1]) || suit[0].Equals(suit[2]) || suit[1].Equals(suit[2]))
                {
                    tiles_needed = 1;
                }
            }
            if (koutsu == 0)
            {
                tiles_needed_koutsu = tiles_needed;
            }
        }
        static void Main(string[] args)
        {
            suit = Console.ReadLine().Split(' ');

            Thread t1 = new Thread(new ThreadStart(Koutsu));
            t1.Start();
            t1.Join();

            Thread t2 = new Thread(new ThreadStart(Shuntsu));
            t2.Start();
            t2.Join();

            if(shuntsu!=0 ||koutsu!=0)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine((tiles_needed_koutsu < tiles_needed_shuntsu) ? tiles_needed_koutsu : tiles_needed_shuntsu);
            }
        }
    }
}


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

namespace NSproul //1
{
    class Program
    {
        static void Main()
        {
            int[] ins = Console.ReadLine().Split();
			int l = ins[0];
			int d = ins[1];
			int n = ins[2];
			char s = 'L';
			int lout = 0;
			int dout = 0;

            if (n%2 == 0) {
				s = 'R';
				n /= 2;
			}
			else n = (n+1)/2;

			lout = Math.Ceiling(n/d);

			if (n%d == 0) dout = d;
			else dout = n%d;

            Console.WriteLine(lout + " " + dout + " " + s);
        }
    }
}


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

namespace CF752A {
    class Program {
        static void Main(string[] args) {
            string[] inputs = Console.ReadLine().Split(' ');
            int lanes = Convert.ToInt32(inputs[0]);
            int rows = Convert.ToInt32(inputs[1]);
            int seat = Convert.ToInt32(inputs[2]);

            //print 'lane row {l/r}'
            int seatsPerLane = 2 * rows;
            int lane = ((seat - 1) / seatsPerLane) + 1;
            int row = (((seat - ((lane - 1) * seatsPerLane)) + 1) / rows) + 1;

            char side = 'L';
            if (seat % 2 == 0) {
                side = 'R';
            }
            Console.WriteLine(lane + " " + row + " " + side);
        }
    }
}


class Program
{
    static void Main(){
        var n = int.Parse(Console.ReadLine());
            var str = "";
            for(int i = 1; i<5000; i++)
            {
                str += i.ToString();
            }
            Console.WriteLine(str[n]);
    }
}


using System;
class Program
{
    static void Main(){
        var n = int.Parse(Console.ReadLine());
            var str = "";
            for(int i = 1; i<5000; i++)
            {
                str += i.ToString();
            }
            Console.WriteLine(str[n]);
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), a = int.Parse(s[1]), b = int.Parse(s[2]);
            a += (n - 1);
            b += (n - 1);
            if (a > b)
            {
                int c = b;
                b = a;
                a = c;
            }
            for (int i = 1; a != 1; i /= 2)
            {
                if (a % 2 == 0 && b % 2 == 1 && b - a == 1)
                {
                    if (a == 2 && b == 3)
                    {
                        Console.WriteLine("Final!");
                        return;
                    }
                    else
                    {
                        Console.WriteLine(i);
                        return;
                    }
                }
            }
        }
    }
}


using System;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            //FriendsMeeting.FriendsWithBenefits();
            WorldCup.wakaWaka();
        }
    }

    class WorldCup
    {
        public static void wakaWaka()
        {
            int[] inp = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int teamCount = inp[0];
            int roundCount = (int)Math.Log((double)teamCount, 2), iterationCount = 0;
            List<List<int>> roughPaper = new List<List<int>>() { };
            int[] baseArray = new int[teamCount];
            for (int i = 0; i < teamCount; i++)
            {
                baseArray[i] = i;
            }
            roughPaper.Add(baseArray.ToList());
            while(iterationCount < roundCount)
            {
                ++iterationCount;
                roughPaper.Add(roughPaper[iterationCount - 1].Where(x => x != -1).ToList());
                int limit = roughPaper[iterationCount].Count;
                for (int i =0;i< limit;i+=2)
                {
                    if ((roughPaper[iterationCount][i] + 1 == inp[1] || roughPaper[iterationCount][i] + 1 == inp[2]) &&
                        (roughPaper[iterationCount][i + 1] + 1 == inp[1] || roughPaper[iterationCount][i + 1] + 1 == inp[2]))
                    {
                        Console.WriteLine(iterationCount.ToString());
                        //Console.ReadKey();
                        return;
                    }
                    else if ((roughPaper[iterationCount][i] + 1 == inp[1] || roughPaper[iterationCount][i] + 1 == inp[2]))
                    {
                        roughPaper[iterationCount][i + 1] = -1;
                    }
                    else if ((roughPaper[iterationCount][i + 1] + 1 == inp[1] || roughPaper[iterationCount][i + 1] + 1 == inp[2]))
                    {
                        roughPaper[iterationCount][i] = -1;
                    }
                    else
                    {
                        roughPaper[iterationCount][i] = -1;
                    }
                }
            }
            Console.WriteLine("Final!");
            //Console.ReadKey();
        }
    }
}


#define GenericArithmetics
#define Geometrys
#define ASD
#if (Debug)
#define Trace
#endif
#if (ASD)
using DS.Common;
using DS.Dictionaries;
using DS.Graphs;
using DS.Heaps;
using DS.Lists;
using DS.Trees;
using DS;
using AL;
using AL.Common;
using AL.Graphs;
using AL.Numeric;
using AL.Sorting;
#endif
#if (GenericArithmetics)
using GenericArithmetic;
#endif
#if Geometrys
using Geometry;
#endif
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 System.Reflection;
using System.Windows;
using System.Text.RegularExpressions;
using csConsoleforStudy;
using System.Resources;
using System.Runtime.Serialization;
using System.Globalization;
using System.Runtime.InteropServices;

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

  static void OpenStream()
  {
#if (Debug)
#endif
  }

  static void CloseStream()
  {
#if (Debug)
#endif
  }

  static void CheckMemory()
  {
#if (Debug)
#endif
  }
 }

 class Solver
 {
  public static readonly Encoding TargetEncoding = Encoding.Unicode;
  public void Solve()
  {
   int len = ri();
   string cards = rs();
   int R = 0;
   int G = 0;
   int B = 0;
   Tuple<int, int, int> RGB = new Tuple<int, int, int>(R, G, B);
   for (int i = 0; i < len; i++)
   {
    if (cards[i] == 'R')
     R++;
    else if (cards[i] == 'G')
     G++;
    else if (cards[i] == 'B')
     B++;
   }

   RGB = new Tuple<int, int, int>(R, G, B);
   if (R > 1 && G > 1 && B > 1)
   {
    Console.WriteLine("BGR");
    return;
   }

   Console.WriteLine(next(RGB));
  }

  private string check(Tuple<int, int, int> RGB)
  {
   if (RGB.Item1 == 0 && RGB.Item2 == 0)
    return "B";
   else if (RGB.Item1 == 0 && RGB.Item3 == 0)
    return "G";
   else if (RGB.Item2 == 0 && RGB.Item3 == 0)
    return "R";
   else
    return "x";
  }

  private string next(Tuple<int, int, int> RGB)
  {
   if (check(RGB) != "x")
    return check(RGB);
   string str = "";
   if (RGB.Item1 > 0 && RGB.Item2 > 0)
    str += RG(RGB);
   if (RGB.Item1 > 0 && RGB.Item3 > 0)
    str += RB(RGB);
   if (RGB.Item2 > 0 && RGB.Item3 > 0)
    str += GB(RGB);
   if (RGB.Item1 > 1)
    str += RR(RGB);
   if (RGB.Item2 > 1)
    str += GG(RGB);
   if (RGB.Item3 > 1)
    str += BB(RGB);
   string str2 = "";
   if (str.Contains("B"))
    str2 += "B";
   if (str.Contains("G"))
    str2 += "G";
   if (str.Contains("R"))
    str2 += "R";
   return str2;
  }

  private string RG(Tuple<int, int, int> RGB)
  {
   if (check(RGB) == "x")
    RGB = new Tuple<int, int, int>(RGB.Item1 - 1, RGB.Item2 - 1, RGB.Item3 + 1);
   else
   {
    return check(RGB);
   }

   return next(RGB);
  }

  private string RB(Tuple<int, int, int> RGB)
  {
   if (check(RGB) == "x")
    RGB = new Tuple<int, int, int>(RGB.Item1 - 1, RGB.Item2 + 1, RGB.Item3 - 1);
   else
   {
    return check(RGB);
   }

   return next(RGB);
  }

  private string GB(Tuple<int, int, int> RGB)
  {
   if (check(RGB) == "x")
    RGB = new Tuple<int, int, int>(RGB.Item1 + 1, RGB.Item2 - 1, RGB.Item3 - 1);
   else
   {
    return check(RGB);
   }

   return next(RGB);
  }

  private string RR(Tuple<int, int, int> RGB)
  {
   if (check(RGB) == "x")
    RGB = new Tuple<int, int, int>(RGB.Item1 - 1, RGB.Item2, RGB.Item3);
   else
   {
    return check(RGB);
   }

   return next(RGB);
  }

  private string GG(Tuple<int, int, int> RGB)
  {
   if (check(RGB) == "x")
    RGB = new Tuple<int, int, int>(RGB.Item1, RGB.Item2 - 1, RGB.Item3);
   else
   {
    return check(RGB);
   }

   return next(RGB);
  }

  private string BB(Tuple<int, int, int> RGB)
  {
   if (check(RGB) == "x")
    RGB = new Tuple<int, int, int>(RGB.Item1, RGB.Item2, RGB.Item3 - 1);
   else
   {
    return check(RGB);
   }

   return next(RGB);
  }

#region SolverUtils
  private const double AbsoluteError = 1e-10;
  private const double RelativeError = 1e-8;
  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 AE("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, Delegate method)
  {
   method.DynamicInvoke();
  }
#endregion
 }

#if (BigRationals)
#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
#endif
#if (MS)
#endif
#region Exceptions
 [Serializable]
 internal class IOE : InvalidOperationException
 {
  public IOE()
  {
  }

  public IOE(string message): base (message)
  {
  }

  public IOE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected IOE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }

 [Serializable]
 internal class AE : ArgumentException
 {
  public AE()
  {
  }

  public AE(string message): base (message)
  {
  }

  public AE(string message, Exception innerException): base (message, innerException)
  {
  }

  protected AE(SerializationInfo info, StreamingContext context): base (info, context)
  {
  }
 }
#endregion
}

#if GenericArithmetics
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];
#if (ASD)
   Map.Populate(W, H, defaultValue);
#endif
  }

  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
 }
}

#endif
#if Geometrys
namespace Geometry
{
}

#endif
#if (ASD)
#region DataStructures
namespace DS.Common
{
 public static class Comparers
 {
  public static bool IsNumber<T>(this T value)
  {
   if (value is sbyte)
    return true;
   if (value is byte)
    return true;
   if (value is short)
    return true;
   if (value is ushort)
    return true;
   if (value is int)
    return true;
   if (value is uint)
    return true;
   if (value is long)
    return true;
   if (value is ulong)
    return true;
   if (value is float)
    return true;
   if (value is double)
    return true;
   if (value is decimal)
    return true;
   return false;
  }

  public static bool IsEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.Equals(secondValue);
  }

  public static bool IsGreaterThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) > 0;
  }

  public static bool IsLessThan<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return firstValue.CompareTo(secondValue) < 0;
  }

  public static bool IsGreaterThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));
  }

  public static bool IsLessThanOrEqualTo<T>(this T firstValue, T secondValue)where T : IComparable<T>
  {
   return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));
  }
 }

 public static class Helpers
 {
  public static void Swap<T>(this IList<T> list, int firstIndex, int secondIndex)
  {
   if (list.Count < 2 || firstIndex == secondIndex)
    return;
   var temp = list[firstIndex];
   list[firstIndex] = list[secondIndex];
   list[secondIndex] = temp;
  }

  public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')
  {
   if (string.IsNullOrEmpty(text))
    return text;
   int length = text.Length;
   int cTP = newW - length;
   if (cTP < 0)
    throw new AE("New w must be greater than string length.");
   int pL = cTP / 2 + cTP % 2;
   int pR = cTP / 2;
   StringBuilder rB = new StringBuilder(newW);
   for (int i = 0; i < pL; i++)
    rB.Insert(i, fillerCharacter);
   for (int i = 0; i < length; i++)
    rB.Insert(i + pL, text[i]);
   for (int i = newW - pR; i < newW; i++)
    rB.Insert(i, fillerCharacter);
   return rB.ToString();
  }

  public static void Populate<T>(this T[, ] array, int rows, int columns, T defaultValue = default (T))
  {
   for (int i = 0; i < rows; ++i)
   {
    for (int j = 0; j < columns; ++j)
    {
     array[i, j] = defaultValue;
    }
   }
  }
 }
}

namespace DS.Dictionaries
{
}

namespace DS.Graphs
{
}

namespace DS.Hashing
{
}

namespace DS.Heaps
{
 public interface IMaxHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMax();
  T ExtractMax();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMinHeap<T> ToMinHeap();
 }

 public interface IMinHeap<T>
  where T : System.IComparable<T>
 {
  int Count
  {
   get;
  }

  bool IsEmpty
  {
   get;
  }

  void Initialize(System.Collections.Generic.IList<T> newCollection);
  void Add(T heapKey);
  T Peek();
  void RemoveMin();
  T ExtractMin();
  void Clear();
  void RebuildHeap();
  T[] ToArray();
  System.Collections.Generic.List<T> ToList();
  IMaxHeap<T> ToMaxHeap();
 }
}

namespace DS.Lists
{
 public class ArrayList<T> : IEnumerable<T>
 {
  bool DefaultMaxCapacityIsX64 = true;
  bool IsMaximumCapacityReached = false;
  public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;
  public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;
  private readonly T[] _emptyArray = new T[0];
  private const int _defaultCapacity = 8;
  private T[] _collection;
  private int _size
  {
   get;
   set;
  }

  public ArrayList(): this (capacity: 0)
  {
  }

  public ArrayList(int capacity)
  {
   if (capacity < 0)
   {
    throw new ArgumentOutOfRangeException();
   }
   else if (capacity == 0)
   {
    _collection = _emptyArray;
   }
   else
   {
    _collection = new T[capacity];
   }

   _size = 0;
  }

  private void _ensureCapacity(int minCapacity)
  {
   if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)
   {
    int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);
    int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);
    if (newCapacity < minCapacity)
     newCapacity = minCapacity;
    if (newCapacity >= maxCapacity)
    {
     newCapacity = maxCapacity - 1;
     IsMaximumCapacityReached = true;
    }

    this._resizeCapacity(newCapacity);
   }
  }

  private void _resizeCapacity(int newCapacity)
  {
   if (newCapacity != _collection.Length && newCapacity > _size)
   {
    try
    {
     Array.Resize<T>(ref _collection, newCapacity);
    }
    catch (OutOfMemoryException)
    {
     if (DefaultMaxCapacityIsX64 == true)
     {
      DefaultMaxCapacityIsX64 = false;
      _ensureCapacity(newCapacity);
     }

     throw;
    }
   }
  }

  public int Count
  {
   get
   {
    return _size;
   }
  }

  public int Capacity
  {
   get
   {
    return _collection.Length;
   }
  }

  public bool IsEmpty
  {
   get
   {
    return (Count == 0);
   }
  }

  public T First
  {
   get
   {
    return _collection[0];
   }
  }

  public T Last
  {
   get
   {
    return _collection[Count - 1];
   }
  }

  public T this[int index]
  {
   get
   {
    return _collection[index];
   }

   set
   {
    _collection[index] = value;
   }
  }

  public void Add(T dataItem)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   _collection[_size++] = dataItem;
  }

  public void AddRange(IEnumerable<T> elements)
  {
   if (elements == null)
    throw new ArgumentNullException();
   if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (elements.Any())
   {
    _ensureCapacity(_size + elements.Count());
    foreach (var element in elements)
     this.Add(element);
   }
  }

  public void AddRepeatedly(T value, int count)
  {
   if (count < 0)
    throw new ArgumentOutOfRangeException();
   if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)
    throw new OverflowException();
   if (count > 0)
   {
    _ensureCapacity(_size + count);
    for (int i = 0; i < count; i++)
     this.Add(value);
   }
  }

  public void InsertAt(T dataItem, int index)
  {
   if (_size == _collection.Length)
   {
    _ensureCapacity(_size + 1);
   }

   if (index < _size)
   {
    Array.Copy(_collection, index, _collection, index + 1, (_size - index));
   }

   _collection[index] = dataItem;
   _size++;
  }

  public bool Remove(T dataItem)
  {
   int index = IndexOf(dataItem);
   if (index >= 0)
   {
    RemoveAt(index);
    return true;
   }

   return false;
  }

  public void RemoveAt(int index)
  {
   _size--;
   if (index < _size)
   {
    Array.Copy(_collection, index + 1, _collection, index, (_size - index));
   }

   _collection[_size] = default (T);
  }

  public void Clear()
  {
   if (_size > 0)
   {
    _size = 0;
    Array.Clear(_collection, 0, _size);
    _collection = _emptyArray;
   }
  }

  public void Resize(int newSize)
  {
   Resize(newSize, default (T));
  }

  public void Resize(int newSize, T defaultValue)
  {
   int currentSize = this.Count;
   if (newSize < currentSize)
   {
    this._ensureCapacity(newSize);
   }
   else if (newSize > currentSize)
   {
    if (newSize > this._collection.Length)
     this._ensureCapacity(newSize + 1);
    this.AddRange(Enumerable.Repeat<T>(defaultValue, newSize - currentSize));
   }
  }

  public void Reverse()
  {
   Reverse(0, _size);
  }

  public void Reverse(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   Array.Reverse(_collection, startIndex, count);
  }

  public void ForEach(Action<T> action)
  {
   if (action == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    action(_collection[i]);
   }
  }

  public bool Contains(T dataItem)
  {
   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    EqualityComparer<T> comparer = EqualityComparer<T>.Default;
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Contains(T dataItem, IEqualityComparer<T> comparer)
  {
   if (comparer == null)
   {
    throw new ArgumentNullException();
   }

   if ((Object)dataItem == null)
   {
    for (int i = 0; i < _size; ++i)
    {
     if ((Object)_collection[i] == null)
      return true;
    }
   }
   else
   {
    for (int i = 0; i < _size; ++i)
    {
     if (comparer.Equals(_collection[i], dataItem))
      return true;
    }
   }

   return false;
  }

  public bool Exists(Predicate<T> searchMatch)
  {
   return (FindIndex(searchMatch) != -1);
  }

  public int FindIndex(Predicate<T> searchMatch)
  {
   return FindIndex(0, _size, searchMatch);
  }

  public int FindIndex(int startIndex, Predicate<T> searchMatch)
  {
   return FindIndex(startIndex, (_size - startIndex), searchMatch);
  }

  public int FindIndex(int startIndex, int count, Predicate<T> searchMatch)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   int endIndex = startIndex + count;
   for (int index = startIndex; index < endIndex; ++index)
   {
    if (searchMatch(_collection[index]) == true)
     return index;
   }

   return -1;
  }

  public int IndexOf(T dataItem)
  {
   return IndexOf(dataItem, 0, _size);
  }

  public int IndexOf(T dataItem, int startIndex)
  {
   return IndexOf(dataItem, startIndex, _size);
  }

  public int IndexOf(T dataItem, int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   return Array.IndexOf(_collection, dataItem, startIndex, count);
  }

  public T Find(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     return _collection[i];
    }
   }

   return default (T);
  }

  public ArrayList<T> FindAll(Predicate<T> searchMatch)
  {
   if (searchMatch == null)
   {
    throw new ArgumentNullException();
   }

   ArrayList<T> matchedElements = new ArrayList<T>();
   for (int i = 0; i < _size; ++i)
   {
    if (searchMatch(_collection[i]))
    {
     matchedElements.Add(_collection[i]);
    }
   }

   return matchedElements;
  }

  public ArrayList<T> GetRange(int startIndex, int count)
  {
   if (count < 0 || startIndex > (_size - count))
   {
    throw new ArgumentOutOfRangeException();
   }

   var newArrayList = new ArrayList<T>(count);
   Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);
   newArrayList._size = count;
   return newArrayList;
  }

  public T[] ToArray()
  {
   T[] newArray = new T[Count];
   if (Count > 0)
   {
    Array.Copy(_collection, 0, newArray, 0, Count);
   }

   return newArray;
  }

  public List<T> ToList()
  {
   var newList = new List<T>(this.Count);
   if (this.Count > 0)
   {
    for (int i = 0; i < this.Count; ++i)
    {
     newList.Add(_collection[i]);
    }
   }

   return newList;
  }

  public string ToHumanReadable(bool addHeader = false)
  {
   int i = 0;
   string listAsString = string.Empty;
   string preLineIndent = (addHeader == false ? "" : "\t");
   for (i = 0; i < Count; ++i)
   {
    listAsString = String.Format("{0}{1}[{2}] => {3}\r\n", listAsString, preLineIndent, i, _collection[i]);
   }

   if (addHeader == true)
   {
    listAsString = String.Format("ArrayList of count: {0}.\r\n(\r\n{1})", Count, listAsString);
   }

   return listAsString;
  }

  public IEnumerator<T> GetEnumerator()
  {
   for (int i = 0; i < Count; i++)
   {
    yield return _collection[i];
   }
  }

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

namespace DS.Trees
{
}

#endregion
#region Algorithms
namespace AL.Common
{
 public static class Helpers
 {
  public static void Populate<T>(this IList<T> collection, T value)
  {
   if (collection == null)
    return;
   for (int i = 0; i < collection.Count; i++)
   {
    collection[i] = value;
   }
  }
 }
}

namespace AL.Graphs
{
}

namespace AL.Numeric
{
}

namespace AL.Sorting
{
 public static class QuickSorter
 {
  public static void QuickSort<T>(this IList<T> collection, Comparer<T> comparer = null)
  {
   int startIndex = 0;
   int endIndex = collection.Count - 1;
   comparer = comparer ?? Comparer<T>.Default;
   collection.InternalQuickSort(startIndex, endIndex, comparer);
  }

  private static void InternalQuickSort<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   if (leftmostIndex < rightmostIndex)
   {
    int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);
    collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);
    collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);
   }
  }

  private static int InternalPartition<T>(this IList<T> collection, int leftmostIndex, int rightmostIndex, Comparer<T> comparer)
  {
   int wallIndex, pivotIndex;
   pivotIndex = rightmostIndex;
   T pivotValue = collection[pivotIndex];
   wallIndex = leftmostIndex;
   for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)
   {
    if (comparer.Compare(collection[i], pivotValue) <= 0)
    {
     collection.Swap(i, wallIndex);
     wallIndex++;
    }
   }

   collection.Swap(wallIndex, pivotIndex);
   return wallIndex;
  }
 }
}
#endregion
#endif


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

namespace cfround
{
    class Program
    {
        static int rc, gc, bc;

        static void Go(bool[,,] rgb, int r, int g, int b)
        {
            if (r > 201 || g > 201 || b > 201) return;
            rgb[r, g, b] = true;
            if (r > 0 && b > 0) Go(rgb, r - 1, g + 1, b - 1);
            if (r > 0 && g > 0) Go(rgb, r - 1, g - 1, b + 1);
            if (g > 0 && b > 0) Go(rgb, r + 1, g - 1, b - 1);
            if (r > 1) Go(rgb, r - 1, g, b);
            if (g > 1) Go(rgb, r, g - 1, b);
            if (b > 1) Go(rgb, r, g, b - 1);
        }
        static void Main(string[] args)
        {
            Console.ReadLine();
            string cards = Console.ReadLine();
            foreach (char c in cards)
            {
                if (c == 'R') rc++;
                else if (c == 'B') bc++;
                else if (c == 'G') gc++;
            }
            bool[,,] rgb = new bool[201, 201, 201];
            Go(rgb, rc, gc, bc);
            if (rgb[0, 0, 1]) Console.Write('B');
            if (rgb[0, 1, 0]) Console.Write('G');
            if (rgb[1, 0, 0]) Console.Write('R');
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Grade
{
    class Program
    {
        /* Driver program to test above functions */
        public static void Main(String[] args)
        {
            var games = int.Parse(Console.ReadLine());

            if (games <= 1)
            {
                Console.WriteLine(true);
                return;
            }

            var queue = new Queue<int>();
            var winning = int.Parse(Console.ReadLine());
            queue.Enqueue(3);
            queue.Enqueue(3 - winning);

            while (--games > 0)
            {
                var challenger = queue.Dequeue();
                var number = int.Parse(Console.ReadLine());
                if (number == challenger)
                {
                    queue.Enqueue(winning);
                    winning = challenger;
                } else if(number == winning) {
                    queue.Enqueue(challenger);
                } else {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");
        }

        static List<int> factorize(int n)
        {
            var res = new List<int>();
            for (int i = 2; i * i <= n; ++i)
            {
                while (n % i != 0)
                {
                    res.Add(i);
                    n /= i;
                }
            }
            return res;
        }

        // 3^10 - x = 3, n = 10, result = 1
        // x = 3*3 = 9, n = 10/2 = 5, result = 1
        // n is now odd, result = 1*9 = 9, x = 9*9 = 81, n = 5/2 = 2
        // x = 81*81 = 6561, n = 2/1 = 1, result = 9
        // n is now odd, result = 9 * 6561 = 59049, x = 6561*6561, n = 0
        // return result aka 59049
        public static double pow(double x, int n) // O(log N)
        {
            double result = 1;
            while (n > 0)
            {
                if (n % 2 == 1) result *= x;
                x *= x;
                n /= 2;
            }
            return result;
        }

        // a = 16, b = 10
        // r = 16%10 = 6, a = 10, b = 6
        // r = 10%6 = 4, a = 6, b = 4
        // r = 6%4 = 2, a = 4, b = 2
        // r = 4%2 = 0, a = 2, b = 0
        // return 0
        public static int gcd(int a, int b) // O(log A+B)
        {
            while (b > 0)
            {
                int r = a % b;
                a = b;
                b = r;
            }
            return a;
        }

        public static double Fib(int n)
        {
            return 1 / Math.Sqrt(5) * (Math.Pow(((1 + Math.Sqrt(5)) / 2), n) - Math.Pow(((1 - Math.Sqrt(5)) / 2), n));
        }

        public static bool isPrime(int n) // O(log N)
        {
            for (int i = 2; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

    }

}