using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Text;

namespace Codeforces
{
    class Program
    {
        private static string readString() => Console.ReadLine();
        private static T readValue<T>() => (T)Convert.ChangeType(readString(), typeof(T));
        private static string[] readStrings(char delimiter = ' ') => readString().Split(delimiter);
        private static List<T> readValues<T>(char delimiter = ' ') => readStrings(delimiter: delimiter).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();
        private static void write<T>(T s) => Console.WriteLine(s);

        private static int binarySearch<T>(List<T> list, T target) where T : IComparable
        {
            int l = 0, r = list.Count - 1;
            while (l <= r)
            {
                var m = (int)Math.Floor((double)(l + r) / 2);
                if (list[m].CompareTo(target) <= 0)
                    if (m == r || list[m + 1].CompareTo(target) > 0)
                        return m;
                    else
                        l = m + 1;
                else
                    r = m - 1;
            }
            return -1;
        }

        private static int quickSortPartition<T>(List<T> a, int lo, int hi) where T : IComparable
        {
            var pivot = a[lo];
            int i = lo - 1, j = hi + 1;
            while (true)
            {
                do { i++; } while (a[i].CompareTo(pivot) < 0);
                do { j--; } while (a[j].CompareTo(pivot) > 0);
                if (i >= j)
                    return j;
                var temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
        }
        private static void quickSort<T>(List<T> a, int lo, int hi) where T : IComparable
        {
            if (lo < hi)
            {
                int q = quickSortPartition(a, lo, hi);
                quickSort(a, lo, q);
                quickSort(a, q + 1, hi);
            }
        }
        private static void quickSort<T>(List<T> a) where T : IComparable => quickSort(a, 0, a.Count - 1);

        private static void watermelon()
        {
            var w = readValue<int>();
            write(w >= 4 && w % 2 == 0 ? "YES" : "NO");
        }
        private static void wayTooLongWords()
        {
            var words = new List<string>();

            var n = readValue<int>();
            for (int i = 0; i < n; ++i)
                words.Add(readString());

            foreach (var word in words)
                write(word.Length <= 10 ? word : $"{word.First()}{word.Length - 2}{word.Last()}");
        }
        private static void team()
        {
            int solve = 0;

            var n = readValue<int>();
            for (int i = 0; i < n; ++i)
                if (readValues<int>().Where(x => x == 1).Count() > 1)
                    ++solve;

            write(solve);
        }
        private static void football()
        {
            var positions = readString();
            for (int i = 6; i < positions.Length; ++i)
                if (positions.Substring(i - 6, 6) == (positions[i] == '0' ? "000000" : "111111"))
                {
                    write("YES");
                    return;
                }
            write("NO");
        }
        private static void theatreSquare()
        {
            var sizes = readValues<int>();
            write((long)Math.Ceiling((double)sizes[0] / (double)sizes[2]) * (long)Math.Ceiling((double)sizes[1] / (double)sizes[2]));
        }
        private static void stringTask()
        {
            var Vowels = new HashSet<char> { 'a', 'o', 'y', 'e', 'u', 'i' };
            var sb = new StringBuilder();
            var s = readString().ToLower();
            foreach (var c in s)
                if (!Vowels.Contains(c))
                {
                    sb.Append('.');
                    sb.Append(c);
                }

            write(sb.ToString());
        }
        private static void taxi()
        {
            int taxis = 0;
            var groups = new Dictionary<int, int> { { 1, 0 }, { 2, 0 }, { 3, 0 } };

            readValue<int>();
            var groupSizes = readValues<int>();
            foreach (var size in groupSizes)
                if (size == 4)
                    ++taxis;
                else
                    groups[size] = groups[size] + 1;

            taxis += groups[3];
            groups[1] = groups[1] - Math.Min(groups[1], groups[3]);

            taxis += groups[2] / 2;
            if (groups[2] % 2 == 1)
            {
                ++taxis;
                groups[1] = groups[1] - 2;
            }

            if (groups[1] > 0)
                taxis += (int)Math.Ceiling((double)groups[1] / 4.0);

            write(taxis);
        }
        private static void fancyFence()
        {
            var a = readValue<int>();
            for (double i = 3.0; ; i += 1.0)
            {
                var x = (double)(i - 2.0) * 180.0 / i;
                if (a <= x)
                {
                    write(a < x ? "NO" : "YES");
                    break;
                }
            }
        }
        private static void interestingDrink()
        {
            readString();
            var prices = readValues<int>().OrderBy(x => x).ToList();
            var days = readValue<int>();
            for (int i = 0; i < days; ++i)
                write(binarySearch(prices, readValue<int>()) + 1);
        }
        private static void compilationErrors()
        {
            readString();
            Dictionary<int, int> errors = readValues<int>().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count()), errors1 = new Dictionary<int, int>();
            foreach (var error in readValues<int>())
            {
                if (errors[error] > 1)
                    errors[error] = errors[error] - 1;
                else
                    errors.Remove(error);

                if (errors1.TryGetValue(error, out var count))
                    errors1[error] = count + 1;
                else
                    errors1.Add(error, 1);
            }
            write(errors.First().Key);

            foreach (var error in readValues<int>())
                if (errors1[error] > 1)
                    errors1[error] = errors1[error] - 1;
                else
                    errors1.Remove(error);
            write(errors1.First().Key);
        }
        private static void doubleCola()
        {
            var idToName = new Dictionary<int, string> { { 0, "Sheldon" }, { 1, "Leonard" }, { 2, "Penny" }, { 3, "Rajesh" }, { 4, "Howard" } };
            int n = readValue<int>(), i = 1;
            for (; n > i * 5; i *= 2)
                n -= i * 5;
            write(idToName[(n - 1) / i]);
        }
        private static void ilyaAndQueries()
        {
            var dic = new Dictionary<int, int>();
            var list = new List<Tuple<int, int>>();

            var s = readString();
            int start = 0, dicStart = 0;
            for (int j = 0; j < s.Length - 1; ++j)
                if (s[j] != s[j + 1])
                {
                    if (start < j)
                    {
                        list.Add(new Tuple<int, int>(start + 1, j + 1));
                        for (; dicStart < j + 1; ++dicStart)
                            dic.Add(dicStart, list.Count - 1);
                    }
                    start = j + 1;
                }
            if (start < s.Length - 1)
            {
                list.Add(new Tuple<int, int>(start + 1, s.Length));
                for (; dicStart < s.Length; ++dicStart)
                    dic.Add(dicStart, list.Count - 1);
            }

            var m = readValue<int>();
            for (int j = 0; j < m; ++j)
            {
                var q = readValues<int>();
                int l = q[0], r = q[1], result = 0;
                if (dic.TryGetValue(l, out var i))
                    for (; i < list.Count && r >= list[i].Item1; ++i)
                        if (l < list[i].Item2)
                            result += Math.Min(r, list[i].Item2) - Math.Max(l, list[i].Item1);
                write(result);
            }
        }
        private static void twoTeamsComposing()
        {
            var n = readValue<int>();
            var skills = readValues<int>().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
        }
        #region Laptop
        private class Laptop
        {
            internal int Price { get; private set; }
            internal int Quality { get; private set; }
            internal Laptop(List<int> values)
            {
                Price = values[0];
                Quality = values[1];
            }
        }
        private class Laptop_Comparer_Price : Comparer<Laptop>
        {
            public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Price - y.Price;
        }
        private class Laptop_Comparer_Quality : Comparer<Laptop>
        {
            public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Quality - y.Quality;
        }
        private static void laptops()
        {
            List<Laptop> prices = new List<Laptop>(), qualities = new List<Laptop>();
            var n = readValue<int>();
            for (int i = 0; i < n; ++i)
            {
                var laptop = new Laptop(readValues<int>());
                prices.Add(laptop);
                qualities.Add(laptop);
            }

            for (int i = 0; i < n; ++i)
                if (prices[i] != qualities[i])
                {
                    write("Happy Alex");
                    return;
                }
            write("Poor Alex");
        }
        #endregion
        private static void fence()
        {
            int k = readValues<int>()[1], minI = 0, currentH = 0;
            var h = readValues<int>();

            for (int i = 0; i < k; ++i)
                currentH += h[i];
            var minH = currentH;

            for (int i = 1; i < h.Count - k + 1; ++i)
            {
                currentH = currentH - h[i - 1] + h[i + k - 1];
                if (minH > currentH)
                {
                    minH = currentH;
                    minI = i;
                }
            }

            write(minI + 1);
        }
        #region serejaAndSuffixes
        private class SerejaL : IComparable
        {
            internal int L { get; private set; }
            internal int Result;
            internal SerejaL(int l)
            {
                L = l;
            }

