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

using static System.Math;

namespace FertiLib.Contest.A
{
	public class Solver
	{
		Scanner sr;
		StreamWriter sw;

		bool isMultipleTestCases = true;

		public void Solve()
		{
			var k = sr.ReadInt();
			Console.WriteLine(100 / GCD(k, 100 - k));
		}

		public static long GCD(long a, long b)
		{
			a = Math.Abs(a);
			b = Math.Abs(b);
			while (a > 0)
			{
				b %= a;
				var x = a;
				a = b;
				b = x;
			}
			return b;
		}

		public Solver(Scanner cin, StreamWriter cout)
		{
			this.sr = cin;
			this.sw = cout;
		}

		public void Start()
		{
			int _t = 1;
			if (isMultipleTestCases) _t = sr.ReadInt();
			while (_t-- > 0) Solve();
		}

		public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO");
		public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No");
		public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no");

		public static T SignOutput<T>(int x, T pos, T zero, T neg) => x == 0 ? zero : (x > 0 ? pos : neg);

		public static T[] CreateArray<T>(int n, Func<int, T> func) => Enumerable.Range(0, n).Select(p => func(p)).ToArray();
		public static T[][] CreateArray<T>(int h, int w, Func<int, int, T> func) => Enumerable.Range(0, h).Select(i => Enumerable.Range(0, w).Select(j => func(i, j)).ToArray()).ToArray();
	}

	public static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);
			var cin = new Scanner();
			var solver = new Solver(cin, sw);
			solver.Start();
			Console.Out.Flush();
		}
	}

	public static class Extention
	{
		public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x);

		public static int UpperBound<T>(this IList<T> list, T value) => list.BinarySearch(value, true, 0, list.Count, Comparer<T>.Default);
		public static int LowerBound<T>(this IList<T> list, T value) => list.BinarySearch(value, false, 0, list.Count, Comparer<T>.Default);
		public static int BinarySearch<T>(this IList<T> list, T value, bool isUpperBound, int index, int length, Comparer<T> comparer)
		{
			var ng = index - 1;
			var ok = index + length;
			while (ok - ng > 1)
			{
				var mid = ng + (ok - ng) / 2;
				var res = comparer.Compare(list[mid], value);
				if (res < 0 || (isUpperBound && res == 0)) ng = mid;
				else ok = mid;
			}
			return ok;
		}

		public static bool Chmax<T>(ref this T a, T b) where T : struct, IComparable<T>
		{
			if (a.CompareTo(b) >= 0) return false;
			a = b;
			return true;
		}
		public static bool Chmin<T>(ref this T a, T b) where T : struct, IComparable<T>
		{
			if (a.CompareTo(b) <= 0) return false;
			a = b;
			return true;
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] separator = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Read() => ReadString();

		public string ReadString()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return ReadString();
			i = 0;
			return s[i++];
		}

		public string[] ReadStringArray(int N)
		{
			string[] Array = new string[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadString();
			}
			return Array;
		}

		public int ReadInt() => int.Parse(ReadString());

		public int[] ReadIntArray(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadInt() + add;
			}
			return Array;
		}

		public long ReadLong() => long.Parse(ReadString());

		public long[] ReadLongArray(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadLong() + add;
			}
			return Array;
		}

		public double ReadDouble() => double.Parse(ReadString());

		public double[] ReadDoubleArray(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = ReadDouble() + add;
			}
			return Array;
		}

		public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1));

		public (T1, T2) ReadValue<T1, T2>()
		{
			var inputs = ReadStringArray(2);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			return (v1, v2);
		}

		public (T1, T2, T3) ReadValue<T1, T2, T3>()
		{
			var inputs = ReadStringArray(3);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			return (v1, v2, v3);
		}

		public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>()
		{
			var inputs = ReadStringArray(4);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			return (v1, v2, v3, v4);
		}

		public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>()
		{
			var inputs = ReadStringArray(5);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
			return (v1, v2, v3, v4, v5);
		}

		public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>()
		{
			var inputs = ReadStringArray(6);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
			var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
			return (v1, v2, v3, v4, v5, v6);
		}

		public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>()
		{
			var inputs = ReadStringArray(7);
			var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
			var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
			var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));
			var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));
			var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));
			var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));
			var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));
			return (v1, v2, v3, v4, v5, v6, v7);
		}

		public T1[] ReadValueArray<T1>(int N)
		{
			var v1 = new T1[N];
			for (int i = 0; i < N; i++)
			{
				v1[i] = ReadValue<T1>();
			}
			return v1;
		}

		public (T1[], T2[]) ReadValueArray<T1, T2>(int N)
		{
			var (v1, v2) = (new T1[N], new T2[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2) = ReadValue<T1, T2>();
				v1[i] = t1;
				v2[i] = t2;
			}
			return (v1, v2);
		}

		public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N)
		{
			var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3) = ReadValue<T1, T2, T3>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
			}
			return (v1, v2, v3);
		}

		public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N)
		{
			var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
			}
			return (v1, v2, v3, v4);
		}

		public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N)
		{
			var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
				v5[i] = t5;
			}
			return (v1, v2, v3, v4, v5);
		}

		public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N)
		{
			var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
				v5[i] = t5;
				v6[i] = t6;
			}
			return (v1, v2, v3, v4, v5, v6);
		}

		public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N)
		{
			var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]);
			for (int i = 0; i < N; i++)
			{
				var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>();
				v1[i] = t1;
				v2[i] = t2;
				v3[i] = t3;
				v4[i] = t4;
				v5[i] = t5;
				v6[i] = t6;
				v7[i] = t7;
			}
			return (v1, v2, v3, v4, v5, v6, v7);
		}
	}
}


//http://codeforces.com/contest/622/problem/B
using System;

namespace ECR7PB
{
    class Program
    {
        static void Main(string[] args)
        {
            var time = Console.ReadLine();
            var a = int.Parse(Console.ReadLine());

            var parts = time.Split(':');
            var h = int.Parse(parts[0]);
            var m = int.Parse(parts[1]);

            h += (m + a) / 60;
            h %= 24;
            m = (m + a) % 60;

            Console.WriteLine(h.ToString("00") + ":" + m.ToString("00"));
        }
    }
}


using System;
class Program
{
	static void Main()
	{
		string input = Console.ReadLine(), ans = "no";

		for(int i = 0, count = int.MinValue; i < input.Length; ++i)
		{
			if (input[i] == '0') count++;
			else if(count < 0) count = 0;

			if (count == 6)
			{
				ans = "yes";
				break;
			}
		}
		Console.WriteLine(ans);
	}
}


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

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] cw = { (char)94, (char)62, (char)118, (char)60 };
            char[] ccw = { (char)94, (char)60, (char)118, (char)62 };

            char[] s = Array.ConvertAll(Console.ReadLine().Split(), char.Parse);
            int n = int.Parse(Console.ReadLine());
            n = n % 4;
            int ndxL = Array.IndexOf(ccw, s[0]);
            int ndxR = Array.IndexOf(cw, s[0]);

            for(int i = 0; i < n; i++)
            {
                ndxR += 1;
                ndxL = ndxL + 1;
                if (ndxL >= ccw.Length)
                    ndxL = 0;
                if (ndxR >= cw.Length)
                    ndxR = 0;
            }
            if(cw[ndxR] == ccw[ndxL])
            {
                Console.WriteLine("undefined");
                return;
            }
            if (cw[ndxR] == s[1])
                Console.WriteLine("cw");
            else
                Console.WriteLine("ccw");

            Console.ReadLine();
        }
    }
}