            public int CompareTo(object obj) => L - ((SerejaL)obj).L;
        }
        private static void serejaGetLs(int m, out List<SerejaL> listDistinct, out List<SerejaL> listOrdered)
        {
            listDistinct = new List<SerejaL>();
            listOrdered = new List<SerejaL>();
            var dic = new Dictionary<int, SerejaL>();
            for (int i = 0; i < m; ++i)
            {
                var l = readValue<int>() - 1;
                if (!dic.TryGetValue(l, out var item))
                {
                    item = new SerejaL(l);
                    dic.Add(l, item);
                    listDistinct.Add(item);
                }
                listOrdered.Add(item);
            }
            quickSort(listDistinct);
        }
        private static void serejaAndSuffixes()
        {
            var m = readValues<int>()[1];
            var a = readValues<int>();
            serejaGetLs(m, out var listDistinct, out var listOrdered);

            var distinct = new HashSet<int>();
            for (int i = listDistinct.Count - 1, j = a.Count - 1; i >= 0; --i)
            {
                for (; j >= listDistinct[i].L; --j)
                    if (!distinct.Contains(a[j]))
                        distinct.Add(a[j]);

                listDistinct[i].Result = distinct.Count;
            }

            foreach (var item in listOrdered)
                write(item.Result);
        }
        #endregion
        private static void bowWowTimetable()
        {
            string s = readString(), r = "1";
            int i = 1;
            for (; r.Length < s.Length; ++i, r = r + "00") ;
            if (r.Length > s.Length || !s.Substring(1).Contains('1'))
                write(i - 1);
            else
                write(i);
        }
        private static void digits()
        {
            readString();
            var numbers = readValues<int>().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
            if (!numbers.ContainsKey(0))
            {
                write(-1);
                return;
            }
        }
        private static void lifeWithoutZeros()
        {
            long a = readValue<int>(), b = readValue<int>(), c = a + b;
            write(Convert.ToInt64(a.ToString().Replace("0", "")) + Convert.ToInt64(b.ToString().Replace("0", "")) == Convert.ToInt64(c.ToString().Replace("0", "")) ? "YES" : "NO");
        }
        private static void permutation()
        {
            var n = readValue<int>();
            var a = readValues<int>();
            write(n - a.Where(x => x <= n).Distinct().Count());
        }
        private static void hamsterFarm()
        {
            var n = readValues<long>()[0];
            var k = readValues<long>();
            int bestI = 0;
            for (int i = 1; i < k.Count; ++i)
                if (n % k[i] < n % k[bestI])
                    bestI = i;
            write($"{bestI + 1} {n / k[bestI]}");
        }
        private static void shellGame()
        {
            int n = readValue<int>(), x = readValue<int>();
            if (x == 1)
            {
                if (n % 2 == 1)
                    x = 0;
                else
                    x = 2;
                --n;
            }
            for (int i = n % 6; i > 0; --i)
                if (i % 2 == 1)
                {
                    if (x == 0)
                        x = 1;
                    else if (x == 1)
                        x = 0;
                }
                else if (x == 1)
                    x = 2;
                else if (x == 2)
                    x = 1;
            write(x);
        }
        private static void ACM_ICPC()
        {
            var a = readValues<int>();
            int[] score = new int[2], members = new int[2];
            for (int i1 = 0; i1 < 2; ++i1)
            {
                score[i1] = a[0];
                members[i1] = 1;
                for (int i2 = 0; i2 < 2; ++i2)
                {
                    score[i2] += a[1];
                    members[i2] += 1;
                    for (int i3 = 0; i3 < 2; ++i3)
                    {
                        score[i3] += a[2];
                        members[i3] += 1;
                        for (int i4 = 0; i4 < 2; ++i4)
                            if (members[i4] < 3)
                            {
                                score[i4] += a[3];
                                members[i4] += 1;
                                for (int i5 = 0; i5 < 2; ++i5)
                                    if (members[i5] < 3)
                                    {
                                        score[i5] += a[4];
                                        members[i5] += 1;
                                        for (int i6 = 0; i6 < 2; ++i6)
                                            if (members[i6] < 3)
                                            {
                                                score[i6] += a[5];
                                                members[i6] += 1;
                                                if (score[0] == score[1])
                                                {
                                                    write("YES");
                                                    return;
                                                }
                                                score[i6] -= a[5];
                                                members[i6] -= 1;
                                            }
                                        score[i5] -= a[4];
                                        members[i5] -= 1;
                                    }
                                score[i4] -= a[3];
                                members[i4] -= 1;
                            }
                        score[i3] -= a[2];
                        members[i3] -= 1;
                    }
                    score[i2] -= a[1];
                    members[i2] -= 1;
                }
                score[i1] = 0;
                members[i1] = 0;
            }
            write("NO");
        }
        private static void mex()
        {
            var x = readValues<int>()[1];
            var n = readValues<int>();
            write(x - n.Count(y => y < x) + (n.Contains(x) ? 1 : 0));
        }
        private static void minimumProduct()
        {
            var input = readValues<int>();
            int a = input[0], b = input[1], x = input[2], y = input[3], n = input[4], minA = Math.Min(a - x, n), minB = Math.Min(b - y, n);
            if (a - minA <= b - minB)
            {
                a -= minA;
                n -= minA;
            }
            else
            {
                b -= minB;
                n -= minB;
            }

            if (n > 0)
                if (a > x)
                    a -= Math.Min(a - x, n);
                else if (b > y)
                    b -= Math.Min(b - y, n);

            write((long)a * (long)b);
        }
        private static void shovelsAndSwords()
        {
            var input = readValues<int>();
            int a = input[0], b = input[1], result = 0;
            if (a > b)
            {
                var min = Math.Min(a - b, b);
                a -= min * 2;
                b -= min;
                result += min;
            }
            else if (b > a)
            {
                var min = Math.Min(b - a, a);
                a -= min;
                b -= min * 2;
                result += min;
            }
            int d = Math.Min(a / 3, b / 3);
            a -= d * 3;
            b -= d * 3;
            result += d * 2;
            if (a > 0 && b > 0 && (a > 1 || b > 1))
                ++result;
            write(result);
        }
        private static void matrixGame()
        {
            var input = readValues<int>();
            int n = input[0], m = input[1];
            HashSet<int> claimedRows = new HashSet<int>(), claimedColumns = new HashSet<int>();
            for (int i = 0; i < n; ++i)
            {
                input = readValues<int>();
                for (int j = 0; j < m; ++j)
                    if (input[j] == 1)
                    {
                        if (!claimedRows.Contains(i))
                            claimedRows.Add(i);
                        if (!claimedColumns.Contains(j))
                            claimedColumns.Add(j);
                    }
            }
            write(Math.Min(n - claimedRows.Count, m - claimedColumns.Count) % 2 == 0 ? "Vivek" : "Ashish");
        }
        private static void cinemaLine()
        {
            readString();
            var clerk = new Dictionary<int, int> { { 25, 0 }, { 50, 0 } };
            foreach (var a in readValues<int>())
                switch (a)
                {
                    case 25:
                        clerk[25] += 1;
                        break;
                    case 50:
                        if (clerk[25] > 0)
                        {
                            clerk[25] -= 1;
                            clerk[50] += 1;
                        }
                        else
                        {
                            write("NO");
                            return;
                        }
                        break;
                    default: // 100
                        if (clerk[50] > 0 && clerk[25] > 0)
                        {
                            clerk[25] -= 1;
                            clerk[50] -= 1;
                        }
                        else if (clerk[25] > 2)
                            clerk[25] -= 3;
                        else
                        {
                            write("NO");
                            return;
                        }
                        break;
                }
            write("YES");
        }
        private static void kindAnton()
        {
            readString();
            List<int> a = readValues<int>(), b = readValues<int>();
            bool positive1 = false, negative1 = false;
            HashSet<int> positive = new HashSet<int>(), negative = new HashSet<int>();
            for (int i = 0; i < a.Count; ++i)
            {
                int diff = b[i] - a[i];
                if (((diff > 0 && !positive1) || (diff < 0 && !negative1)) && !(diff > 0 ? positive : negative).Any(x => diff % x == 0))
                {
                    write("NO");
                    return;
                }
                if (a[i] > 0)
                {
                    if (!positive1)
                        if (a[i] == 1)
                        {
                            positive1 = true;
                            if (negative1)
                            {
                                write("YES");
                                return;
                            }
                        }
                        else if (!positive.Contains(a[i]))
                            positive.Add(a[i]);
                }
                else if (a[i] < 0 && !negative1)
                    if (a[i] == -1)
                    {
                        negative1 = true;
                        if (positive1)
                        {
                            write("YES");
                            return;
                        }
                    }
                    else if (!negative.Contains(a[i]))
                        negative.Add(a[i]);
            }
            write("YES");
        }
        private static void staircases()
        {
            var input = readValues<int>();
            int n = input[0], mn = input[1];
            if (mn == 0)
            {
                write("YES");
                return;
            }
            var m = readValues<int>().OrderBy(x => x).ToList();
            if (m[0] == 1 || m[m.Count - 1] == n)
            {
                write("NO");
                return;
            }
            for (int i = 0; i < m.Count - 2; ++i)
                if (m[i] == m[i + 1] - 1 && m[i] == m[i + 2] - 2)
                {
                    write("NO");
                    return;
                }
            write("YES");
        }
        private static void blownGarland()
        {
            var colors = new Dictionary<char, int> { { 'R', 0 }, { 'Y', 0 }, { 'B', 0 }, { 'G', 0 } };
            var s = readString();

            var colorPerPosition = new char[4];
            foreach (var color in colors)
                colorPerPosition[s.IndexOf(color.Key) % 4] = color.Key;

            for (int i = 0; i < s.Length; ++i)
                if (s[i] == '!')
                    colors[colorPerPosition[i % 4]] += 1;

            write($"{colors['R']} {colors['B']} {colors['Y']} {colors['G']}");
        }
        private static void mikeAndFax()
        {
            var s = readString();
            int k = readValue<int>();

            if (s.Length % k != 0)
            {
                write("NO");
                return;
            }

            int size = s.Length / k;
            for (int i = 0; i < s.Length; i += size)
                for (int j1 = i + size / 2 - 1, j2 = i + size / 2 + size % 2; j1 >= i; --j1, ++j2)
                    if (s[j1] != s[j2])
                    {
                        write("NO");
                        return;
                    }

            write("YES");
        }
        #region weirdRounding
        private static bool weirdRounding_Recursion(string ns, int kp, int d)
        {
            if (d > 0)
                for (int i = ns[1] == '0' && ns.Length > 2 ? 1 : 0; i < ns.Length; ++i)
                {
                    string nsNew = ns.Remove(i, 1);
                    int n = Convert.ToInt32(nsNew);
                    if (n % kp == 0 || weirdRounding_Recursion(nsNew, kp, d - 1))
                        return true;
                }
            return false;
        }
        private static void weirdRounding()
        {
            var input = readStrings();
            string ns = input[0];
            int n = Convert.ToInt32(ns), k = Convert.ToInt32(input[1]), kp = (int)Math.Pow(10, k);

            if (n < kp)
                write(ns.Length - 1);
            else if (n % kp == 0)
                write(0);
            else
                for (int d = 1; d < ns.Length; ++d)
                    if (weirdRounding_Recursion(ns, kp, d))
                    {
                        write(d);
                        return;
                    }
        }
        #endregion
        private static void wilburArray()
        {
            readString();
            var b = readValues<int>();
            long result = Math.Abs(b[0]);
            for (int i = 1; i < b.Count; ++i)
                result += Math.Abs(b[i] - b[i - 1]);
            write(result);
        }
        private static void zuhairStrings()
        {
            int k = readValues<int>()[1];
            var s = readString();
            var result = new Dictionary<char, int>();

            for (int i = 0; i < s.Length - k + 1;)
            {
                int j = i + 1;
                for (; j < i + k && s[i] == s[j]; ++j) ;
                if (j == i + k)
                    if (!result.ContainsKey(s[i]))
                        result.Add(s[i], 1);
                    else
                        result[s[i]] += 1;
                i = j;
            }

            write(result.Count > 0 ? result.Max(x => x.Value) : 0);
        }
        private static void artfulExpedient()
        {
            var n = readValue<int>();
            List<int> x = readValues<int>(), y = readValues<int>();
            var numbers = x.Union(y).ToHashSet();
            var resultEven = true;

            for (int i = 0; i < n; ++i)
                for (int j = 0; j < n; ++j)
                    if (numbers.Contains(x[i] ^ y[j]))
                        resultEven = !resultEven;

            write(resultEven ? "Karen" : "Koyomi");
        }
        private static void ebonyIvory()
        {
            var input = readValues<int>();
            int a = input[0], b = input[1], c = input[2];
            if (a < b)
            {
                var t = a;
                a = b;
                b = t;
            }
            for (; c >= 0; c -= a)
                if (c % b == 0)
                {
                    write("Yes");
                    return;
                }
            write("No");
        }
        #region Lala Land Apple Trees
        private class LalaLand_AppleTree : IComparable
        {
            private int coordinate;
            internal int Apples { get; private set; }
            internal LalaLand_AppleTree(int coordinate, int apples)
            {
                this.coordinate = coordinate;
                Apples = apples;
            }
            public int CompareTo(object obj) => coordinate - ((LalaLand_AppleTree)obj).coordinate;
        }
        private static void lalaLandAppleTrees()
        {
            var n = readValue<int>();
            List<LalaLand_AppleTree> right = new List<LalaLand_AppleTree>(), left = new List<LalaLand_AppleTree>();
            for (int i = 0; i < n; ++i)
            {
                var input = readValues<int>();
                if (input[0] > 0)
                    right.Add(new LalaLand_AppleTree(input[0], input[1]));
                else
                    left.Add(new LalaLand_AppleTree(-input[0], input[1]));
            }

            if (Math.Abs(right.Count - left.Count) < 2)
                write(right.Sum(x => x.Apples) + left.Sum(x => x.Apples));
            else
            {
                quickSort(right);
                quickSort(left);
                if (right.Count > left.Count)
                    write(right.GetRange(0, left.Count + 1).Sum(x => x.Apples) + (left.Count > 0 ? left.Sum(x => x.Apples) : 0));
                else
                    write((right.Count > 0 ? right.Sum(x => x.Apples) : 0) + left.GetRange(0, right.Count + 1).Sum(x => x.Apples));
            }
        }
        #endregion
        private static void lanterns()
        {
            int l = readValues<int>()[1], d = 0;
            var a = readValues<int>().Distinct().ToList();
            quickSort(a);
            for (int i = 0; i < a.Count - 1; ++i)
            {
                var diff = a[i + 1] - a[i];
                if (diff > d)
                    d = diff;
            }
            if (a[0] > 0 && a[a.Count - 1] < l)
                write(Math.Max(Math.Max(a[0] - 0, l - a[a.Count - 1]), d / 2.0));
            else if (a[0] > 0)
                write(Math.Max(a[0] - 0, d / 2.0));
            else if (a[a.Count - 1] < l)
                write(Math.Max(l - a[a.Count - 1], d / 2.0));
            else
                write((double)d / 2.0);
        }
        private static void cheapTravel()
        {
            var input = readValues<int>();
            int n = input[0], m = input[1], a = input[2], b = input[3];
            if (b >= a * m)
                write(n * a);
            else
                write((n / m) * b + ((n % m) * a < b ? (n % m) * a : b));
        }
        private static void berSUBall()
        {
            readString();
            var a = readValues<int>();
            readString();
            var b = readValues<int>();
            quickSort(a);
            quickSort(b);
            int result = 0;
            for (int i = 0, j = 0; i < a.Count && j < b.Count;)
                if (Math.Abs(a[i] - b[j]) < 2)
                {
                    ++result;
                    ++i;
                    ++j;
                }
                else if (a[i] < b[j])
                    ++i;
                else
                    ++j;
            write(result);
        }
        private static void flippingGame()
        {
            readString();
            var a = readValues<int>();
            int max = 0;
            for (int i = 0, previousOnes = 0, total = a.Sum(); i < a.Count; previousOnes += a[i], ++i)
                for (int j = i, remainingOnes = total - previousOnes; j < a.Count; ++j)
                {
                    remainingOnes -= a[j];
                    var ones = previousOnes + (j - i + 1 - (total - previousOnes - remainingOnes)) + remainingOnes;
                    if (ones > max)
                        max = ones;
                }
            write(max);
        }
        private static void worms()
        {
            readString();
            var a = readValues<int>();

            var worms = new Dictionary<int, int>();
            int i = 1;
            for (int j = 0; j < a.Count; ++j)
                for (int k = 0; k < a[j]; ++k)
                    worms.Add(i++, j + 1);

            readString();
            foreach (var q in readValues<int>())
                write(worms[q]);
        }
        private static void kNotDivisable()
        {
            var input = readValues<int>();
            int n = input[0], k = input[1];
            write(k / (n - 1) * n + (k % (n - 1) == 0 ? -1 : k % (n - 1)));
        }
        private static void oddSelection()
        {
            var x = readValues<int>()[1];
            var a = readValues<int>().GroupBy(x => x % 2).ToDictionary(x => x.Key, x => x.Count());
            if (a.TryGetValue(1, out var odd))
            {
                --odd;
                --x;
                if (x % 2 == 0)
                {
                    if (odd >= x || (a.TryGetValue(0, out var even) && even + odd / 2 * 2 >= x))
                    {
                        write("Yes");
                        return;
                    }
                }
                else if (a.TryGetValue(0, out var even) && (odd >= x - 1 || even + odd / 2 * 2 >= x - 1))
                {
                    write("Yes");
                    return;
                }
            }
            write("No");
        }
        private static void iqTest()
        {
            readString();
            int evens = 0, odds = 0, lastEven = 0, lastOdd = 0, i = 1;
            foreach (var n in readValues<int>())
            {
                if (n % 2 == 0)
                {
                    ++evens;
                    lastEven = i;
                }
                else
                {
                    ++odds;
                    lastOdd = i;
                }
                if (evens > 1 && odds == 1)
                {
                    write(lastOdd);
                    break;
                }
                else if (evens == 1 && odds > 1)
                {
                    write(lastEven);
                    break;
                }
                ++i;
            }
        }
        private static void registration()
        {
            var n = readValue<int>();
            var names = new Dictionary<string, int>();
            for (int j = 0; j < n; ++j)
            {
                var name = readString();
                if (!names.TryGetValue(name, out var i))
                {
                    names.Add(name, 1);
                    write("OK");
                }
                else
                {
                    names[name] += 1;
                    write($"{name}{i}");
                }
            }
        }
        private static void cutRibbon()
        {
            var input = readValues<int>();
            var n = input[0];
            var a = input.GetRange(1, 3).OrderBy(x => x).ToList();
            if (n % a[0] == 0)
                write(n / a[0]);
            else
            {
                if (a[1] % a[0] == 0)
                {
                    a.RemoveAt(1);
                    if (a[1] % a[0] == 0)
                        a.RemoveAt(1);
                }
                else if (a[2] % a[0] == 0 || a[2] % a[1] == 0 || a[2] % (a[0] + a[1]) == 0)
                    a.RemoveAt(2);

                if (a.Count == 2)
                {
                    int i = n / a[0] - 1, j = 1;
                    while (i * a[0] + j * a[1] != n)
                        if (i * a[0] + j * a[1] < n)
                            ++j;
                        else
                            --i;
                    write(i + j);
                }
                else
                {
                    int max = 0;
                    var stack = new Stack<Tuple<int, int>>();
                    stack.Push(new Tuple<int, int>(n - a[0] - n % a[0], n / a[0] - 1));
                    while (stack.Count > 0)
                    {
                        var item = stack.Pop();
                        for (int i = 0; i < 3; ++i)
                            if (item.Item1 + a[i] == n)
                            {
                                if (item.Item2 + 1 > max)
                                    max = item.Item2 + 1;
                            }
                            else if (item.Item1 + a[i] < n)
                                stack.Push(new Tuple<int, int>(item.Item1 + a[i], item.Item2 + 1));
                    }
                    write(max);
                }
            }
        }
        private static void TPrime()
        {
            readString();
            foreach (var x in readValues<long>())
                if (x % 2 == 0)
                    write(x == 4 ? "YES" : "NO");
                else
                {
                    long i = 3;
                    for (; i < x / 2 && x % i > 0; i += 2) ;
                    if (i == x / 2)
                        write("NO");
                    else
                    {
                        for (i += 2; i < x / 2 && x % i > 0; i += 2) ;
                        write(i == x / 2 ? "YES" : "NO");
                    }
                }
        }
        private static void birthday()
        {
            readString();
            var a = readValues<int>();
            quickSort(a);
            var sb = new StringBuilder(a[0].ToString());
            for (int i = 2; i < a.Count; i += 2)
            {
                sb.Append(' ');
                sb.Append(a[i]);
            }
            for (int i = a.Count - (a.Count % 2 == 0 ? 1 : 2); i > 0; i -= 2)
            {
                sb.Append(' ');
                sb.Append(a[i]);
            }
            write(sb.ToString());
        }
        private static void snowWalkingRobot()
        {
            var str = readString();
            var s = new Dictionary<char, int> { { 'L', 0 }, { 'R', 0 }, { 'U', 0 }, { 'D', 0 } };
            for (int i = 0; i < str.Length; ++i)
                s[str[i]] += 1;
            int minLR = Math.Min(s['L'], s['R']), minDU = Math.Min(s['D'], s['U']);
            if (minDU == 0 && minLR == 0)
                write(0);
            else if (minDU == 0 || minLR == 0)
            {
                write(2);
                write(minDU == 0 ? "LR" : "UD");
            }
            else
            {
                write(minLR * 2 + minDU * 2);
                var sb = new StringBuilder();
                for (int i = 0; i < minLR; ++i)
                    sb.Append('L');
                for (int i = 0; i < minDU; ++i)
                    sb.Append('D');
                for (int i = 0; i < minLR; ++i)
                    sb.Append('R');
                for (int i = 0; i < minDU; ++i)
                    sb.Append('U');
                write(sb.ToString());
            }
        }
        private static void nextTest()
        {
            readString();
            var a = readValues<int>();
            quickSort(a);
            if (a[0] > 1)
                write(1);
            else if (a[a.Count - 1] == a.Count)
                write(a.Count + 1);
            else
                for (int i = 0; i < a.Count - 1; ++i)
                    if (a[i] + 1 < a[i + 1])
                    {
                        write(a[i] + 1);
                        return;
                    }
        }
        private static void emailPolycarp()
        {
            var n = readValue<int>();
            for (int i = 0; i < n; ++i)
            {
                string s = readString(), t = readString();
                if (s[0] != t[0])
                    write("NO");
                else
                {
                    int j1 = 1, j2 = 1;
                    for (; j1 < s.Length && j2 < t.Length; ++j1, ++j2)
                        if (s[j1] != t[j2])
                        {
                            for (; j2 < t.Length && s[j1 - 1] == t[j2]; ++j2) ;
                            if (j2 == t.Length || s[j1] != t[j2])
                                break;
                        }
                    if (j1 == s.Length)
                        for (; j2 < t.Length && s[j1 - 1] == t[j2]; ++j2) ;
                    write(j1 == s.Length && j2 == t.Length ? "YES" : "NO");
                }
            }
        }
        private static void alphabeticRemovals()
        {
            var k = readValues<int>()[1];
            var s = readString();

            var indexesToRemove = new HashSet<int>();
            var characters = new Dictionary<char, List<int>>();
            for (int i = 0; i < s.Length && k > 0; ++i)
                if (s[i] == 'a')
                {
                    indexesToRemove.Add(i);
                    --k;
                }
                else if (!characters.TryGetValue(s[i], out var indexes))
                    characters.Add(s[i], new List<int> { i });
                else
                    indexes.Add(i);

            for (char x = 'b'; k > 0; ++x)
                if (characters.TryGetValue(x, out var indexes))
                    for (int i = 0; i < indexes.Count && k > 0; ++i, --k)
                        indexesToRemove.Add(indexes[i]);

            var sb = new StringBuilder();
            for (int i = 0; i < s.Length; ++i)
                if (!indexesToRemove.Contains(i))
                    sb.Append(s[i]);
            write(sb.ToString());
        }
        private static void doorsBreakingAndRepairing()
        {
            var input = readValues<int>();
            int n = input[0], x = input[1], y = input[2];
            var a = readValues<int>().Count(a => a <= x);
            write(x > y ? n : a / 2 + a % 2);
        }
        private static void filyaHomework()
        {
            readString();
            var a = readValues<int>().Distinct().ToList();
            switch (a.Count)
            {
                case 1:
                case 2:
                    write("YES");
                    break;
                case 3:
                    a.Sort();
                    write(a[1] - a[0] == a[2] - a[1] ? "YES" : "NO");
                    break;
                default:
                    write("NO");
                    break;
            }
        }
        private static void polycarpPractice()
        {
            var k = readValues<int>()[1];
            var a = readValues<int>();

            if (k == 1)
            {
                write(a.Max());
                write(a.Count);
            }
            else
            {
                var l = new List<Tuple<int, int>>();
                for (int i = 0; i < a.Count; ++i)
                    l.Add(new Tuple<int, int>(i, a[i]));
                l = l.OrderByDescending(x => x.Item2).Take(k).OrderBy(x => x.Item1).ToList();

                write(l.Sum(x => x.Item2));
                var sb = new StringBuilder();
                sb.Append(l[0].Item1 + 1);
                for (int i = 1; i < l.Count - 1; ++i)
                {
                    sb.Append(' ');
                    sb.Append(l[i].Item1 - l[i - 1].Item1);
                }
                sb.Append(' ');
                sb.Append(a.Count - l[l.Count - 2].Item1 - 1);
                write(sb.ToString());
            }
        }
        private static void vladikFlights()
        {
            var input = readValues<int>();
            int a = input[1] - 1, b = input[2] - 1;
            var n = readString();
            write(a == b || n[a] == n[b] ? 0 : 1);
        }
        private static void cellsNotUnderAttack()
        {
            var input = readValues<int>();
            int n = input[0], m = input[1];
            long cellsNotUnderAttack = (long)n * (long)n;
            HashSet<int> rowsUnderAttack = new HashSet<int>(), columnsUnderAttack = new HashSet<int>();
            var result = new List<long>();
            for (int i = 0; i < m; ++i)
            {
                input = readValues<int>();
                if (!rowsUnderAttack.Contains(input[0]))
                {
                    rowsUnderAttack.Add(input[0]);
                    cellsNotUnderAttack -= n - columnsUnderAttack.Count;
                }
                if (!columnsUnderAttack.Contains(input[1]))
                {
                    columnsUnderAttack.Add(input[1]);
                    cellsNotUnderAttack -= n - rowsUnderAttack.Count;
                }
                result.Add(cellsNotUnderAttack);
            }
            write(string.Join(' ', result));
        }
        private static void examBerSU()
        {
            var m = readValues<int>()[1];
            var t = readValues<int>();

            var result = new List<int> { 0 };
            for (int i = 1; i < t.Count; ++i)
            {
                var tSub = t.GetRange(0, i);
                quickSort(tSub);
                int j = 0;
                for (int k = m - t[i]; j < tSub.Count && k - tSub[j] >= 0; k -= tSub[j++]) ;
                result.Add(tSub.Count - j);
            }
            write(string.Join(' ', result));
        }
        #region dishonestSellers
        private class dishonestSellersPrice : IComparable
        {
            internal int DiscountPrice { get; private set; }
            internal int Price { get; private set; }
            internal int Discount => Price - DiscountPrice;
            internal dishonestSellersPrice(int discountPrice, int price) { DiscountPrice = discountPrice; Price = price; }
            public int CompareTo(object obj) => Discount - ((dishonestSellersPrice)obj).Discount;
        }
        private static void dishonestSellers()
        {
            int k = readValues<int>()[1], i, sum = 0;
            List<int> a = readValues<int>(), b = readValues<int>();

            var prices = new List<dishonestSellersPrice>();
            for (i = 0; i < a.Count; ++i)
                prices.Add(new dishonestSellersPrice(a[i], b[i]));
            quickSort(prices);
            i = 0;
            for (; i < k; sum += prices[prices.Count - i++ - 1].DiscountPrice) ;
            for (; i < prices.Count; sum += Math.Min(prices[prices.Count - i - 1].DiscountPrice, prices[prices.Count - i - 1].Price), ++i) ;
            write(sum);
        }
        #endregion
        private static void minimizeString()
        {
            readString();
            string s = readString(), min = s.Substring(0, s.Length - 1);
            if (s[1] < s[0])
            {
                var t = s.Substring(1);
                if (t.CompareTo(min) < 0)
                    min = t;
            }
            for (int i = 1; i < s.Length - 1; ++i)
                if (s[i + 1] < s[i])
                {
                    var t = s.Substring(0, i) + s.Substring(i + 1);
                    if (t.CompareTo(min) < 0)
                        min = t;
                }
            write(min);
        }
        private static void sortArray()
        {
            readString();
            var a = readValues<int>();

            bool sorted = true;
            for (int i = 1; i < a.Count; ++i)
                if (a[i] < a[i - 1])
                {
                    sorted = false;
                    break;
                }
            if (sorted)
            {
                write("yes");
                write("1 1");
            }
            else
            {
                var aSorted = new List<int>(a);
                quickSort(aSorted);
                int start = 0;
                for (; start < a.Count && a[start] == aSorted[start]; ++start) ;
                if (start == a.Count)
                {
                    write("yes");
                    write("1 1");
                }
                else
                {
                    int end = a.Count - 1;
                    for (; end > start && a[end] == aSorted[end]; --end) ;
                    if (start == end)
                    {
                        write("yes");
                        write($"{start + 1} {start + 1}");
                    }
                    else
                    {
                        for (int i = start, j = end; i <= end; ++i, --j)
                            if (a[i] != aSorted[j])
                            {
                                write("no");
                                return;
                            }
                        write("yes");
                        write($"{start + 1} {end + 1}");
                    }
                }
            }
        }
        private static void kthBeautifulString()
        {
            var input = readValues<int>();
            int n = input[0], k = input[1], x1 = n - 2;

            for (int i = 1; k > i; k -= i++, --x1) ;

            var sb = new StringBuilder();
            for (int i = 0; i < x1; ++i)
                sb.Append('a');
            sb.Append('b');
            for (int i = x1 + 1; i < n - k; ++i)
                sb.Append('a');
            sb.Append('b');
            for (int i = n - k + 1; i < n; ++i)
                sb.Append('a');
            write(sb.ToString());
        }
        private static void antiSudoku()
        {
            var j = new int[] { 0, 3, 6, 1, 4, 7, 2, 5, 8 };
            for (int i = 0; i < 9; ++i)
            {
                var s = readString();
                var sb = new StringBuilder(s.Substring(0, j[i]));
                sb.Append(((Convert.ToInt32(s[j[i]]) + 1) % 9 + 1).ToString()[0]);
                sb.Append(s.Substring(j[i] + 1));
                write(sb.ToString());
            }
        }
        private static void buyingShovels()
        {
            var input = readValues<int>();
            int n = input[0], k = input[1];
            if (k >= n)
                write(1);
            else
            {
                for (int i = 2; i < n / 2; ++i)
                    if (n % i == 0 && n / i <= k)
                    {
                        write(i);
                        return;
                    }
                write(n);
            }
        }
        private static void lastClassOfMath()
        {
            var n = readValue<int>();
            if (n % 2 == 0)
                write($"{n / 2} {n / 2}");
            else
            {
                for (int i = 3; i <= n / 2; i += 2)
                    if (n % i == 0)
                    {
                        write($"{n / i} {n - n / i}");
                        return;
                    }
                write($"1 {n - 1}");
            }
        }

        static void Main()
        {
            var t = readValue<int>();
            for (int i = 0; i < t; ++i)
                lastClassOfMath();
        }
    }
}


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

namespace ConsoleApp1
{
    class Class07112
    {
        static void Main(string[] args)
        {
            String num = Console.ReadLine();
            int repeat = Convert.ToInt32(num);
            for (int i = 0; i < repeat; i++)
            {
                long n = Convert.ToInt64(Console.ReadLine());
                if(n % 2 == 0)
                {
                    Console.WriteLine(n/2 + " " + n/2);
                }
                else
                {
                    if (isPrime(n))
                    {
                        Console.WriteLine(1 + " " + (n - 1));
                    }
                    else
                    {
                        for(long j = n/2; j > 1; j--)
                        {
                                if (n % j == 0)
                                {
                                    long t = n / j;
                                    Console.WriteLine(j + " " + j*(t-1));
                                    break;
                                }
                        }
                    }
                }
            }
            //Console.Read();
        }
        static bool isPrime(long a)
        {
            if (a < 4) return true;
            for (long i = 2; i <= Math.Sqrt(a); i++)
            {
                if(a%i == 0)
                {
                    return false;
                }
            }
            return true;
        }
            }
}


using System;

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

            while (t-- > 0)
            {
                var n = int.Parse(Console.ReadLine());

                if (n % 2 == 0)
                {
                    var a = n / 2;
                    Console.WriteLine(a + " " + a);
                    continue;
                }

                for (int i = 3; i <= n; i += 2)
                {
                    if (n % i == 0)
                    {
                        var k = n / i;
                        var a = 1;
                        var b = i - 1;
                        a = a * k;
                        b = b * k;
                        Console.WriteLine(a + " " + b);
                        break;

                    }
                }

            }
        }
    }
}