/*
 * Created by SharpDevelop.
 * User: tagirov2
 * Date: 12.10.2015
 * Time: 12:56
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Globalization;

namespace CF325A
{
	class Program
	{
		public static void Main(string[] args)
		{
//			Console.WriteLine("Hello World!");

			// TODO: Implement Functionality Here

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

			string [] s = Console.ReadLine().Trim().Split(' ');
			int [] a = new int [n+2];

			for ( int j=1; j <= n; j++ )
				a [j] = int.Parse (s [j-1]);

			int k=0, i=0;
			for ( i=1; i <= n; i++ )
				if ( a [i] > 0 )
					break;

			for ( ; i <= n; i++ )
				if ( a [i] == a [i-1] && a [i] == 0 )
					;
				else if ( a [i] == 1 )
					k++;
				else if ( a [i-1] == 1 && a [i] == 0 && a [i+1] == 1 )
					k++;

			Console.WriteLine (k);

//			Console.Write("Press any key to continue . . . ");
//			Console.ReadKey(true);
		}
	}
}
//
//Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
//Console.ReadLine().Split(new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries);
//NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
//string [] input = Console.In.ReadToEnd().Split(new char[] {' ', '\t', '\n', '\r'}, StringSplitOptions.RemoveEmptyEntries);


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

class Segtree<T>
{
    int n;
    T[] tree;
    Func<T, T, T> f;
    T exnum;
    public Segtree(int m, Func<T, T, T> f, T ex)
    {
        this.f = f;
        this.exnum = ex;
        n = 1;
        while (n < m) n <<= 1;

        tree = new T[(n << 1) - 1];
        for (int i = 0; i < tree.Length; i++) tree[i] = ex;
    }
    public Segtree(int m, T ini, Func<T, T, T> f, T ex)
    {
        this.f = f;
        this.exnum = ex;
        n = 1;
        while (n < m) n <<= 1;

        tree = new T[(n << 1) - 1];
        for (int i = 0; i < tree.Length; i++) tree[i] = ini;
        for (int i = 0; i < m; ++i) update(i, ini);
    }
    public void update(int j, T x)
    {
        int i = j + n - 1;
        tree[i] = x;
        while (i > 0)
        {
            i = (i - 1) >> 1;
            tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]);
        }
    }
    public T look(int i) { return tree[i + n - 1]; }

    // [s, t]
    public T run(int s, int t) { return query(s, t + 1, 0, 0, n); }
    T query(int s, int t, int k, int l, int r)
    {
        if (r <= s || t <= l) return exnum;
        if (s <= l && r <= t) return tree[k];

        return f(query(s, t, (k << 1) + 1, l, (l + r) >> 1), query(s, t, (k + 1) << 1, (l + r) >> 1, r));
    }
}

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');

            if (n == 1)
            {
                if (int.Parse(input[0]) == 0) Console.WriteLine("UP");
                else if (int.Parse(input[0]) == 15) Console.WriteLine("DOWN");
                else Console.WriteLine(-1);
                return;
            }
            int a = int.Parse(input[n - 2]);
            int b = int.Parse(input[n - 1]);

            if (a == 14 && b == 15) Console.WriteLine("DOWN");
            else if (a == 1 && b == 0) Console.WriteLine("UP");
            else if (a > b) Console.WriteLine("DOWN");
            else if (a < b) Console.WriteLine("UP");

        }
    }
}


using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;

static class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int res = 0;
        bool top = false;
        for (int i = 1; i < a.Length; i++)
        {
            var x = Min(a[i - 1], a[i]);
            var y = Max(a[i - 1], a[i]);
            if (x == 2 && y == 3) goto Infinite;
            if (x == 1 && y == 2) res += top ? 2 : 3;
            if (x == 1 && y == 3) res += 4;
            top = a[i - 1] == 3 && a[i] == 1;
        }
        Console.WriteLine("Finite");
        Console.WriteLine(res);
        return;
    Infinite:;
        Console.WriteLine("Infinite");

    }
}


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

namespace CodeForces
{
    internal class Solution
    {
        const int StackSize = 20 * 1024 * 1024;

        private const int MOD = 1000000000;

        private void No()
        {
            Out.WriteLine("NO");
            return;
        }

        private void Yes()
        {
            Out.WriteLine("YES");
            return;
        }

        private void Solve()
        {
            long k = NextLong();
            string input = k.ToString();
            for (int i = 0; i < input.Length; i++)
            {
                if (input[i] != '1' && input[i] != '4')
                {
                    No();
                    return;
                }

                if (input[i] == '4')
                {
                    if (i == 0)
                    {
                        No();
                        return;
                    }
                    if (i == 1 && input[0] != '1')
                    {
                        No();
                        return;
                    }
                    if (input[i - 1] == '4' && input[i - 2] != '1')
                    {
                        No();
                        return;
                    }
                }
            }
            Yes();
            return;
        }

        #region Local wireup

        public int[] NextIntArray(int size)
        {
            var res = new int[size];
            for (int i = 0; i < size; ++i) res[i] = NextInt();
            return res;
        }

        public long[] NextLongArray(int size)
        {
            var res = new long[size];
            for (int i = 0; i < size; ++i) res[i] = NextLong();
            return res;
        }

        public double[] NextDoubleArray(int size)
        {
            var res = new double[size];
            for (int i = 0; i < size; ++i) res[i] = NextDouble();
            return res;
        }

        public int NextInt()
        {
            return _in.NextInt();
        }

        public long NextLong()
        {
            return _in.NextLong();
        }

        public string NextLine()
        {
            return _in.NextLine();
        }

        public double NextDouble()
        {
            return _in.NextDouble();
        }

        readonly Scanner _in = new Scanner();
        static readonly TextWriter Out = Console.Out;

        void Start()
        {
#if !ONLINE_JUDGE
            var timer = new Stopwatch();
            timer.Start();
#endif
            var t = new Thread(Solve, StackSize);
            t.Start();
            t.Join();
#if !ONLINE_JUDGE
            timer.Stop();
            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Done in {0} seconds.\nPress <Enter> to exit.", timer.ElapsedMilliseconds / 1000.0));
            Console.ReadLine();
#endif
        }

        static void Main()
        {
            new Solution().Start();
        }

        class Scanner : IDisposable
        {
            #region Fields

            readonly TextReader _reader;
            readonly int _bufferSize;
            readonly bool _closeReader;
            readonly char[] _buffer;
            int _length, _pos;

            #endregion

            #region .ctors

            public Scanner(TextReader reader, int bufferSize, bool closeReader)
            {
                _reader = reader;
                _bufferSize = bufferSize;
                _closeReader = closeReader;
                _buffer = new char[_bufferSize];
                FillBuffer(false);
            }

            public Scanner(TextReader reader, bool closeReader) : this(reader, 1 << 16, closeReader) { }

            public Scanner(string fileName) : this(new StreamReader(fileName, Encoding.Default), true) { }

#if ONLINE_JUDGE
            public Scanner() : this( Console.In, false ) { }
#else
            public Scanner() : this("d:\\input.txt") { }
#endif

            #endregion

            #region IDisposable Members

            public void Dispose()
            {
                if (_closeReader)
                {
                    _reader.Close();
                }
            }

            #endregion

            #region Properties

            public bool Eof
            {
                get
                {
                    if (_pos < _length) return false;
                    FillBuffer(false);
                    return _pos >= _length;
                }
            }

            #endregion

            #region Methods

            private char NextChar()
            {
                if (_pos < _length) return _buffer[_pos++];
                FillBuffer(true);
                return _buffer[_pos++];
            }

            private char PeekNextChar()
            {
                if (_pos < _length) return _buffer[_pos];
                FillBuffer(true);
                return _buffer[_pos];
            }

            private void FillBuffer(bool throwOnEof)
            {
                _length = _reader.Read(_buffer, 0, _bufferSize);
                if (throwOnEof && Eof)
                {
                    throw new IOException("Can't read beyond the end of file");
                }
                _pos = 0;
            }

            public int NextInt()
            {
                var neg = false;
                int res = 0;
                SkipWhitespaces();
                if (!Eof && PeekNextChar() == '-')
                {
                    neg = true;
                    _pos++;
                }
                while (!Eof && !IsWhitespace(PeekNextChar()))
                {
                    var c = NextChar();
                    if (c < '0' || c > '9') throw new ArgumentException("Illegal character");
                    res = 10 * res + c - '0';
                }
                return neg ? -res : res;
            }

            public long NextLong()
            {
                var neg = false;
                long res = 0;
                SkipWhitespaces();
                if (!Eof && PeekNextChar() == '-')
                {
                    neg = true;
                    _pos++;
                }
                while (!Eof && !IsWhitespace(PeekNextChar()))
                {
                    var c = NextChar();
                    if (c < '0' || c > '9') throw new ArgumentException("Illegal character");
                    res = 10 * res + c - '0';
                }
                return neg ? -res : res;
            }

            public string NextLine()
            {
                SkipUntilNextLine();
                if (Eof) return "";
                var builder = new StringBuilder();
                while (!Eof && !IsEndOfLine(PeekNextChar()))
                {
                    builder.Append(NextChar());
                }
                return builder.ToString();
            }

            public double NextDouble()
            {
                SkipWhitespaces();
                var builder = new StringBuilder();
                while (!Eof && !IsWhitespace(PeekNextChar()))
                {
                    builder.Append(NextChar());
                }
                return double.Parse(builder.ToString(), CultureInfo.InvariantCulture);
            }

            private void SkipWhitespaces()
            {
                while (!Eof && IsWhitespace(PeekNextChar()))
                {
                    ++_pos;
                }
            }

            private void SkipUntilNextLine()
            {
                while (!Eof && IsEndOfLine(PeekNextChar()))
                {
                    ++_pos;
                }
            }

            private static bool IsWhitespace(char c)
            {
                return c == ' ' || c == '\t' || c == '\n' || c == '\r';
            }

            private static bool IsEndOfLine(char c)
            {
                return c == '\n' || c == '\r';
            }

            #endregion
        }

        #endregion
    }
}


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

namespace A.Olesya_and_Rodion
{
    class Program
    {
        static void Main(string[] args)
        {
            string x = Console.ReadLine();
            int[]numberanddivisible = x.Split(' ').Select(int.Parse).ToArray();
            List<int> answer = new List<int>();
            for (int i = 0; i < numberanddivisible[0]; i++)
            {
                if (i == 0)
                {
                    if (numberanddivisible[1]==10)
                    {
                        answer.Add(1);
                    }
                    else
                    answer.Add(numberanddivisible[1]);
                }
                else
                    answer.Add(0);
            }
            if (numberanddivisible[1]==10 && numberanddivisible[0]==1)
            {
                Console.WriteLine("-1");
            }
            else
            {

            for (int i = 0; i < answer.Count; i++)
            {
             Console.Write(answer[i]);
            }
            }
            Console.ReadLine();
        }
    }
}


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

public class Solver
{
    public void Solve()
    {
        int a = ReadInt();
        int b = ReadInt();
        var ans = new int[3];
        for (int i = 1; i < 7; i++)
        {
            if (Math.Abs(a - i) < Math.Abs(b - i))
                ans[0]++;
            if (Math.Abs(a - i) == Math.Abs(b - i))
                ans[1]++;
            if (Math.Abs(a - i) > Math.Abs(b - i))
                ans[2]++;
        }

        WriteArray(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
//            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
//            thread.Start();
//            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

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


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

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt32(Console.ReadLine());

            long a = Convert.ToInt32(Console.ReadLine());

            long b = Convert.ToInt32(Console.ReadLine());

            for(long x = 0; x <= n; x++)
            {
                long c = n - a * x;

                if (c < 0)
                {
                    break;
                }

                if (c % b == 0)
                {
                    long y = c / b;
                    Console.WriteLine("YES\n" + x + " " + y);
                    return;
                }
            }

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


using System;

namespace NetCore
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] arr = new int[n];
            for(int i = 0; i < n; i++)
            {
                arr[i] = int.Parse(Console.ReadLine());
            }
            bool valid = false;
            int mx = (1 << n);
            for(int i = 0; i < mx; i++)
            {
                int sum = 0;
                int j = 1;
                int counter = 0;
                while(counter < n)
                {
                    if ((j & i) != 0) sum += arr[counter];
                    else sum -= arr[counter];
                    counter++;
                    j <<= 1;
                    sum %= 360;
                }
                if (sum == 0) valid = true;
            }
            Console.WriteLine(valid ? "YES" : "NO");
        }
    }
}


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

namespace ALGORITM_CodeForces
{
    class Program
    {
        static void Main()
        {
            string s = Console.ReadLine();
            var n = Convert.ToInt64(s.Split(' ')[0]);
            var k = Convert.ToInt64(s.Split(' ')[1]);

            Console.WriteLine(To(1,n,n,k,n));
            Console.WriteLine();
        }
        static long To(long left,long right,long cur,long y,long x)
        {
            long final;
            long y1=1;
            long mid = left + (right - left) / 2;
            long plus = mid;
            long t = mid;
            while ((t/y)!=0)
            {
                t = mid / (y1=y1*y);
                plus = plus + t;

            }

            if ((mid==left) && (left==right))

                return mid;

            else if (plus < cur)
            {
               final = To(mid+1, right, cur,y,x);
            }
            else
            {

               final=To(left, mid, cur,y,x);

            }
            return final;
        }
    }
}


using System;

namespace ConsoleApp5
{

    class Program
    {

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

            Console.Write(n/2 +1);
            Console.ReadLine();

        }
    }
}


using System;
using System.Linq;

namespace CF_141A
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine();
            s += Console.ReadLine();
            var sRes = Console.ReadLine();
            var s1 = s.OrderBy(x => x).ToList().Aggregate("", (current, t) => current + t);
            var s2 = sRes.OrderBy(x => x).ToList().Aggregate("", (current, t) => current + t);
            Console.WriteLine(string.Compare(s1, s2) == 0 ? "YES" : "NO");
        }
    }
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int maxV = N*5*4;
		bool[][] vis = new bool[maxV][];
		for(int i=0;i<maxV;i++)vis[i] = new bool[maxV];

		HashSet<long> H = new HashSet<long>();
		H.Add(enc(maxV/2,maxV/2,0));
		for(int i=0;i<N;i++){
			HashSet<long> nxt = new HashSet<long>();
			foreach(var trc in H){
				var r = decR(trc);
				var c = decC(trc);
				var t = decT(trc);
				for(int j=1;j<=A[i];j++){
					var nr = r + dy[t]*j;
					var nc = c + dx[t]*j;
					vis[nr][nc] = true;
				}
				nxt.Add(enc(r + dy[t]*A[i], c + dx[t]*A[i], (t+1)%8));
				nxt.Add(enc(r + dy[t]*A[i], c + dx[t]*A[i], (t+7)%8));
			}
			H = nxt;
		}

		int ans = 0;
		for(int i=0;i<maxV;i++){
			for(int j=0;j<maxV;j++){
				if(vis[i][j]) ans++;
			}
		}

		Console.WriteLine(ans);

	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	int[] dy = new int[] {0,1,1,1,0,-1,-1,-1};
	int[] dx = new int[] {1,1,0,-1,-1,-1,0,1};

	long mod = (long)1e4;
	long mod2= (long)1e8;
	long enc(long r, long c, long t){ return t*mod2 + r*mod + c; }
	int decR(long trc){ return (int) ((trc % mod2 )/ mod); }
	int decC(long trc){ return (int) (trc % mod); }
	int decT(long trc){ return (int) (trc / mod2); }

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string a = s.Split('+', '=')[0];
            string b = s.Split('+', '=')[1];
            string c = s.Split('+', '=')[2];

            if (a.Length + b.Length == c.Length)
            {
                Console.WriteLine(s);
            }
            else if (a.Length + b.Length - c.Length == -2)
            {
                b += "|";
                c = c.Remove(c.Length - 1);
                Console.WriteLine("{0}+{1}={2}", a, b, c);
            }
            else if (a.Length + b.Length - c.Length == 2)
            {
                c += "|";
                if (a.Length == 1)
                {
                    b = b.Remove(b.Length - 1);
                }
                else
                {
                    a = a.Remove(a.Length - 1);
                }
                Console.WriteLine("{0}+{1}={2}", a, b, c);
            }
            else
            {
                Console.WriteLine("Impossible");
            }
        }
    }
}


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

namespace Links_and_Pearls
{
    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)
        {
            writer.WriteLine(Solve(args) ? "Yes" : "No");
            writer.Flush();
        }

        private static bool Solve(string[] args)
        {
            string s = reader.ReadLine();

            int l = s.Count(c => c == '-');

            return s.Length - l == 0 || l%(s.Length - l) == 0;
        }
    }
}


//

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

namespace sar_cs
{
    public class Program
    {
        public class Parser
        {
            const int BufSize = 25000;
            TextReader s;
            char[] buf = new char[BufSize];
            int bufPos;
            int bufDataSize;
            bool eos;   // eos read to buffer
            int lastChar = -2;
            int nextChar = -2;
            StringBuilder sb = new StringBuilder();

            void FillBuf()
            {
                if (eos) return;
                bufDataSize = s.Read(buf, 0, BufSize);
                if (bufDataSize == 0) eos = true;
                bufPos = 0;
            }

            int Read()
            {
                if (nextChar != -2)
                {
                    lastChar = nextChar;
                    nextChar = -2;
                }
                else
                {
                    if (bufPos == bufDataSize) FillBuf();
                    if (eos) lastChar = -1;
                    else lastChar = buf[bufPos++];
                }
                return lastChar;
            }

            void Back()
            {
                if (lastChar == -2) throw new Exception();  // no chars were ever read
                nextChar = lastChar;
            }

            public Parser()
            {
                s = Console.In;
            }

            public int ReadInt()
            {
                int res = 0;
                int sign = -1;
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));
                if (c == '-')
                {
                    sign = -sign;
                    c = Read();
                }
                int len = 0;
                while (c >= 0 && !char.IsWhiteSpace((char)c))
                {
                    if ((uint)(c -= 48) >= 10) throw new InvalidDataException();
                    len++;
                    res = checked(res * 10 - c);
                    c = Read();
                }
                if (len == 0) throw new InvalidDataException();
                Back();
                return checked(res * sign);
            }

            public int ReadLnInt()
            {
                int res = ReadInt(); ReadLine(); return res;
            }

            public long ReadLong()
            {
                long res = 0;
                int sign = -1;
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));
                if (c == '-')
                {
                    sign = -sign;
                    c = Read();
                }
                int len = 0;
                checked
                {
                    while (c >= 0 && !char.IsWhiteSpace((char)c))
                    {
                        if ((uint)(c -= 48) >= 10) throw new InvalidDataException();
                        len++;
                        res = res * 10 - c;
                        c = Read();
                    }
                    if (len == 0) throw new InvalidDataException();
                    Back();
                    return res * sign;
                }
            }

            public long ReadLnLong()
            {
                long res = ReadInt(); ReadLine(); return res;
            }

            public double ReadDouble()
            {
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));

                int sign = 1;
                if (c == '-')
                {
                    sign = -1;
                    c = Read();
                }

                sb.Length = 0;
                while (c >= 0 && !char.IsWhiteSpace((char)c))
                {
                    sb.Append((char)c);
                    c = Read();
                }

                Back();
                double res = double.Parse(sb.ToString(), CultureInfo.InvariantCulture);
                return res * sign;
            }

            public string ReadLine()
            {
                int c = Read();
                sb.Length = 0;
                while (c != -1 && c != 13 && c != 10)
                {
                    sb.Append((char)c);
                    c = Read();
                }
                if (c == 13)
                {
                    c = Read();
                    if (c != 10) Back();
                }
                return sb.ToString();
            }

            public bool EOF
            {
                get
                {
                    if (Read() == -1) return true;
                    Back();
                    return false;
                }
            }

            public bool SeekEOF
            {
                get
                {
                L0:
                    int c = Read();
                    if (c == -1) return true;
                    if (char.IsWhiteSpace((char)c)) goto L0;
                    Back();
                    return false;
                }
            }
        }

        static void pe()
        {
            Console.WriteLine("???");
            Environment.Exit(0);
        }

        static void re()
        {
            Environment.Exit(55);
        }

        static int nosol()
        {
            Console.WriteLine("ERROR");
            return 0;
        }

        static Stopwatch sw = Stopwatch.StartNew();

        static StringBuilder sb = new StringBuilder();
        static Random rand = new Random(52345235);

        static void Swap<T>(ref T a, ref T b)
        {
            T t = a;
            a = b;
            b = t;
        }

        static char[] suits = { 'C', 'D', 'H', 'S' };
        static char[] values = { '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A' };

        struct Pos
        {
            public int Y, X;
        }

        struct Joker
        {
            public string Name;
            public int Y, X;
        }

        static int h, w;
        static string[,] map;

        static bool Square_SameSuit(int y, int x)
        {
            char suit = '\0';
            for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++)
                {
                    if (suit == '\0') suit = map[y + i, x + j][1];
                    else if (suit != map[y + i, x + j][1]) return false;
                }
            return true;
        }

        static bool Square_DistinctValues(int y, int x)
        {
            bool[] usedValues = new bool[values.Length];
            for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++)
                {
                    int value = Array.IndexOf<char>(values, map[y + i, x + j][0]);
                    if (value < 0) pe();
                    if (usedValues[value]) return false;
                    usedValues[value] = true;
                }
            return true;
        }

        static bool CheckSquareCombinations(out int y1, out int x1, out int y2, out int x2)
        {
            x1 = y2 = x2 = 0;
            for (y1 = 0; y1 < h - 2; y1++)
                for (x1 = 0; x1 < w - 2; x1++)
                    if (Square_DistinctValues(y1, x1) || Square_SameSuit(y1, x1))
                        for (y2 = 0; y2 < h - 2; y2++)
                            for (x2 = 0; x2 < w - 2; x2++)
                                if (x1 + 3 <= x2 || x2 + 3 <= x1 || y1 + 3 <= y2 || y2 + 3 <= y1)
                                    if (Square_DistinctValues(y2, x2) || Square_SameSuit(y2, x2))
                                        return true;
            return false;
        }

        static int Main(string[] args)
        {
            //MyStructs.BigNum.Test(); return 0;
            //Console.SetIn(File.OpenText("_input"));
            var parser = new Parser();

            while (!parser.SeekEOF)
            {
                var koloda = new HashSet<string>();
                for (int i = 0; i < suits.Length; i++)
                    for (int j = 0; j < values.Length; j++)
                        koloda.Add(values[j].ToString() + suits[i]);

                h = parser.ReadInt();
                w = parser.ReadLnInt();
                map = new string[h, w];
                var jokers = new List<Joker>();
                for (int i = 0; i < h; i++)
                {
                    var ss = parser.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (ss.Length != w) pe();
                    for (int j = 0; j < w; j++)
                    {
                        map[i, j] = ss[j];
                        if (ss[j] == "J1" || ss[j] == "J2") jokers.Add(new Joker { Name = ss[j], Y = i, X = j });
                        else if (!koloda.Remove(ss[j])) pe();
                    }
                }

                string res = null;
                int x1 = 0, y1 = 0, x2 = 0, y2 = 0;

                if (jokers.Count == 0)
                {
                    if (CheckSquareCombinations(out y1, out x1, out y2, out x2)) res = "There are no jokers.";
                }
                else if (jokers.Count == 1)
                {
                    foreach (var c in koloda)
                    {
                        map[jokers[0].Y, jokers[0].X] = c;
                        if (CheckSquareCombinations(out y1, out x1, out y2, out x2))
                        {
                            res = string.Format("Replace {0} with {1}.", jokers[0].Name, c);
                            goto k0;
                        }
                    }
                }
                else if (jokers.Count == 2)
                {
                    jokers.Sort((j1, j2) => j1.Name.CompareTo(j2.Name));
                    foreach (var c1 in koloda)
                        foreach (var c2 in koloda)
                            if (c1 != c2)
                            {
                                map[jokers[0].Y, jokers[0].X] = c1;
                                map[jokers[1].Y, jokers[1].X] = c2;
                                if (CheckSquareCombinations(out y1, out x1, out y2, out x2))
                                {
                                    res = string.Format("Replace J1 with {0} and J2 with {1}.", c1, c2);
                                    goto k0;
                                }
                            }
                }
                else pe();

            k0: ;
                if (res == null)
                    Console.WriteLine("No solution.");
                else
                {
                    Console.WriteLine("Solution exists.");
                    Console.WriteLine(res);
                    Console.WriteLine(string.Format("Put the first square to ({0}, {1}).", y1 + 1, x1 + 1));
                    Console.WriteLine(string.Format("Put the second square to ({0}, {1}).", y2 + 1, x2 + 1));
                }
                //Console.WriteLine();
            }

            return 0;
        }
    }
}


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

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			//string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			//var inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
			//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs3 = input3.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();

			long n = long.Parse(input1);

			int length = input1.Length;
			if (length < 2)
			{
				Console.WriteLine(n);
				return;
			}

			long copyN = n;
			while (copyN % 10 == 0)
			{
				copyN--;
			}
			long max = 1;
			while (copyN > 0)
			{
				max *= copyN % 10;
				copyN /= 10;
			}

			for (int i = 1; i < length; i++)
			{
				copyN = n;
				long current = 0;
				for (int j = 0; j < i; j++)
				{
					current += 9 * (long)Math.Pow(10, j);
				}

				var temp = copyN - current;
				temp /= (long)Math.Pow(10, i);
				current += temp * (long)Math.Pow(10, i);

				long currentMax = 1;
				while (current > 0)
				{
					currentMax *= current % 10;
					current /= 10;
				}

				if (currentMax > max)
				{
					max = currentMax;
				}
			}

			Console.WriteLine(max);
		}

		static long Factorial(long a)
		{
			return a > 1 ? a * Factorial(a - 1) : 1;
		}
	}
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace Program {
    class MainClass {
        ////////////////////////////////////////////////////////////
        int N, K, T;
        void Solve() {
            io.i(out N, out K,out T);
            int ans = 0;
            if(T<=K){
                ans = Math.Min(N, T);
            }else if( N-T >= 0){
                ans = Math.Min(N, K);
            }else{
                ans = Math.Max(0, K - (T-N));
            }
            io.o(ans);
        }
        ////////////////////////////////////////////////////////////
        public static void Main() { new MainClass().Stream(); }
        IO io = new IO();
        void Stream() { Solve(); io.writeFlush(); }
        //void Stream() { Test(); io.writeFlush(); }
        void Test() { }
        #region MockMacro
        //cannot use break,continue,goto
        void FOR(int a, int b, Action<int> act) { for (int i = a; i < b; ++i) act(i); }
        void FORR(int a, int b, Action<int> act) { for (int i = a - 1; i >= b; --i) act(i); }
        #endregion
        ////////////////////////////////////////////////////////////
    }
    #region default
    class IO {
        TYPE tp;
        string[] nextBuffer; int BufferCnt; char[] cs = new char[] { ' ' };
        StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        public IO() { nextBuffer = new string[0]; BufferCnt = 0; Console.SetOut(sw); tp = new TYPE(); }
        public string Next() {
            if (BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            BufferCnt = 0;
            return nextBuffer[BufferCnt++];
        }
        public string String => Next();
        public char Char => char.Parse(String);
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string[] arr => Console.ReadLine().Split(' ');
        public char[] arrChar => Array.ConvertAll(arr, char.Parse);
        public int[] arrInt => Array.ConvertAll(arr, int.Parse);
        public long[] arrLong => Array.ConvertAll(arr, long.Parse);
        public double[] arrDouble => Array.ConvertAll(arr, double.Parse);
        public T i<T>() { return tp.suitType<T>(String); }
        public void i<T>(out T v) { v = tp.suitType<T>(String); }
        public void i<T, U>(out T v1, out U v2) { i(out v1); i(out v2); }
        public void i<T, U, V>(out T v1, out U v2, out V v3) { i(out v1); i(out v2); i(out v3); }
        public void i<T, U, V, W>(out T v1, out U v2, out V v3, out W v4) {
            i(out v1); i(out v2); i(out v3); i(out v4);
        }
        public void i<T, U, V, W, X>(out T v1, out U v2, out V v3, out W v4, out X v5) {
            i(out v1); i(out v2); i(out v3); i(out v4); i(out v5);
        }
        public void ini<T>(out T[] a, int n) { a = new T[n]; for (int i = 0; i < n; i++) a[i] = tp.suitType<T>(String); }
        public void ini<T, U>(out T[] a, out U[] b, int n) {
            a = new T[n]; b = new U[n]; for (int i = 0; i < n; i++) { a[i] = i<T>(); b[i] = i<U>(); }
        }
        public void ini<T, U, V>(out T[] a, out U[] b, out V[] c, int n) {
            a = new T[n]; b = new U[n]; c = new V[n];
            for (int i = 0; i < n; i++) { a[i] = i<T>(); b[i] = i<U>(); c[i] = i<V>(); }
        }
        public void ini<T>(out T[,] a, int h, int w) {
            a = new T[h, w]; for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) a[i, j] = i<T>();
        }
        public void o<T>(T v) { Console.WriteLine(v); }
        public void o<T>(params T[] a) { Array.ForEach(a, n => o(n)); }
        public void o<T>(T[,] a) { a.GetLength(0).REP(i => { a.GetLength(1).REP(j => or(a[i, j] + " ")); br(); }); }
        public void ol<T>(T v) { Console.Write(v + " "); }
        public void ol<T>(params T[] a) { o(connect<T>(a)); }
        public void or<T>(T a) { Console.Write(a); }
        public void br() { o(""); }
        public void writeFlush() { Console.Out.Flush(); }
        private string connect<T>(params T[] s) { return string.Join(" ", s); }
    }
    class TYPE {
        public bool typeEQ<T, U>() { return typeof(T).Equals(typeof(U)); }
        public T convertType<T, U>(U v) { return (T)Convert.ChangeType(v, typeof(T)); }
        public T suitType<T>(string s) {
            if (typeEQ<T, int>()) return convertType<T, int>(int.Parse(s));
            if (typeEQ<T, long>()) return convertType<T, long>(long.Parse(s));
            if (typeEQ<T, double>()) return convertType<T, double>(double.Parse(s));
            if (typeEQ<T, char>()) return convertType<T, char>(char.Parse(s));
            return convertType<T, string>(s);
        }
    }
    class PQueue<T> where T : IComparable {
        public List<T> heap; private Comparison<T> comp; private IComparer<T> comparer;
        private int size; private int type;//type=0->min
        public PQueue(int type = 0) : this(Comparer<T>.Default) { this.type = type; }
        public PQueue(IComparer<T> comparer) : this(16, comparer.Compare) { this.comparer = comparer; }
        public PQueue(Comparison<T> comparison) : this(16, comparison) { }
        public PQueue(int capacity, Comparison<T> comparison) { this.heap = new List<T>(capacity); this.comp = comparison; }
        public void Enqueue(T item) {
            this.heap.Add(item); var i = size++;
            while (i > 0) { var p = (i - 1) >> 1; if (Compare(this.heap[p], item) <= 0) break; this.heap[i] = heap[p]; i = p; }
            this.heap[i] = item;
        }
        public T Dequeue() {
            var ret = this.heap[0]; var x = this.heap[--size]; var i = 0;
            while ((i << 1) + 1 < size) {
                var a = (i << 1) + 1; var b = (i << 1) + 2; if (b < size && Compare(heap[b], heap[a]) < 0) a = b;
                if (Compare(heap[a], x) >= 0) break; heap[i] = heap[a]; i = a;
            }
            heap[i] = x; heap.RemoveAt(size);
            return ret;
        }
        public T Peek() { return heap[0]; }
        public int Count { get { return size; } }
        public bool Any() { return size > 0; }
        public bool Empty() { return !Any(); }
        public bool Contains(T v) { return heap.Contains(v); }
        private int Compare(T x, T y) { return type == 0 ? x.CompareTo(y) : y.CompareTo(x); }
    }
    #endregion
    #region other
    class Mat {
        public long mod = 1000000007;//10^9+7
        public long Pow(long a, long b) {
            if (b == 0) return 1;
            if (b % 2 == 1) return (a % mod * Pow(a % mod, b - 1) % mod) % mod;
            else return Pow(a * a % mod, b / 2) % mod;
        }
        public long Fact(long n) { long ret = 1; for (long i = 1; i <= n; i++) ret = (ret * i) % mod; return ret; }
        public long ModC(long n, long r) {
            if (r == 0 || n == r) return 1;
            if (n == 0) return 0;
            if (n < 0 || n < r) throw new ArgumentException("n,r invalid");
            else return (Fact(n) % mod * Pow((Fact(n - r) % mod * Fact(r) % mod) % mod, mod - 2) % mod) % mod;
        }
        public long[,] C(int N) {
            long[,] Co = new long[N + 1, N + 1];
            (N + 1).REP(i => (i + 1).REP(j => Co[i, j] = (j == 0 || j == i) ? 1L : Co[i - 1, j - 1] + Co[i - 1, j]));
            return Co;
        }
        public long DupC(long n, long r) { return ModC(n + r - 1, r); }
        public long P(long n, long r) { return Fact(n) / (Fact(n - r)); }//test
        public bool isPrime(long n) {
            if (n == 2) return true; if (n < 2 || n % 2 == 0) return false;
            for (long v = 3; v <= (long)Math.Sqrt(n); v += 2) if (n % v == 0) return false;
            return true;
        }
        public long LCM(long a, long b) { return a * (b / GCD(a, b)); }
        public long LCM(params long[] a) { return a.Aggregate((v, n) => LCM(v, n)); }
        public long GCD(long a, long b) { if (a < b) Swap(ref a, ref b); return b == 0 ? a : GCD(b, a % b); }
        public long GCD(params long[] array) { return array.Aggregate((v, n) => GCD(v, n)); }
        public T Max<T>(params T[] a) { return a.Max(); }
        public T Min<T>(params T[] a) { return a.Min(); }
        public void Swap<T>(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }
        public double Dis(int x1, int y1, int x2, int y2) { return Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2)); }
        public int mDis(int x1, int y1, int x2, int y2) { return Math.Abs(x1 - x2) + Math.Abs(y1 - y2); }
        public int[] DigArr(int n) { int[] ret = new int[Digit(n)]; ret.Length.REP(i => ret[i] = DigVal(n, i + 1)); return ret; }
        public long DigArr2Num(IEnumerable<int> enu) { return enu.Aggregate((v, n) => v * 10 + n); }
        public int Digit(long n) { return (n == 0) ? 1 : (int)Math.Log10(n) + 1; }
        public int DigVal(int n, int dig) { return (n % (int)Pow(10, dig)) / (int)Pow(10, dig - 1); }
        public long Tousa(long a, long d, long n) { return a + (n - 1) * d; }
        public long TousaSum(long a, long d, long n) { return n * (2 * a + (n - 1) * d) / 2; }
        public long[] enuDivsor(long N) {
            var ret = new SortedSet<long>();
            for (long i = 1; i * i <= N; i++)
                if (N % i == 0) { ret.Add(i); ret.Add(N / i); }
            return ret.ToArray();
        }
        public IEnumerable<int[]> enuP(int[] Arr, int Use = -1) {//列挙順列
            Use = (Use != -1) ? Use : Arr.Length; if (Use == 0 || Arr.Length < Use) yield break;
            var s = new Stack<List<int>>();
            Arr.Length.REPR(i => s.Push(new List<int>() { i }));
            while (s.Count > 0) {
                var cur = s.Pop();
                if (cur.Count == Use) {
                    var ret = new List<int>(); cur.ForEach(X => ret.Add(Arr[X]));
                    yield return ret.ToArray();
                } else
                    Arr.Length.REPR(i => { if (!cur.Contains(i)) s.Push(new List<int>(cur) { i }); });
            }
        }
        public IEnumerable<int[]> enuC(int[] Arr, int Use = -1) {//列挙組み合わせ
            Use = (Use != -1) ? Use : Arr.Length; if (Use == 0 || Arr.Length < Use) yield break;
            var s = new Stack<Tuple<int, List<int>>>();
            Arr.Length.REPR(i => s.Push(Tuple.Create(i, new List<int>() { Arr[i] })));
            while (s.Count > 0) {
                var cur = s.Pop();
                if (cur.Item2.Count == Use) yield return cur.Item2.ToArray();
                else for (int i = Arr.GetUpperBound(0); i > cur.Item1; i--)
                        s.Push(Tuple.Create(i, new List<int>(cur.Item2) { Arr[i] }));
            }
        }
        public IEnumerable<int[]> enuDupP(int[] Arr, int Use = -1) {//列挙重複順列
            Use = (Use != -1) ? Use : Arr.Length; if (Use == 0) yield break; var s = new Stack<List<int>>();
            Arr.Length.REPR(i => s.Push(new List<int>() { Arr[i] }));
            while (s.Count > 0) {
                var cur = s.Pop();
                if (cur.Count == Use) yield return cur.ToArray();
                else Arr.Length.REPR(i => s.Push(new List<int>(cur) { Arr[i] }));
            }
        }
        public IEnumerable<int[]> enuDupC(int[] Arr, int Use = -1) {//列挙組み合わせ
            Use = (Use != -1) ? Use : Arr.Length; if (Use == 0) yield break;
            var s = new Stack<Tuple<int, List<int>>>();
            Arr.Length.REPR(i => s.Push(Tuple.Create(i, new List<int>() { Arr[i] })));
            while (s.Count > 0) {
                var cur = s.Pop();
                if (cur.Item2.Count == Use) yield return cur.Item2.ToArray();
                else for (int i = Arr.GetUpperBound(0); i >= cur.Item1; i--)
                        s.Push(Tuple.Create(i, new List<int>(cur.Item2) { Arr[i] }));
            }
        }
        public IEnumerable<long[]> enuPart(string str) {
            var s = new Stack<Tuple<string, List<long>, int>>();
            s.Push(Tuple.Create(str[0].ToString(), new List<long>(), 1));
            while (s.Count > 0) {
                var cur = s.Pop();
                if (cur.Item3 >= str.Length) yield return (new List<long>(cur.Item2) { cur.Item1.toLong() }).ToArray();
                else {
                    s.Push(Tuple.Create(cur.Item1 + str[cur.Item3], new List<long>(cur.Item2), cur.Item3 + 1));
                    s.Push(Tuple.Create(str[cur.Item3].ToString(), new List<long>(cur.Item2) { cur.Item1.toLong() }, cur.Item3 + 1));
                }
            }
        }
    }
    class Time {
        public int[] M = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
        public int[] D = { 31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        public Time() { D[1] = 28; }
        public Time(int y) { D[1] = isLeapYear(y) ? 29 : 28; }
        public bool isLeapYear(int y) { return (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)); }
    }
    #endregion
    #region Data
    class AssociativeArray<T> : IEnumerable {
        public Dictionary<T, int> dic;
        public AssociativeArray() { dic = new Dictionary<T, int>(); }
        public AssociativeArray(params T[] a) { dic = new Dictionary<T, int>(); Add(a); }
        public void Add(T a) { if (!conK(a)) dic[a] = 0; dic[a]++; }
        public void Add(params T[] a) { a.Length.REP(i => { if (!conK(a[i])) dic[a[i]] = 0; dic[a[i]]++; }); }
        public void Set(T k, int v) { if (!dic.ContainsKey(k)) dic[k] = 0; dic[k] = v; }
        public void Remove(params T[] a) { a.Length.REP(i => { if (conK(a[i])) dic.Remove(a[i]); }); }
        public T[] Keys() { return dic.Keys.ToArray<T>(); }
        public int Val(T k) { return (dic.ContainsKey(k)) ? dic[k] : 0; }
        public int ValSum => dic.Values.Sum();
        public int KeyNum => dic.Keys.Count;
        public int MaxVal => dic.Values.Max();
        public int MinVal => dic.Values.Min();
        public T MaxKey => MaxK();
        public T MinKey => MinK();
        public T MaxK() { var maxV = MaxVal; return dic.First(d => d.Value == maxV).Key; }
        public T MinK() { var minV = MinVal; return dic.First(d => d.Value == minV).Key; }
        public bool conK(T k) { return dic.ContainsKey(k); }
        public bool anyK(params T[] k) { return k.Any(key => conK(key)); }
        public bool allK(params T[] k) { return k.All(key => conK(key)); }
        public void Show() { foreach (var v in dic) { Console.WriteLine(v.Key + " : " + v.Value); } }
        public IEnumerator GetEnumerator() { foreach (var kp in dic) yield return kp; }
        public T[] ValueSortedKey(bool inc = true) {//test
            return (inc ? (dic.OrderBy(kp => kp.Value)) : (dic.OrderByDescending(kp => kp.Value)))
                .ThenBy(kp => kp.Key).ToDictionary(kp => kp.Key, kp => kp.Value).Keys.ToArray();
        }
        //:sort->array
    }
    class Index {
        public int[] Comp(int[] bef) {
            int[] aft = new int[bef.Length];
            var tmp = bef.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);
            aft = bef.Select(v => tmp[v]).ToArray();
            return aft;
        }
    }
    class TreeDis {//TODO:shortestPath
        public List<Tuple<long, long>>[] g; public long[] a2other; private int type;
        public TreeDis(int type = 0) { this.type = type; }//0->bfs,other->dfs
        public void Init(long n) { g = new List<Tuple<long, long>>[n + 1]; g.Length.REP(i => g[i] = new List<Tuple<long, long>>()); }
        public void Run(long[] a, long[] b) { a.Length.REP(i => { g[a[i]].Add(Tuple.Create(b[i], 1L)); g[b[i]].Add(Tuple.Create(a[i], 1L)); }); }
        public void Run(long[] a, long[] b, long[] w) { a.Length.REP(i => { g[a[i]].Add(Tuple.Create(b[i], w[i])); g[b[i]].Add(Tuple.Create(a[i], w[i])); }); }
        public long[] a2iArr(long a) { a2other = new long[g.Count()]; if (type == 0) BFS(a); else DFS(a); return a2other; }
        private void BFS(long a) {
            var q = new Queue<Tuple<long, long>>(); q.Enqueue(Tuple.Create(a, -1L));
            while (q.Count > 0) {
                var c = q.Dequeue();
                foreach (var v in g[c.Item1]) {
                    if (v.Item1 == c.Item2) continue;
                    a2other[v.Item1] = a2other[c.Item1] + v.Item2; q.Enqueue(Tuple.Create(v.Item1, c.Item1));
                }
            }
        }
        private void DFS(long a) {
            var s = new Stack<Tuple<long, long>>(); s.Push(Tuple.Create(a, -1L));
            while (s.Count > 0) {
                var c = s.Pop();
                foreach (var v in g[c.Item1]) {
                    if (v.Item1 == c.Item2) continue;
                    a2other[v.Item1] = a2other[c.Item1] + v.Item2; s.Push(Tuple.Create(v.Item1, c.Item1));
                }
            }
        }
    }
    class ShortestPath {
        public long INF = (long)1e15; protected int I = -1; protected int V; protected int E; public long[] cost;
        public List<Tuple<int, long>>[] Adj; protected bool isNonDir = true;
        public void Init(int n) { I = n + 1; V = n; Adj = new List<Tuple<int, long>>[I]; I.REP(i => Adj[i] = new List<Tuple<int, long>>()); }
        public void AddPath(int f, int t, long c) {
            E++;
            if (isNonDir) {
                Adj[f].Add(Tuple.Create(t, c)); Adj[t].Add(Tuple.Create(f, c));
            } else {
                Adj[f].Add(Tuple.Create(t, c));
            }
        }
        public void AddPath(int[] f, int[] t, long[] c) { f.Length.REP(i => AddPath(f[i], t[i], c[i])); }
    }
    class Dijkstra : ShortestPath {//隣接対応後検証不足,有向とか
        public long MinCost(int f, int t) {
            cost = new long[I]; cost.Set(INF); cost[f] = 0;
            var pq = new PQueue<Tuple<int, long>>(); pq.Enqueue(Tuple.Create(f, 0L));//(from,cost)
            while (pq.Count > 0) {
                var cur = pq.Dequeue();
                if (cost[cur.Item1] < cur.Item2) continue; Adj[cur.Item1].Count.REP(i => {
                    var tmp = Adj[cur.Item1][i];
                    if (cost[tmp.Item1] > cost[cur.Item1] + tmp.Item2) {
                        cost[tmp.Item1] = cost[cur.Item1] + tmp.Item2; pq.Enqueue(Tuple.Create(tmp.Item1, cost[tmp.Item1]));
                    }
                });
            }
            return cost[t];
        }
    }
    class BellmanFord : ShortestPath {
        private bool[] neg;
        public BellmanFord() { }
        public BellmanFord(bool isNonDir) { this.isNonDir = isNonDir; }
        public long MinCost(int f, int t) {
            cost = new long[I]; cost.Set(INF); cost[f] = 0; neg = new bool[I];
            for (int i = 0; i < I - 1; i++) {
                I.REP(j => Adj[j].Count.REP(k => {
                    var cur = Adj[j][k];
                    if (cost[cur.Item1] > cost[j] + cur.Item2)
                        cost[cur.Item1] = cost[j] + cur.Item2;
                }));
            }
            for (int i = 0; i < I; i++) {
                I.REP(j => Adj[j].Count.REP(k => {
                    var cur = Adj[j][k];
                    if (cost[cur.Item1] > cost[j] + cur.Item2) {
                        cost[cur.Item1] = cost[j] + cur.Item2;
                        neg[cur.Item1] = true;
                    }
                    if (neg[j]) neg[cur.Item1] = true;
                }));
            }
            return cost[t];
        }
        public bool loopExist() { return neg[I - 1]; }
    }
    class WarshallFloyd {//そのうちAdjとどっちがいいか...TODO:ジェネリック
        private int E; private int INF = (int)1e9; public long[,] G;
        public void Init(int n) { E = n + 1; G = new long[E, E]; G.Set(INF); E.REP(i => G[i, i] = 0); }
        public void AddPath(int f, int t, long c) { G[f, t] = c; G[t, f] = c; }
        public void AddPath(int[] f, int[] t) { f.Length.REP(i => AddPath(f[i], t[i], 1)); }
        public void AddPath(int[] f, int[] t, long[] c) { f.Length.REP(i => AddPath(f[i], t[i], c[i])); }
        public void Run() { G = MinCostArr(); }
        public long[,] MinCostArr() { E.REP(i => E.REP(j => E.REP(k => G[j, k] = Math.Min(G[j, k], G[j, i] + G[i, k])))); return G; }
    }
    class UnionFind {
        public long[] parent; public long[] depth; private int I;
        public void Init(int n) { I = n + 1; parent = new long[I]; depth = new long[I]; I.REP(i => parent[i] = i); }
        public long Find(long x) { return (parent[x] == x) ? x : parent[x] = Find(parent[x]); }
        public void Unite(long x, long y) {
            x = Find(x); y = Find(y); if (x == y) return;
            if (depth[x] < depth[y]) parent[x] = y; else { parent[y] = x; if (depth[x] == depth[y]) depth[x]++; }
        }
        public bool Same(int a, int b) { return Find(a) == Find(b); }
        public long Size(int x) { return depth[Find(x)]; }
    }
    class Kruskal : ShortestPath {//TODO:test,
        public long Run() {
            var L = Adj.Select((l, i) => Tuple.Create(i, l[i].Item1, l[i].Item2)).OrderBy(t => t.Item3).ToList();
            //var li = new List<Tuple<int, int, long>>();
            //I.REP(i =>{ foreach (var t in Adj[i]) li.Add(Tuple.Create(i, t.Item1, t.Item2));});
            //li = li.OrderBy(t => t.Item3).ToList();//li = li.OrderByDescending(t => t.Item3).ToList();
            var uf = new UnionFind(); uf.Init(V); long ret = 0;
            foreach (var t in L) {
                if (!uf.Same(t.Item1, t.Item2)) {
                    ret += t.Item3; uf.Unite(t.Item1, t.Item2);
                }
            }
            return ret;
        }
    }
    #endregion
    #region Ex
    static class StringEX {
        public static string Reversed(this string s) { return string.Join("", s.Reverse()); }
        public static string Repeat(this string s, int n) { return string.Concat(Enumerable.Repeat(s, n).ToArray()); }
        public static int toInt(this string s) { int n; return (int.TryParse(s.TrimStart('0'), out n)) ? n : 0; }
        public static int toInt(this char c) { return toInt(c.ToString()); }
        public static int toInt(this char[] c) { return toInt(new string(c)); }
        public static long toLong(this string s) { long n; return (long.TryParse(s.TrimStart('0'), out n)) ? n : (long)0; }
        public static long toLong(this char c) { return toLong(c.ToString()); }
        public static long toLong(this char[] c) { return toLong(new string(c)); }
        public static string toString(this char[] c) { return new string(c); }
    }
    static class NumericEx {
        public static string pad0<T>(this T v, int n) { return v.ToString().PadLeft(n, '0'); }
        public static double RoundOff(this double v, int n) { return Math.Round(v, n - 1, MidpointRounding.AwayFromZero); }
        public static bool Odd(this int v) { return v % 2 != 0; }
        public static bool Odd(this long v) { return v % 2 != 0; }
        public static void REP(this int v, Action<int> act) { for (int i = 0; i < v; ++i) act(i); }
        public static void REPR(this int v, Action<int> act) { for (int i = v - 1; i >= 0; --i) act(i); }
    }
    static class ArrayEX {
        public static T[] Sort<T>(this T[] a) { Array.Sort(a); return a; }
        public static T[] SortR<T>(this T[] a) { Array.Sort(a); Array.Reverse(a); return a; }
        public static void Set<T>(this T[] a, T v) { a.Length.REP(i => a[i] = v); }
        public static void Set<T>(this T[,] a, T v) { a.GetLength(0).REP(i => a.GetLength(1).REP(j => a[i, j] = v)); }
    }
    static class BitEx {
        public static bool Any(this BitArray b) { foreach (bool f in b) if (f) return true; return false; }
        public static bool All(this BitArray b) { foreach (bool f in b) if (!f) return false; return true; }
        public static bool None(this BitArray b) { return !Any(b); }
        public static void Flip(this BitArray b, int index) { b.Set(index, !b.Get(index)); }
    }
    static class IEnumerableEx {
        //
    }
    #endregion
}


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

class Program
{
    public static int[] Read(string str)
    {
        string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        int[] ret = new int[tokens.Length];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = int.Parse(tokens[i]);
        }

        return ret;
    }

    public static long[] ReadLong(string str)
    {
        string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        long[] ret = new long[tokens.Length];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = long.Parse(tokens[i]);
        }

        return ret;
    }

    public static double[] ReadDouble(string str)
    {
        string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        double[] ret = new double[tokens.Length];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);
        }

        return ret;
    }

    static string Reverse(string s)
    {
        char[] a = s.ToCharArray();
        Array.Reverse(a);
        return new string(a);
    }

    static bool Check(string t)
    {
        for (int i = 0; i < t.Length; i++)
        {
            if (char.IsLetterOrDigit(t[i]) == false && t[i] != '_')
            {
                return false;
            }
        }

        return true;
    }

    static void Main(string[] args)
    {
        int[] abc = Read(Console.ReadLine());
        int[] def = Read(Console.ReadLine());

        if ((abc[0] == 0 && abc[1] == 0 && abc[2] != 0) || (def[0] == 0 && def[1] == 0 && def[2] != 0))
        {
            Console.WriteLine("0");
            return;
        }

        if (abc[0] * def[1] == abc[1] * def[0])
        {
            if (abc[0] * def[2] == abc[2] * def[0] && abc[1] * def[2] == abc[2] * def[1])
            {
                Console.WriteLine("-1");
            }
            else
            {
                Console.WriteLine("0");
            }
        }
        else
        {
            Console.WriteLine("1");
        }
    }
}


using System;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int a1 = int.Parse(Console.ReadLine());
            int a2 = int.Parse(Console.ReadLine());
            int k1 = int.Parse(Console.ReadLine());
            int k2 = int.Parse(Console.ReadLine());
            int n = int.Parse(Console.ReadLine());

            int r = a1 * (k1 - 1) + a2 * (k2 - 1);
            int min = (n - r < 0 ? 0 : n-r);
            int max = 0;
            int minCard, maxCard, minTeam, maxTeam;
            if (k1 < k2)
            {
                minCard = k1; minTeam = a1;
                maxCard = k2; maxTeam = a2;
            }
            else
            {
                minCard = k2; minTeam = a2;
                maxCard = k1; maxTeam = a1;
            }
            max = Math.Min(n/minCard,minTeam);
            n -= max*minCard;
            max += Math.Min(n / maxCard, maxTeam);

            Console.WriteLine($"{min} {max}");
        }
    }
}


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 fl = int.Parse(s[0]);
            int fr = int.Parse(s[1]);
            bool can = false ;
            s = Console.ReadLine().Split(' ');
            int ml = int.Parse(s[0]);
            int mr = int.Parse(s[1]);
            if (fr *2+2 >= ml && fr <= ml + 1)
            {
                can = true;
            } if (fl * 2+2 >= mr && fl <= mr + 1)
            {
                can = true;
            }
            if (can)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }

    }
}


using System;
using System.IO;
using System.Text;

namespace RM_B_298
{
    class Program : InputReader
    {
        static void Main(string[] args)
        {
            string[] s = f.ReadLine().Split(' ');
            int v1 = int.Parse(s[0]), v2 = int.Parse(s[1]);
            s = f.ReadLine().Split(' ');
            int t = int.Parse(s[0]), d = int.Parse(s[1]);

            int[] a = new int[t];
            a[0] = v1;
            a[t - 1] = v2;
            for (int i = 1; i < t - 1; i++)
            {
                a[i] = a[i - 1] + d;
            }

            for (int i = t - 2; i > 0; i--)
            {
                if (a[i] > (a[i + 1] + d))
                {
                    a[i] = a[i + 1] + d;
                }
            }
            int ans = 0;
            for (int i = 0; i < t; i++)
            {
                ans += a[i];
            }
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }

    class InputReader
    {
        //public static TextReader f = new StreamReader("input.txt");
        public static TextReader f = Console.In;
    }
}


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

namespace TechnoCup3A
{
    public class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int[] arr = new int[6];
            int max = 0;
            bool flag = false;
            for (int i = 0; i < 6; i++)
            {
                arr[i] = Int32.Parse(str[i]);
                max += arr[i];
            }
            for (int i = 1; i < 6; i++)
            {
                int max1 = arr[0];
                max1 += arr[i];
                for (int j = i + 1; j < 6; j++)
                {
                    max1 += arr[j];
                    if (max1 == max - max1)
                    {
                        Console.Write("YES");
                        flag = true;
                        break;

                    }
                    max1 = arr[0] + arr[i];
                }
                if (flag == true) break;
            }
            if (flag == false) Console.Write("NO");
            //Console.ReadKey();

        }
    }
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int zobmieCount = Convert.ToInt32(Console.ReadLine());

            int brainCount;

            if (zobmieCount % 2 != 0)
                if (zobmieCount == 1)
                {
                    Console.WriteLine("1");
                    return;
                }
                else
                    brainCount = (int)(zobmieCount / 2) + 1;
            else
                brainCount = zobmieCount / 2;

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


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Web.UI.WebControls;

namespace Codeforces
{
    class Program : IDisposable
    {
        private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
        private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

        private void Solve()
        {
            var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var c = s[0];
            var v = s[1];
            var vMax = s[2];
            var a = s[3];
            var l = s[4];

            int cnt = v;
            int res = 1;
            int multiplier = 1;
            while (cnt < c)
            {
                if (v + multiplier*a < vMax)
                {
                    cnt+= (v + multiplier * a - l);
                }
                else
                {
                    cnt+= vMax-l;
                }
                multiplier++;
                res++;
            }
            Console.WriteLine(res);
        }

        int BinarySearch(int[] arr, int q)
        {
            var l = 0;
            var r = arr.Length - 1;
            //int med = -1;
            while (l <= r)
            {
                var med = l + (r - l) / 2;
                if (arr[med] == q)
                {
                    return med;
                }
                if (q < arr[med])
                {
                    r = med - 1;
                }
                else
                {
                    l = med + 1;
                }
            }
            return -1;
        }

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

        #region Helpers

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

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

        private static int[] ReadIntArray()
        {
            return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        #endregion

        public void Dispose()
        {
            textReader.Close();
            textWriter.Close();
        }
    }

    public class ListNode
    {
      public int val;
      public ListNode next;
      public ListNode(int x) { val = x; }
    }

}


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

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

    }

    public PairVariable(int a, int b, int c)
    {
        this.a = a;
        this.b = b;
        this.c = c;

    }

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

namespace ConsoleApplication3
{
    class Program
    {

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

        static int[] mark;
        static Dictionary<int, List<int>> d = new Dictionary<int, List<int>>();
        static void dfs(int v)
        {
            mark[v] = 1;
            for (int i = 0; i < d[v].Count; i++)
            {
                if (mark[d[v][i]] == 0)
                {
                    dfs(d[v][i]);
                }
            }
        }
        static void Main(string[] args)
        {
            long ans = 0;
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
            }
            Array.Sort(a);
            for (int i = n - 1; i >= 0; i--)
            {
                for (int e = i - 1; e >= 0; e--)
                {
                    if (a[e] >= a[i])
                    {
                        a[e] = Math.Max(0, a[i] - 1);
                    }
                }
            }
            for (int i = 0; i < n; i++)
            {
                ans += a[i];
            }
            Console.WriteLine(ans);
        }
    }
}


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

namespace Codeforces0710B
{
    class Program
    {

        static bool isprime(long a)
        {

            for(long i = 2;i<=Math.Sqrt(a);i++)
            {
                if (a % i == 0)
                    return false;
            }

            return true;
        }
        static void Main(string[] args)
        {

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

            while (testCases-- > 0)
            {

                string read;
                read = Console.ReadLine();
                long a = long.Parse(read.Split(' ').ToList()[0]);
                long b = long.Parse(read.Split(' ').ToList()[1]);

                bool flag = true;

                if (a % 2 == 1 && b % 2 == 1)
                {
                    flag = false;
                }

                if (a % 2 == 0 && b % 2 == 0)
                {
                    flag = false;
                }

                if (a - b > 1)
                {
                    flag = false;
                }

                if(flag)
                {
                    flag = isprime(a + b);
                }

                if(flag)
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }

            }
        }
    }
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        public static long Rec(long ss, long i, long s, long l, long r, long x, long n, long[] mas, long k)
        {
            s += mas[i];
            if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))
            {
                ss++;
            }
            if (s < r)
            {
                for (long j = i + 1; j < n; j++)
                {
                    ss = Rec(ss, j, s, l, r, x, n, mas, k);
                }
            }
            return ss;
        }
        static void Main(string[] args)
        {
            long n, l, r, x;

            string[] lines = Console.ReadLine().Split(' ');
            n = long.Parse(lines[0]);
            l = long.Parse(lines[1]);
            r = long.Parse(lines[2]);
            x = long.Parse(lines[3]);
            long[] mas;
            mas = new long[n];
            string[] lines1 = Console.ReadLine().Split(' ');
            for (long i = 0; i < n; i++)
                mas[i] = long.Parse(lines1[i]);

            for (long i = 0; i < mas.Length; i++)
            {
                for (long j = 0; j < mas.Length - 1; j++)
                {
                    if (mas[j] > mas[j + 1])
                    {
                        long z = mas[j];
                        mas[j] = mas[j + 1];
                        mas[j + 1] = z;
                    }
                }
            }
            long s = 0, ss = 0, sl = 0;
            for (long jj = 0; jj < (n - 1); jj++)
            {
                sl = Rec(0, jj, s, l, r, x, n, mas, jj);
                ss += sl;
            }
            Console.WriteLine(ss);
            //  Console.ReadLine();
        }

    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();

        var a = new bool[n, n];
        for (int m = ReadInt(); m > 0; m--)
        {
            int u = ReadInt() - 1;
            int v = ReadInt() - 1;
            a[u, v] = a[v, u] = true;
        }

        var g = Init<List<int>>(n);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (i != j && !a[i, j])
                    g[i].Add(j);

        var ans = new char[n];
        bool f = false;
        for (int i = 0; i < n; i++)
            if (ans[i] == 0)
            {
                if (g[i].Count == 0)
                {
                    ans[i] = 'b';
                    continue;
                }
                if (f)
                {
                    Write("No");
                    return;
                }
                f = true;
                var q = new Queue<int>();
                q.Enqueue(i);
                ans[i] = 'a';
                while (q.Count > 0)
                {
                    int x = q.Dequeue();
                    foreach (int e in g[x])
                        if (ans[e] != 0)
                        {
                            if (ans[e] == ans[x])
                            {
                                Write("No");
                                return;
                            }
                        }
                        else
                        {
                            ans[e] = ans[x] == 'a' ? 'c' : 'a';
                            q.Enqueue(e);
                        }
                }
            }

        for (int i = 0; i < n; i++)
            for (int j = i + 1; j < n; j++)
                if ((ans[i] == 'a' && ans[j] == 'c' || ans[i] == 'c' && ans[j] == 'a') && a[i, j])
                {
                    Write("No");
                    return;
                }

        Write("Yes");
        Write(new string(ans));
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

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


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

namespace ConsoleApp5
{
    class Program
    {
        static Stack<bool> GetBinaryNumber(long number)
        {
            Stack<bool> result = new Stack<bool>();
            while (number != 0)
            {
                result.Push(number % 2 == 1);
                number /= 2;
            }
            return result;
        }
        static long FastDegree(long number, long pow)
        {
            long result = 1;
            Stack<bool> StackPow = GetBinaryNumber(pow);
            while (StackPow.Count != 0)
            {
                result *= result;
                result %= (int)(1e9 + 7);
                if (StackPow.Pop())
                {
                    result *= number;
                    result %= (int)(1e9 + 7);
                }
            }
            return result;
        }

        static int GetCountOne(int number)
        {
            int result = 0;
            while (number != 0)
            {
                if ((number & 1) == 1)
                    result++;
                number /= 2;
            }
            return result;
        }
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            if (n < 7)
            {
                Console.WriteLine(m);
            }
            else
            {
                List<HashSet<int>> G = new List<HashSet<int>>();
                for (int i = 0; i < 7; i++)
                {
                    G.Add(new HashSet<int>());
                }
                int temp = m;
                while(temp-- !=0)
                {
                    str = Console.ReadLine().Split();
                    int first = int.Parse(str[0]) - 1;
                    int second = int.Parse(str[1]) - 1;
                    G[first].Add(second);
                    G[second].Add(first);
                }
                int min = 6;
                for(int i =0; i<n; i++)
                {
                    for(int j = i; j<n; j++)
                    {
                        int count = 0;
                        foreach(int top in G[j])
                        {
                            if (G[i].Contains(top))
                                count++;
                        }
                        if (count < min)
                            min = count;
                    }
                }
                Console.WriteLine(m - min);
            }
        }
    }
}


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

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

            int[] aux = new int[6];

            for(int i = 0 ; i < m ; ++i )
            {
                string[] ab = Console.ReadLine().Split(' ');
                int a = int.Parse(ab[0]);
                int b = int.Parse(ab[1]);

                aux[a]++;
                aux[b]++;
            }

            bool f = false;

            for(int i = 1 ; i < 6 ; ++i )
            {
                if(aux[i] >= 3 || aux[i] <= 1)
                {
                        f = true;
                        break;
                }
            }

            if(f)
            {
                Console.WriteLine("WIN");
            }
            else
            {
                Console.WriteLine("FAIL");
            }
        }
    }
}


using System;

namespace TaskB {
    internal class Program {
        private static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(2 * n / 4 * 3);
        }
    }
}


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

namespace ConsoleApplication1.Combynatorycs
{
    class _776
    {
        static void Main(String[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var data1 = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var data2 = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            var res1 = new int[6];
            var res2 = new int[6];

            for(var i = 0; i < data1.Count; i++)
            {
                res1[data1[i]]++;
                res2[data2[i]]++;
            }

            var result = 0;
            for(var i = 1; i <= 5; i++)
            {
                var c = res1[i] + res2[i];
                if (c % 2 != 0)
                {
                    Console.WriteLine(-1);
                    return;
                }
                result += Math.Abs(res1[i] - res2[i]) / 2;
            }

            if (result % 2 != 0)
            {
                Console.WriteLine(-1);
                return;
            }

            Console.WriteLine(result/2);

        }
    }
}