using System;

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

            while (t-- > 0)
            {
                var n = int.Parse(Console.ReadLine());

                if (n % 2 == 0)
                {
                    var a = n / 2;
                    Console.WriteLine(a + " " + a);
                    continue;
                }

                int b = 0;
                for (int i = 3; i <= n; i += 2)
                {
                    if (n % i == 0)
                    {
                        b = i;
                    }
                }
                if (b == 0)
                {
                    Console.WriteLine("1 " + n);
                }
                else
                {
                    var k = n / i;
                    var a = 1;
                    var b = i - 1;
                    a = a * k;
                    b = b * k;
                    Console.WriteLine(a + " " + b);
                    break;

                }

            }
        }
    }
}


using System;
using System.Collections.Generic;

namespace TaskB
{
    class Program
    {
        private static Queue<string> queue;

        static void Main(string[] args)
        {
            int t = NextInt();

            for (int i = 0; i < t; i++)
            {
                Solve();
            }
        }

        private static string ReadLine()
        {
            return Console.In.ReadLine();
        }

        private static readonly char[] d = { ' ', '\n', '\t', '\r' };
        private static string NextString()
        {
            if (queue == null || queue.Count == 0)
            {
                var nl = ReadLine();
                if (nl == null)
                {
                    return null;
                }

                queue = new Queue<string>(nl.Split(d, StringSplitOptions.RemoveEmptyEntries));
            }

            return queue.Dequeue();
        }

        private static int NextInt()
        {
            return int.Parse(NextString());
        }

        private static long NextLong()
        {
            return long.Parse(NextString());
        }

        private static void Solve()
        {
            var n = NextLong();

            var t = n / 2;
            while (true)
            {
                var a = t;
                var b = n - t;

                if (a % b == 0 || b % a == 0)
                {
                    Console.WriteLine(a + " " + b);
                    return;
                }

                t--;
            }
        }

        private static long Gcd(long a, long b)
        {
            if (a == 0) return b;
            return Gcd(b % a, a);
        }
    }
}


using System;

namespace task1
{
    class Program
    {
        public static int Gcd(int a, int b)
        {
            return b != 0 ? Gcd(b, a % b) : a;
        }

        public static int NOK(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            for (int i = 0; i < t; i++)
            {
                int n = int.Parse(Console.ReadLine());
                /*if (n >= 100000)
                {
                    Console.WriteLine($"{1} {n - 1}");
                    continue;
                }*/
                int a = 1, b = n - 1, nok = NOK(a, b);
                int minA = a, minB = b, minNOK = nok;
                for (a = 2; a <= n / 2; a++)
                {
                    b = n - a;
                    nok = NOK(a, b);
                    if (nok < minNOK)
                    {
                        minNOK = nok;
                        minA = a;
                        minB = b;
                    }
                }
                Console.WriteLine($"{minA} {minB}");
            }
        }
    }
}


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

namespace B
{
    class Program
    {
        static long LargestProperFactor(long n)
        {
            for (long i = n - 1; i > 0; i--)
                if (n % i == 0)
                    return i;
            //unreachable
            return -1;
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            while (t-- > 0)
            {
                long n = long.Parse(Console.ReadLine());
                if (n % 2 == 0)
                    Console.WriteLine(n / 2 + " " + n / 2);
                else
                {
                    long k = LargestProperFactor(n);
                    Console.WriteLine(k + " " + (n - k));
                }
            }
            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
  class Program
    {

        public static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        public static void ReadIntPair(out int a, out int b)
        {
            var ar = ReadIntArray();
            a = ar[0];
            b = ar[1];
        }
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

static void Main(string[] args){

            var n=ReadInt();
          for(int i=0;i<n;i++){
              var t=ReadInt();
              int maxd=1;

              for(int j=1;j<=t/2;j++){
                  if(t%j==0){
                      maxd=j;
                  }
              }

              Console.WriteLine(maxd+" "+(t-maxd));
          }

    }}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CodeforcesRound655Div2.Extensions;
using CodeforcesRound655Div2.Questions;

namespace CodeforcesRound655Div2.Questions
{
    public class QuestionB : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var tests = inputStream.ReadInt();
            for (int t = 0; t < tests; t++)
            {
                var n = inputStream.ReadInt();
                var divs = GetDivisiors(n).Where(i => i != n);

                var minA = int.MaxValue;
                var minLcm = long.MaxValue;

                foreach (var div in divs)
                {
                    var a = div;
                    var b = n - a;
                    var lcm = Lcm(a, b);
                    if (lcm < minLcm)
                    {
                        minA = a;
                        minLcm = lcm;
                    }
                }

                var minB = n - minA;

                yield return $"{minA} {minB}";
            }
        }

        IEnumerable<int> GetDivisiors(int n)
        {
            for (int i = 1; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    yield return i;
                    if (i * i != n)
                    {
                        yield return n / i;
                    }
                }
            }
        }

        public static long Gcd(long a, long b)
        {
            if (a < b)
            {
                (a, b) = (b, a);
            }

            if (b == 0)
            {
                return a;
            }
            else
            {
                return Gcd(b, a % b);
            }
        }

        public static long Lcm(long a, long b)
        {
            if (a < 0 || b < 0)
            {
                throw new ArgumentOutOfRangeException($"{nameof(a)}, {nameof(b)}は0以上の整数である必要があります。");
            }

            return a / Gcd(a, b) * b;
        }

    }
}

namespace CodeforcesRound655Div2
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionD();
            var answers = question.Solve(Console.In);

            var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(writer);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
            Console.Out.Flush();
        }
    }
}

#region Base Class

namespace CodeforcesRound655Div2.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }
}

#endregion

#region Extensions

namespace CodeforcesRound655Div2.Extensions
{
    public static class StringExtensions
    {
        public static string Join<T>(this IEnumerable<T> source) => string.Concat(source);
        public static string Join<T>(this IEnumerable<T> source, string separator) => string.Join(separator, source);
    }

    public static class TextReaderExtensions
    {
        public static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        public static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        public static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        public static string ReadString(this TextReader reader) => reader.ReadLine();

        public static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        public static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        public static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        public static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);

        // Supports primitive type only.
        public static T1 ReadValue<T1>(this TextReader reader) => (T1)Convert.ChangeType(reader.ReadLine(), typeof(T1));

        public static (T1, T2) ReadValue<T1, T2>(this TextReader reader, char separator = ' ')
        {
            var inputs = ReadStringArray(reader, separator);
            var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));
            var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));
            return (v1, v2);
        }

        public static (T1, T2, T3) ReadValue<T1, T2, T3>(this TextReader reader, char separator = ' ')
        {
            var inputs = ReadStringArray(reader, separator);
            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 static (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>(this TextReader reader, char separator = ' ')
        {
            var inputs = ReadStringArray(reader, separator);
            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 static (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>(this TextReader reader, char separator = ' ')
        {
            var inputs = ReadStringArray(reader, separator);
            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 static (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>(this TextReader reader, char separator = ' ')
        {
            var inputs = ReadStringArray(reader, separator);
            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 static (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>(this TextReader reader, char separator = ' ')
        {
            var inputs = ReadStringArray(reader, separator);
            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);
        }
    }
}

#endregion


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

    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 n = int.Parse(Console.ReadLine());
                var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
                var fit = new bool[n];
                var contest = new bool[n];
                var resArrays = new List<List<int>>();
                //resArrays.Add();
                for(int i = 0;i<input.Count;i++)
                {
                    var val = input[i];
                    if ( val== 0)
                    {
                        fit[i] = false;
                        contest[i] = false;
                    }
                    else if (val == 1)
                    {
                        fit[i] = false;
                        contest[i] = true;
                    }
                    else if (val == 2)
                    {
                        fit[i] = true;
                        contest[i] = false;
                    }
                    else//val==3
                    {
                        fit[i] = true;
                        contest[i] = true;
                    }

                    if (i == 0)
                    {
                        if (fit[i] && contest[i])
                        {
                            resArrays.Add(new List<int>(){1});
                            resArrays.Add(new List<int>(){2});
                        }
                        else if(fit[i] && !contest[i])
                            resArrays.Add(new List<int>(){1});
                        else if (!fit[i] && contest[i])
                            resArrays.Add(new List<int>() { 2 });
                        else
                            resArrays.Add(new List<int>() { 0 });
                    }
                    else
                    {
                        var newArr = new List<int>();
                        for (int j = 0;j<resArrays.Count;j++)
                        {
                            var prev = resArrays[j][i - 1];
                            var decision = Decide(fit[i], contest[i], prev);
                            if (decision == -1)
                            {
                                newArr = resArrays[j];
                                newArr.Add(2);
                                resArrays[j].Add(1);
                            }
                            else
                            {
                                resArrays[j].Add(decision);
                            }
                        }
                       resArrays.Add(newArr);
                    }
                }
                var min = n;
                foreach (var resArray in resArrays)
                {
                    var val = resArray.Count(x => x == 0);
                    min = Math.Min(min, val);
                }
                Console.WriteLine(min);
            }

            int Decide(bool fit, bool contest, int prev)
            {
                if (!fit && !contest)
                    return 0;

                if (prev == 0)
                {
                    if (fit && !contest)
                        return 1;
                    if (contest && !fit)
                        return 2;
                }

                if (prev == 1)
                {
                    return contest ? 2 : 0;
                }

                if (prev == 2)
                {
                    return fit ? 1 : 0;
                }
                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();
            }
        }
    }


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

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

	internal class Task
	{
		private int n;
		private int[] array;

		public void Solve(InputReader sr, TextWriter sw)
		{
			n = sr.NextInt32();
			array = sr.ReadArray(Int32.Parse);
			var answ = Max(0, 0, 0);

			sw.WriteLine(n - answ);
		}

		public int Max(int indx, int prev, int currVal)
		{
			if (indx == n)
				return currVal;

			var next = array[indx];
			if (next == 0) {
				return Max(indx + 1, 0, currVal);
			}
			if (next == 1) {
				if (prev == 1) {
					return Max(indx + 1, 0, currVal);
				}
				if (prev == 2 || prev == 0) {
					return Max(indx + 1, 1, currVal + 1);
				}
			}
			if (next == 2) {
				if (prev == 2) {
					return Max(indx + 1, 0, currVal);
				}
				if (prev == 1 || prev == 0) {
					return Max(indx + 1, 2, currVal + 1);
				}
			}
			if (next == 3) {
				if (prev == 1) {
					return Max(indx + 1, 2, currVal + 1);
				}
				if (prev == 2) {
					return Max(indx + 1, 1, currVal + 1);
				}
				if (prev == 0) {
					return Math.Max(Max(indx + 1, 2, currVal + 1), Max(indx + 1, 1, currVal + 1));
				}
			}

			return 0;
		}
	}
}

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

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

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

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

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

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

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

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

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

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

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


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

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

	internal class Task
	{
		private int[] array;

		public void Solve(InputReader sr, TextWriter sw)
		{
			var n = sr.NextInt32();
			array = sr.ReadArray(Int32.Parse);
			var answ = Max(0, 0, 0, n);

			sw.WriteLine(n - answ);
		}

		public int Max(int indx, int prev, int currVal, int n)
		{
			if (indx == n)
				return currVal;

			var next = array[indx];
			if (next == 0) {
				return Max(indx + 1, 0, currVal, n);
			}
			if (next == 1) {
				if (prev == 1) {
					return Max(indx + 1, 0, currVal, n);
				}
				if (prev == 2 || prev == 0) {
					return Max(indx + 1, 1, currVal + 1, n);
				}
			}
			if (next == 2) {
				if (prev == 2) {
					return Max(indx + 1, 0, currVal, n);
				}
				if (prev == 1 || prev == 0) {
					return Max(indx + 1, 2, currVal + 1, n);
				}
			}
			if (next == 3) {
				if (prev == 1) {
					return Max(indx + 1, 2, currVal + 1, n);
				}
				if (prev == 2) {
					return Max(indx + 1, 1, currVal + 1, n);
				}
				if (prev == 0) {
					var nextIndx = indx + 1;
					while (nextIndx < array.Length && array[nextIndx] != 0) {
						nextIndx++;
					}
					var resVal1 = Max(indx + 1, 2, currVal + 1, nextIndx);
					var resVal2 = Max(indx + 1, 1, currVal + 1, nextIndx);
					return Max(nextIndx + 1, 0, Math.Max(resVal1, resVal2), n);
				}
			}

			return 0;
		}
	}
}

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

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

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

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

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

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

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

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

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

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

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


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

namespace CodeForces
{
    class A
    {
        static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split();
            long n = long.Parse(token[0]);
            long s = long.Parse(token[1]);
            string nInS = n.ToString();
            long nDigitSum = 0;

            for (int i = 0; i < nInS.Length; i++)
            {
                nDigitSum += nInS[i];
            }

            long num = n - nDigitSum;

            long nsDiff = n - s + 1;
            string sDigits = s.ToString();
            string newSDigits = "";
            if (sDigits.Length == 1)
            {
                newSDigits = "0";
            }
            else
            {
                for (int i = 0; i < sDigits.Length - 1; i++)
                {
                    newSDigits += sDigits[i];
                }
            }
            long newSNums = (int.Parse(newSDigits) + 1) * 10;
            long groupNum = nsDiff - (newSNums - s);

            Console.WriteLine(Math.Max(0,groupNum));

            Console.Read();
        }

    }
}


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

namespace CodeForces
{
    class A
    {
        static void Main(string[] args)
        {
            string[] token = Console.ReadLine().Split();
            long n = long.Parse(token[0]);
            long s = long.Parse(token[1]);
            string nInS = n.ToString();
            long nDigitSum = 0;

            for (int i = 0; i < nInS.Length; i++)
            {
                nDigitSum += nInS[i];
            }

            long num = n - nDigitSum;

            long nsDiff = n - s + 1;
            string sDigits = s.ToString();
            string newSDigits = "";
            if (sDigits.Length == 1)
            {
                newSDigits = "0";
            }
            else
            {
                for (int i = 0; i < sDigits.Length - 1; i++)
                {
                    newSDigits += sDigits[i];
                }
            }
            long newSNums = (long.Parse(newSDigits) + 1) * 10;
            long groupNum = nsDiff - (newSNums - s);

            Console.WriteLine(Math.Max(0,groupNum));

            Console.Read();
        }

    }
}


using Codeforces.Common;
using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Xml.Schema;

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

        public static void Solve(TextReader tr, TextWriter tw)
        {
            Contract.Requires(tr != null);
            Contract.Requires(tw != null);

            tw.WriteLine(Parse(tr));
        }

        private static int Parse(TextReader tr)
        {
            var l = tr.ReadLine();

            return Calc(l);
        }

        public static int Calc(string value)
        {
            Contract.Requires(value != null);

            var n = value.Length;
            var res = 0L;
            const int mod = 1000000007;

            foreach (char c in value)
            {
                res <<= 1;
                res += c == '1' ? 1 : 0;
                res %= mod;
            }

            return (int)(res * ModPow(2, n - 1, mod) % mod);
        }

        public static long ModPow(long x, int n, int mod)
        {
            var res = 1L;
            for (; n > 0; n >>= 1)
            {
                if ((n & 1) == 1)
                {
                    res = res * x % mod;
                }
                x = x * x % mod;
            }
            return res;
        }

    }
}


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

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

            int n = int.Parse(Console.ReadLine());
            int[] arr = new int[n];
            string[] s= Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                arr[i] = int.Parse(s[i]);
            }
            Array.Sort(arr);
            bool ans1 = false;
            bool ans2 = false;
            int d = arr[n - 1] - arr[0];
            int a = (arr[0] + arr[n - 1]) / 2;
            int c = arr[n - 1] - a;
            for (int i = 0; i < n; i++)
            {
                if (arr[i] + d == arr[n - 1] || arr[i] == arr[n - 1])
                {
                    ans1 = true;
                }
                else
                {
                    ans1 = false;
                    break;
                }
            }
            for (int i = 0; i < n; i++)
            {
                if (arr[i] + c == a || arr[i] == a || arr[i] - c == a)
                {
                    ans2 = true;
                }
                else
                {
                    ans2 = false;
                    break;
                }
            }
            if (ans2 == true)
            {
               Console.WriteLine(c);
            }
            else
            {
                if (ans1 == true)
                {
                    Console.WriteLine(d);
                }
                else
                {
                    Console.WriteLine(-1);
                }
            }
    }
}


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

namespace CodeForceCondole
{
    class Program
    {
        static void Main(string[] args)
        {
            ulong n = Convert.ToUInt64(Console.ReadLine()); //стоимость секретов n - марок
            while (n % 3 == 0)
                n /= 3;
            Console.WriteLine(n / 3 + 1);
            Main(null);
        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            long n=int.Parse(Console.ReadLine());
            if (n % 3 == 0 || n == 1) { Console.WriteLine("1"); return; }
            Console.WriteLine(n / 3 + 1);

            //Console.ReadKey();
        }
    }
}


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

namespace CodeForceCondole
{
    class Program
    {
        static void Main(string[] args)
        {
            ulong n = Convert.ToUInt32(Console.ReadLine()); //стоимость секретов n - марок
            while (n % 3 == 0)
                n /= 3;
            Console.WriteLine(n / 3 + 1);
        }
    }
}


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

namespace Codeforces
{
    class B
    {
        private static ThreadStart s_threadStart = new B().Go;

        private void Go()
        {
            string s = GetString();
            char[] ar = s.ToCharArray();
            char next = 'a';

            for (int i = 0; i < s.Length; i++)
            {
                if (ar[i] <= next)
                    continue;
                if (ar[i] > next + 1)
                {
                    Wl("NO");
                    return;
                }

                next++;
            }

            Wl("YES");
        }

        #region Template

        private static StringBuilder output = new StringBuilder();

        public static void Main(string[] args)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            output.Length = 0;
            Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);
            timer.Start();
            main.Start();
            main.Join();
            Console.Write(output);
            timer.Stop();
            Console.Error.WriteLine(timer.ElapsedMilliseconds);
        }

        private static IEnumerator<string> ioEnum;
        private static string GetString()
        {
            do
            {
                while (ioEnum == null || !ioEnum.MoveNext())
                {
                    ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();
                }
            } while (string.IsNullOrEmpty(ioEnum.Current));

            return ioEnum.Current;
        }

        private static int GetInt()
        {
            return int.Parse(GetString());
        }

        private static long GetLong()
        {
            return long.Parse(GetString());
        }

        private static double GetDouble()
        {
            return double.Parse(GetString());
        }

        private static List<int> GetIntArr(int n)
        {
            List<int> ret = new List<int>(n);
            for (int i = 0; i < n; i++)
            {
                ret.Add(GetInt());
            }
            return ret;
        }

        private static void Wl<T>(T o)
        {
            W(o);
            output.Append(Console.Out.NewLine);
        }

        private static void Wl<T>(IEnumerable<T> enumerable)
        {
            W(enumerable);
            output.Append(Console.Out.NewLine);
        }

        private static void W<T>(T o)
        {
            if (o is double)
            {
                Wd((o as double?).Value, "");
            }
            else if (o is float)
            {
                Wd((o as float?).Value, "");
            }
            else
                output.Append(o.ToString());
        }

        private static void W<T>(IEnumerable<T> enumerable)
        {
            W(string.Join(" ", enumerable.Select(e => e.ToString()).ToArray()));
        }

        private static void Wd(double d, string format)
        {
            W(d.ToString(format, CultureInfo.InvariantCulture));
        }

        #endregion
    }
}


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

namespace _1236B
{
    class Class1
    {
        public static void Main()
        {
            long[] input = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
            long twopow = 1;

            for (long i = 0; i < input[1]; i++)
            {
                twopow *= 2;
                twopow %= 10000000000 + 7;
            }

            long num = twopow - 1;
            long ans = 1;

            for (long i = 0; i < input[0]; i++)
            {
                ans *= num;
                ans %= 10000000000 + 7;
            }

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


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

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

            var nm = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var n = nm[0];
            var m = nm[1];

            var result = PowerMod(PowerMod(2, m) - 1, n);
            Console.WriteLine(result);
        }

        static long PowerMod(long number, long power)
        {
            long res = 1;
            for(var i=0; i<power; i++)
            {
                res = (res * number) % 1000000007;
            }
            return res;
        }
    }
}


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

class Program
{
    private static void Main()
    {
        //InputFromFile();
        long[] nm = ConsoleReadLineAsArrayOfLongs();
        long n = nm[0];
        long m = nm[1];

        long x = poww((poww(2, m) - 1), n);

        ConsoleWriteLine("" + x);
    }

    private static long modulo = 1000000000 + 7;

    private static long poww(long a, long b)
    {
        long x = 1;
        for(int i = 0; i < b; ++i)
        {
            x *= a;
            x %= modulo;
        }
        return x;
    }

    private static void InputFromFile()
    {
        Console.SetIn(File.OpenText("input.txt"));
    }

    private static long[] ConsoleReadLineAsArrayOfLongs()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt64(n)).ToArray();
    }

    private static int[] ConsoleReadLineAsArrayOfIntegers()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();
    }

       private static int[] ConsoleReadLineAsArrayOfIntegersReversed()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).Reverse().ToArray();
    }

    private static long ConsoleReadLineAsLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }

    private static int ConsoleReadLineAsInteger()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    private static void ConsoleWriteLine(string line)
    {
        Console.WriteLine(line);
    }
}


using System;

namespace CodefCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tokens = Console.ReadLine().Split();

            long n = int.Parse(tokens[0]);
            long k=  int.Parse(tokens[1]);

            Console.WriteLine($"{n / 2 / (k + 1)} {n / 2 / (k + 1) * k} {n - n / 2 / (k + 1) - n / 2 / (k + 1) * k}");
        }
    }
}


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

class Program
{
    private static void Main(string[] args)
    {
        var n = RL();
        var k = RL();

        long half = (n / 2);

        long l = 0;
        long r = n + 1;
        while (r - l > 1)
        {
            var mid = (l + r) / 2;
            var cnt = (k + 1) * mid;
            if (cnt <= half)
                l = mid;
            else
                r = mid;
        }

        long a = l;
        long b = l * k;
        long c = n - a - b;
        Console.WriteLine(a + " " + b + " " + c);
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

    private static long GCD(long a, long b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadTree(int n)
    {
        return ReadGraph(n, n - 1);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = RI() - 1;
            int b = RI() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = RI();
            int b = RI();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int RI()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong RUL()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long RL()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] RIA(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = RI();
        return ans;
    }

    private static long[] RLA(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = RL();
        return ans;
    }

    private static char[] ReadWord()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*')));

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*'));

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

    private static char[] ReadStringLine()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13 && ans != -1);

        return s.ToArray();
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }
    private static char ReadNonLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))
                return (char)ans;
        }
    }

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        return ReadDigit() - (int)'0';
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}