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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            long l;
            long r;
            string readStr = System.Console.ReadLine();
            string[] arg = readStr.Split(' ');
            l = long.Parse(arg[0]);
            r = long.Parse(arg[1]);

            System.Console.Write("{0}", palindrom(r) - palindrom(l-1));
        }

        public static long palindrom(long arg)
        {
            string str = arg.ToString();

            if (str.Length == 1)
                return long.Parse(str[0].ToString());
            else
            {
                long res = 0;
                for (int i = 2; i <= str.Length-1; i++)
                {
                    res += (long)System.Math.Pow(10, i - 2) * 9;
                }

                int firstDigit = int.Parse(str[0].ToString());
                int lastDigit = int.Parse(str[str.Length - 1].ToString());
                int min = System.Math.Min(firstDigit, lastDigit);
                int max = System.Math.Max(firstDigit, lastDigit);

                res += (long)System.Math.Pow(10, str.Length - 2) * (firstDigit-1);
                res += 9;

                string s = str.Remove(0, 1);
                s = s.Remove(s.Length - 1, 1);
                if (s == "")
                    res++;
                else res += long.Parse(s) + 1;

                if (firstDigit > lastDigit)
                    res--;

                return res;
            }
        }
    }
}


using System;
using System.Linq;

namespace codeforces
{

    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int x = n[0], y = n[1], z = n[2], t1 = n[3], t2 = n[4], t3 = n[5];

            Console.WriteLine((Math.Abs(y-x) * t1) >= ((Math.Abs(x-y) + Math.Abs(x-z)) * t2 + t3 * 3) ? "YES" : "NO");

        }
    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        ReadInt();
        int ta = ReadInt();
        int b = ReadInt();
        int tb = ReadInt();
        var s = ReadToken().Split(':');
        int x = int.Parse(s[0]) * 60 + int.Parse(s[1]);

        int ans = 0;
        for (int i = 300; i < 1440; i += b)
            if (i < x + ta && i + tb > x)
                ans++;

        Write(ans);
    }

    #region Main

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

    #endregion

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


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

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

            var temp = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = temp[0];
            int L = temp[1];

            var t1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var t2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            var q1 = new List<int>();
            var q2 = new List<int>();

            for (int i = 1; i < n; i++)
            {
                q1.Add(t1[i] - t1[i - 1]);
            }
            q1.Add(L - t1[n - 1] + t1[0]);

            for (int i = 1; i < n; i++)
            {
                q2.Add(t2[i] - t2[i - 1]);
            }
            q2.Add(L - t2[n - 1] + t2[0]);

            int startQ2 = -1;
            bool same;

            do
            {
                same = true;

                startQ2 = q2.FindIndex(startQ2 + 1 ,x => x == q1[0]);

                if (startQ2 == -1)
                {
                    same = false;
                    goto a;
                }
                else
                {
                    int t = startQ2;
                    int h = 0;
                    for (int i = 1; i < n; i++)
                    {
                        if (i + t == n)
                        {
                            h = n;
                        }

                        if (q1[i] != q2[i + t - h])
                        {
                            same = false;
                            break;
                        }
                    }
                }

            } while (startQ2 < n && same == false);

            a:
            Console.WriteLine((same) ? "YES" : "NO");
            Console.ReadLine();

        }

    }
}


using System;
using System.Linq;
using CompLib.Util;
using System.Threading;
using System.IO;

public class Program
{
    public void Solve()
    {

        var sc = new Scanner();
#if !DEBUG
        System.Console.SetOut(new System.IO.StreamWriter(System.Console.OpenStandardOutput()) { AutoFlush = false });
#endif
        int t = sc.NextInt();
        for (int i = 0; i < t; i++)
        {
            Q(sc);
        }
        System.Console.Out.Flush();
    }

    void Q(Scanner sc)
    {
        int n = sc.NextInt();
        Console.WriteLine((1 << n) - 1);
    }

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

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

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

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

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

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

            return _line[_index++];
        }

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

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

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

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


using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.Remoting.Messaging;
using System.Text.RegularExpressions;

// ReSharper disable AssignNullToNotNullAttribute

namespace C
{
    public class P
    {
        public static void Main(string[] args)
        {
            int[] a = Spoj.ReadIntArray();
            int[] b = Spoj.ReadIntArray();
            int[] c = Spoj.ReadIntArray();

            if (a[0] == b[0] && b[0] == c[0] || a[1] == b[1] && b[1] == c[1])
            {
                Console.WriteLine(1);
                return;
            }

            if (IsBetween(a, b, c) || IsBetween(b, a, c) || IsBetween(c, a, b))
            {
                Console.WriteLine(2);
                return;
            }

            Console.WriteLine(3);
        }

        private static bool IsBetween(int[] pb, int[] p1, int[] p2)
        {
            return (pb[0] == p1[0] || pb[0] == p2[0]) && (pb[1] >= Math.Min(p1[1], p2[1]) && pb[1] <= Math.Max(p1[1], p2[1]))
                || (pb[1] == p1[1] || pb[1] == p2[1]) && (pb[0] >= Math.Min(p1[0], p2[0]) && pb[0] <= Math.Max(p1[0], p2[0]));
        }
    }

    public static class Spoj
    {
        public static void RunTestCasesN(int t, Action<int> callback)
        {
            for (int i = 0; i < t; i++)
                callback(i);
        }

        public static void RunTestCasesN(Action<int> callback)
        {
            int t = ReadInt();
            RunTestCasesN(t, callback);
        }

        public static void RunTestCasesWhile<T>(Func<T> readInput, Func<T, bool> validation, Action<int, T> callback)
        {
            int i = 0;
            T input = readInput();

            while (validation(input))
            {
                callback(i, input);
                input = readInput();
                i++;
            }
        }

        public static string ReverseString(this string str)
        {
            return string.Join("", str.Reverse());
        }

        public static string ReadString()
        {
            var s = Console.ReadLine();
            if (string.IsNullOrEmpty(s)) Environment.Exit(0);
            return s.Trim();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadString());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadString());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadString());
        }

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

        public static long[] ReadLongArray()
        {
            return ReadString().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadString().Split(' ').Select(double.Parse).ToArray();
        }

        public static int[] ReadIntArrayLines(int n)
        {
            return Enumerable.Range(0, n).Select(x => ReadInt()).ToArray();
        }
    }
}


using System;
using System.Linq;

namespace Preparation
{
    public class CodeForces710E
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            long n = input[0];
            long x = input[1];
            long y = input[2];
            long[] arr = new long[n];
            arr[0] = x;
            for (int i = 0; i < n - 1; ++i)
            {
                arr[i + 1] = arr[i + 1] == 0 ? arr[i] + x : Math.Min(arr[i + 1], arr[i] + x);
                long ind = (i + 1)*2 - 1;
                var t = y;
                if (ind >= n)
                {
                    t += arr[ind - n];
                    ind = n - 1;
                }
                arr[ind] = arr[ind] == 0 ? arr[i] + t : Math.Min(arr[ind], arr[i] + t);
                arr[ind-1] = arr[ind-1] == 0 ? arr[i] + t + x : Math.Min(arr[ind-1], arr[i] + t + x);
            }

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


using System;
 class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int res = n % 3;
            if (res == 2)
              n++;
            res = n / 36;
            n %= 36;
            Console.WriteLine("{0} {1}", res, n/3);

        }
    }


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

    class Program
    {
        static void Main(string[] args)
        {
            string[] t = Console.ReadLine().Split(' ');
            int n = int.Parse(t[0]);
            int k = int.Parse(t[1]);
            string[] b = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(b[i]);
            }
            Array.Sort(a);
            int sum = 0;
            for (int i = 0; i < n - 1; i++)
            {
                sum += a[i];
            }
            if (sum <= k)
                Console.WriteLine("YES");
            else Console.WriteLine("NO");

        }

    }


using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;

public class Prog
{
    public struct Pair { public NX x, y; public Pair(NX x, NX y) { this.x = x; this.y = y; } }
    public struct Four
    {
        public int x, y, z, k;
        public Four(int a, int b, int c, int d)
        {
            x = a; y = b; z = c; k = d;
        }
    }
    public static void Solve()
    {
        int roop_count = NextInt();
        for (int roop = 0; roop < roop_count; roop++)
        {
            int n = NextInt();
            int k = NextInt();
            int d = NextInt();
            int[] ai = LineInt();
            int ans = int.MaxValue;
            for (int i = 0; i <= n - d; i++)
            {
                HashSet<int> hs = new HashSet<int>();
                for (int j = i; j < i + d; j++)
                {
                    if (!hs.Contains(ai[j])) hs.Add(ai[j]);
                }
                ans = Math.Min(ans, hs.Count());
            }

            Console.WriteLine(ans);
        }
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
    private static int UpperBound(List<NX> list, NX n)
    {
        int a = 0, b = list.Count();
        if (list[a] >= n) return a;
        else if (list[b - 1] < n) return b;
        while (b - a != 1)
        {
            int x = (a + b) / 2;
            if (list[x] >= n) b = x;
            else a = x;
        }
        return b;
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


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

namespace A.The_Useless_Toy_contest_
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] arr = Console.ReadLine().Split();
            string first = arr[0];
            string sec = arr[1];
            int n = int.Parse(Console.ReadLine());
            for (int i = n; i > 1; i--)
            {
                if (n - 4 >= 1)
                {
                    n = n - 4;
                }
                else
                    break;
            }
            string all = "<^>v";
            int start = 0;
            int end = 0;
            for (int i = 0; i < all.Length; i++)
            {
                if (first[0] == all[i])
                {
                    start = i;
                }
                if (sec[0] == all[i])
                {
                    end = i;
                }
            }
            if ( start == end || start == end-2 || start == end +2)
            {
                Console.WriteLine("undefined");
            }
            else
            {
                if (start == end - 1 && n == 1 || start == end + 3 && n == 1 || start == end - 3 && n != 1 || start == end + 1 && n != 1)
                {
                    Console.WriteLine("cw");
                }
                else if (start == end - 3 && n == 1 || start == end + 1 && n == 1 || start == end - 1 &&  n != 1 || start == end + 3 && n != 1)
                {
                    Console.WriteLine("ccw");
                }
            }
        }
    }
}


using System;
using System.Linq;

namespace CSharp
{
    class _448D
    {
        public static void Main()
        {
            var tokens = Console.ReadLine().Split();

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

            long l = 1;
            long r = (long)n * m;

            while (l < r)
            {
                long mid = (l + r) / 2;

                if (Enumerable.Range(1, n).Select(i => Math.Min(mid / i, m)).Sum() < k)
                {
                    l = mid + 1;
                }
                else
                {
                    r = mid;
                }
            }

            Console.WriteLine(l);
        }
    }
}


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

namespace CodeForces {
    struct Node {
        public int X, Y, D;
        public Node(int x,int y, int d) {
            X = x;
            Y = y;
            D = d;
        }
    }

    class Pair : IComparable<Pair> {
        public int First, Second;
        public Pair(int f, int s) {
            First = f;
            Second = s;
        }

        public int CompareTo(Pair other) {
            return other.Second.CompareTo(Second);
        }
    }

    class Desc : IComparer<int> {
        public int Compare(int x, int y) {
            return y.CompareTo(x);
        }
    }

    class Cf {
        static TextReader input;
        static void Main(string[] args) {
#if TESTS
            Stopwatch sw = new Stopwatch();
            sw.Start();
            input = new StreamReader("input.txt");
#else
            input = Console.In;
#endif
            Solve();
#if TESTS
            Console.WriteLine();
            Console.WriteLine("Milliseconds: {0}", sw.ElapsedMilliseconds);
            Console.ReadLine();
#endif
        }

        const int MOD = 1000000007;
        static int n, m;
        static void Solve() {
            n = nextInt();
            m = nextInt();
            int max = n.Max(m);
            int p = 0, r = 6;
            for (int i = 1; i < 7; i++) {
                if (i >= max) ++p;
            }
            string format = "{0}/{1}";
            if (p == 6)
                Console.WriteLine("1/1");
            else if (p % 2 == 0)
                Console.WriteLine(format, p / 2, 3);
            else if (p % 3 == 0)
                Console.WriteLine(format, p / 3, 2);
            else
                Console.WriteLine(format, p, 6);
        }

        #region math
        static long gcd(long a, long b) {
            return b != 0 ? gcd(b, a % b) : a;
        }

        static long lcm(long a, long b) {
            return a / gcd(a, b) * b;
        }

        static int SquaredDistanceBetweenSegments(int x1, int y1, int x2, int y2, int xx1, int yy1, int xx2, int yy2) {
            return Math.Min(Math.Min(SquaredDistanceToSegment(x1, y1, xx1, yy1, xx2, yy2), SquaredDistanceToSegment(x2, y2, xx1, yy1, xx2, yy2)),
                Math.Min(SquaredDistanceToSegment(xx1, yy1, x1, y1, x2, y2), SquaredDistanceToSegment(xx2, yy2, x1, y1, x2, y2)));
        }

        static int SquaredDistanceToSegment(int x, int y, int x1, int y1, int x2, int y2) {
            int result = Math.Min(SquaredDistance(x, y, x1, y1), SquaredDistance(x, y, x2, y2));
            if (x1 == x2 && y1 <= y && y <= y2)
                result = (x - x1) * (x - x1);
            else if (y1 == y2 && x1 <= x && x <= x2)
                result = (y - y1) * (y - y1);
            return result;
        }

        static int SquaredDistance(int ax, int ay, int bx, int by) {
            return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
        }
        #endregion

        #region read helpers
        static int nextInt() {
            int t = input.Read();
            while (t < '0' || t > '9') t = input.Read();
            int x = 0;
            while (t >= '0' && t <= '9') {
                x *= 10;
                x += t - '0';
                t = input.Read();
            }
            return x;
        }

        static long nextLong() {
            int t = input.Read();
            while (t < '0' || t > '9') t = input.Read();
            long x = 0;
            while (t >= '0' && t <= '9') {
                x *= 10;
                x += t - '0';
                t = input.Read();
            }
            return x;
        }

        public static List<int> ReadIntList() {
            return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        }

        public static int[] ReadIntArray() {
            return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }

        public static long[] ReadLongArray() {
            return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        }

        public static List<long> ReadLongList() {
            return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
        }

        public static string ReadLine() {
            return input.ReadLine();
        }

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

        public static long ReadLong() {
            return long.Parse(input.ReadLine());
        }
#endregion
    }

    public class SegmentTree {
        private int[] a, t;
        private int n;
        public SegmentTree(int[] a) {
            n = a.Length;
            this.a = a;
            t = new int[n << 2];
            buildSegmentTree(0, n - 1, 1);
        }

        private void buildSegmentTree(int l, int r, int v) {
            if (l == r)
                t[v] = a[l];
            else {
                int m = (l + r) >> 1;
                int vl = v << 1;
                int vr = (v << 1) | 1;
                buildSegmentTree(l, m, vl);
                buildSegmentTree(m + 1, r, vr);
                t[v] = t[vl] + t[vr];
            }
        }

        public int QuerySegmentTree(int l, int r) {
            return querySegmentTree(1, l, r, 0, n - 1);
        }

        public void Update(int v, int tl, int tr, int pos, int new_val) {
            if (tl == tr)
                t[v] = new_val;
            else {
                int tm = (tl + tr) / 2;
                if (pos <= tm)
                    Update(v << 1, tl, tm, pos, new_val);
                else
                    Update(v << 1 + 1, tm + 1, tr, pos, new_val);
                t[v] = t[v << 1] + t[v << 1 + 1];
            }
        }

        private int querySegmentTree(int v, int l, int r, int tl, int tr) {
            if (l > r)
                return 0;
            if (l == tl && r == tr)
                return t[v];
            int m = (tl + tr) >> 1;
            return querySegmentTree(v << 1, l, Math.Min(r, m), tl, m) + querySegmentTree((v << 1) | 1, Math.Max(l, m + 1), r, m + 1, tr);
        }
    }
    class Graph : List<List<int>> {
        public Graph(int num): base(num) {
            for (int i = 0; i < num; i++) {
                this.Add(new List<int>());
            }
        }
    }

    class Heap<T> : IEnumerable<T> where T : IComparable<T> {
        private List<T> heap = new List<T>();
        private int heapSize;
        private int Parent(int index) {
            return (index - 1) >> 1;
        }
        public int Count {
            get { return heap.Count; }
        }
        private int Left(int index) {
            return (index << 1) | 1;
        }
        private int Right(int index) {
            return (index << 1) + 2;
        }
        private void Max_Heapify(int i) {
            int l = Left(i);
            int r = Right(i);
            int largest = i;
            if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)
                largest = l;
            if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)
                largest = r;
            if (largest != i) {
                T temp = heap[largest];
                heap[largest] = heap[i];
                heap[i] = temp;
                Max_Heapify(largest);
            }
        }
        private void BuildMaxHeap() {
            for (int i = heap.Count >> 1; i >= 0; --i)
                Max_Heapify(i);
        }

        public IEnumerator<T> GetEnumerator() {
            return heap.GetEnumerator();
        }

        public void Sort() {
            for (int i = heap.Count - 1; i > 0; --i) {
                T temp = heap[i];
                heap[i] = heap[0];
                heap[0] = temp;
                --heapSize;
                Max_Heapify(0);
            }
        }

        public T Heap_Extract_Max() {
            T max = heap[0];
            heap[0] = heap[--heapSize];
            Max_Heapify(0);
            return max;
        }

        public void Clear() {
            heap.Clear();
            heapSize = 0;
        }

        public void Insert(T item) {
            if (heapSize < heap.Count)
                heap[heapSize] = item;
            else
                heap.Add(item);
            int i = heapSize;
            while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {
                T temp = heap[i];
                heap[i] = heap[Parent(i)];
                heap[Parent(i)] = temp;
                i = Parent(i);
            }
            ++heapSize;
        }

        IEnumerator IEnumerable.GetEnumerator() {
            return ((IEnumerable)heap).GetEnumerator();
        }
    }
    public class Treap<T> where T:IComparable<T> {
        private static Random rand = new Random();
        public static Treap<T> Merge(Treap<T> l, Treap<T> r) {
            if (l == null) return r;
            if (r == null) return l;
            Treap<T> res = null;
            if (l.y > r.y) {
                Treap<T> newR = Merge(l.right, r);
                res = new Treap<T>(l.x, l.y, l.left, newR);
            }
            else {
                Treap<T> newL = Merge(l, r.left);
                res = new Treap<T>(r.x, r.y, newL, r.right);
            }
            return res;
        }

        public bool Contains(T key) {
            if (x.CompareTo(key) > 0)
                return left == null ? false : left.Contains(key);
            else if (x.CompareTo(key) < 0)
                return right == null ? false : right.Contains(key);
            return true;
        }

        public void Split(T x, out Treap<T> l, out Treap<T> r) {
            Treap<T> newTree = null;
            if (this.x.CompareTo(x)<0) {
                if (right == null)
                    r = null;
                else
                    right.Split(x, out newTree, out r);
                l = new Treap<T>(this.x, y, left, newTree);
            }
            else {
                if (left == null)
                    l = null;
                else
                    left.Split(x, out l, out newTree);
                r = new Treap<T>(this.x, y, newTree, right);
            }
        }

        public Treap<T> Add(T x) {
            Treap<T> l, r;
            Split(x, out l, out r);
            Treap<T> m = new Treap<T>(x, rand.Next());
            return Merge(Merge(l, m), r);
        }

        private T x;
        private int y;
        private Treap<T> left, right;
        public Treap(T x, int y, Treap<T> l, Treap<T> r) {
            this.x = x;
            this.y = y;
            left = l;
            right = r;
        }
        public Treap(T x, int y) : this(x, y, null, null) { }
        public Treap(T x) : this(x, rand.Next()) { }
    }
    public static class Extensions {
        public static int Max(this int a, int b) {
            return Math.Max(a, b);
        }

        public static int Min(this int a, int b) {
            return Math.Min(a, b);
        }

        public static void Fill(this int[] array, int val) {
            for (int i = 0; i < array.Length; i++) {
                array[i] = val;
            }
        }

        public static void Fill(this double[] array, double val) {
            for (int i = 0; i < array.Length; i++) {
                array[i] = val;
            }
        }

        public static int ToInt(this string s) {
            return int.Parse(s);
        }

        public static string Fill(this char c, int count) {
            char[] r = new char[count];
            for (int i = 0; i < count; ++i)
                r[i] = c;
            return new string(r);
        }

        public static void Print<T>(this IEnumerable<T> arr) {
            foreach (T t in arr)
                Console.Write("{0} ", t);
        }
    }
}


using System;

namespace CSharp
{
    public class _584B
    {
        private static int m = 1000000007;

        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(((Power(27, n) - Power(7, n)) % m + m) % m);
        }

        private static long Power(long n, long k)
        {
            long result = 1;

            if (k > 0)
            {
                result *= Power(n, k / 2);
                result %= m;

                result *= result;
                result %= m;

                if (k % 2 == 1)
                {
                    result *= n;
                    result %= m;
                }
            }

            return result;
        }
    }
}


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

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

        private static long[] fact;
        private static long[] fact1;

        private static void Main(string[] args)
        {
            int n = int.Parse(reader.ReadLine());

            long count = n;
            n--;

            InitFact(2*n + 2);
            long c = GetCFact(2*n + 1, n + 1);
            count = (count + 2 * (c - count + mod)) % mod;
            writer.WriteLine(count);
            writer.Flush();
        }

        private static void InitFact(int n)
        {
            fact = new long[n];
            fact1 = new long[n];

            fact[0] = 1;

            for (int i = 1; i < fact.Length; i++)
            {
                fact[i] = (fact[i - 1]*i)%mod;
            }
            fact1[n - 1] = Pow(fact[n - 1], mod - 2);
            for (int i = fact1.Length - 2; i >= 0; i--)
            {
                fact1[i] = (fact1[i + 1]*(i + 1))%mod;
            }
        }

        private static long GetCFact(int n, int k)
        {
            return (((fact[n]*fact1[k])%mod)*fact1[n - k])%mod;
        }

        private static long Pow(long a, int k)
        {
            long r = 1;
            while (k > 0)
            {
                if ((k & 1) == 1)
                {
                    r = (r*a)%mod;
                }
                a = (a*a)%mod;
                k >>= 1;
            }
            return r;
        }
    }
}


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

namespace round596div2
{

    class Solution
    {
        public int N {get;set;}
        public int P {get;set;}

        public Solution(int n, int p)
        {
            N = n;
            P = p;
        }

        public int Apply()
        {
            for(int i = 1; i <= 31; ++i)
            {
                long _n = N - i * P;
                if(_n < 1)
                    continue;
                int c_p = 0;
                int exp = 0;
                for(int l = 0; l <= 31; ++l)
                    if(((_n >> l) & 1) == 1)
                    {
                        ++c_p;
                        exp += 1 << l;
                    }

                if(c_p <= i && exp >= i)
                    return i;
            }
            return -1;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            int[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();
            Solution sl = new Solution(info[0], info[1]);
            System.Console.WriteLine(sl.Apply());
        }
    }
}


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

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

        return ret;
    }

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

        return ret;
    }

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

        return ret;
    }

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

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

        return true;
    }

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

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

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


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

namespace CF
{
	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
	{
		public void Solve(InputReader sr, TextWriter sw)
		{
			var input = sr.ReadArray(Int32.Parse);
			var n = input[0];
			var k = input[1];
			var factorize = Factorize(n);
			if (factorize.Sum(item => item.Value) < k) {
				sw.WriteLine(-1);
				return;
			}
			var count = 0;
			var result = new List<int>();
			foreach (var item in factorize) {
				for (var i = 0; i < item.Value; i++) {
					if (result.Count == k) {
						result[result.Count - 1] *= item.Key;
					}
					else {
						result.Add(item.Key);
					}
				}
			}

			var sb = new StringBuilder();
			foreach (var item in result) {
				sb.Append(item + " ");
			}

			sw.Write(sb);
		}

		private Dictionary<int, int> Factorize(int n)
		{
			var result = new Dictionary<int, int>();
			var initN = n;
			for (var i = 2; i <= initN; i++)
			{
				if (n % i == 0) {
					var count = 0;
					while (n % i == 0) {
						n /= i;
						count++;
					}
					result.Add(i, count);
				}
			}

			return result;
		}
	}
}

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.Linq;
using CompLib.Util;
using System.IO;
using System.Threading;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
#if !DEBUG
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
#endif
        int t = sc.NextInt();
        for (int i = 0; i < t; i++)
        {
            Q(sc);
        }
        Console.Out.Flush();
    }

    void Q(Scanner sc)
    {
        int n = sc.NextInt();
        int m = sc.NextInt();
        int k = sc.NextInt();

        // k個 横向き
        // n*m/2-k個縦
        //
        //
        //
        //
        //
        char[][] ans = new char[n][];
        for (int i = 0; i < n; i++) ans[i] = new char[m];

        if (m % 2 == 0)
        {
            if (n % 2 == 0)
            {
                if (k % 2 != 0)
                {
                    Console.WriteLine("NO");
                    return;
                }
                int tmp = 0;
                for (int i = 0; i < n; i += 2)
                {
                    for (int j = 0; j < m; j += 2)
                    {
                        if (tmp < k)
                        {
                            tmp++;
                            char a, b;
                            if ((j / 2) % 2 == 0)
                            {
                                a = 'a';
                                b = 'b';
                            }
                            else
                            {
                                a = 'b';
                                b = 'a';
                            }
                            ans[i][j] = a;
                            ans[i][j + 1] = a;
                            ans[i + 1][j] = b;
                            ans[i + 1][j + 1] = b;
                        }
                        else
                        {
                            char a, b;
                            if ((i / 2) % 2 == 0)
                            {
                                a = 'c';
                                b = 'd';
                            }
                            else
                            {
                                a = 'd';
                                b = 'c';
                            }
                            ans[i][j] = a;
                            ans[i][j + 1] = b;
                            ans[i + 1][j] = a;
                            ans[i + 1][j + 1] = b;
                        }
                    }
                }
            }
            else
            {
                // n奇数
                // 1列目全部埋める
                if (k < m / 2)
                {
                    Console.WriteLine("NO");
                    return;
                }

                if ((k - m / 2) % 2 != 0)
                {
                    Console.WriteLine("NO");
                    return;
                }

                for (int j = 0; j < m; j += 2)
                {
                    char a = (j / 2) % 2 == 0 ? 'a' : 'b';
                    ans[0][j] = a;
                    ans[0][j + 1] = a;
                }
                int tmp = m / 2;
                for (int i = 1; i < n; i += 2)
                {
                    for (int j = 0; j < m; j += 2)
                    {
                        if (tmp < k)
                        {
                            tmp++;
                            char a, b;
                            if ((j / 2) % 2 == 0)
                            {
                                a = 'c';
                                b = 'd';
                            }
                            else
                            {
                                a = 'd';
                                b = 'c';
                            }
                            ans[i][j] = a;
                            ans[i][j + 1] = a;
                            ans[i + 1][j] = b;
                            ans[i + 1][j + 1] = b;
                        }
                        else
                        {
                            char a, b;
                            if ((i / 2) % 2 == 0)
                            {
                                a = 'e';
                                b = 'f';
                            }
                            else
                            {
                                a = 'f';
                                b = 'e';
                            }
                            ans[i][j] = a;
                            ans[i][j + 1] = b;
                            ans[i + 1][j] = a;
                            ans[i + 1][j + 1] = b;
                        }
                    }
                }
            }
        }
        else
        {
            // n偶数
            // 偶数段
            if (k % 2 != 0)
            {
                Console.WriteLine("NO");
                return;
            }
            if (k > (n * (m - 1)) / 2)
            {
                Console.WriteLine("NO");
                return;
            }
            int tmp = 0;
            for (int i = 0; i < n; i += 2)
            {
                for (int j = 0; j < m - 1; j += 2)
                {
                    if (tmp < k)
                    {
                        tmp++;
                        char a, b;
                        if ((j / 2) % 2 == 0)
                        {
                            a = 'a';
                            b = 'b';
                        }
                        else
                        {
                            a = 'b';
                            b = 'a';
                        }
                        ans[i][j] = a;
                        ans[i][j + 1] = a;
                        ans[i + 1][j] = b;
                        ans[i + 1][j + 1] = b;
                    }
                    else
                    {
                        char a, b;
                        if ((i / 2) % 2 == 0)
                        {
                            a = 'c';
                            b = 'd';
                        }
                        else
                        {
                            a = 'd';
                            b = 'c';
                        }
                        ans[i][j] = a;
                        ans[i][j + 1] = b;
                        ans[i + 1][j] = a;
                        ans[i + 1][j + 1] = b;
                    }
                }
            }

            for (int i = 0; i < n; i += 2)
            {
                char a = (i / 2) % 2 == 0 ? 'e' : 'f';
                ans[i][m - 1] = a;
                ans[i + 1][m - 1] = a;
            }
        }

        Console.WriteLine("YES");

        // for (int i = 0; i < n; i++)
        // {
        //     Console.WriteLine(new string(ans[i]));
        // }
    }

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

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

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

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

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

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

            return _line[_index++];
        }

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

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

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

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


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

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().solve();
        }

        void solve()
        {
            int n = nextInt();
            int k = nextInt();
            for (int i = 1; k >= i; k -= i, i = (i == n ? 1 : i + 1)) ;
            Console.WriteLine(k);
        }

        /// <summary>
        ///
        /// </summary>
        String[] tokens;
        int pointer;
        public long nextLong()
        {
            return long.Parse(nextToken());
        }
        public int nextInt()
        {
            return int.Parse(nextToken());
        }
        public string nextToken()
        {
            while (tokens == null || tokens.Length == 0 || pointer >= tokens.Length)
            {
                tokens = System.Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                pointer = 0;
            }
            return tokens[pointer++];
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int h1 = int.Parse(s.Substring(0, 2));
            int m1 = int.Parse(s.Substring(3, 2));
            int q1 = h1 * 60 + m1;
            s = Console.ReadLine();
            int h2 = int.Parse(s.Substring(0, 2));
            int m2 = int.Parse(s.Substring(3, 2));
            int q2 = h2 * 60 + m2;
            int dq = q2 - q1;
            dq /= 2;
            dq += q1;
            h1 = dq / 60;
            m1 = dq % 60;

            Console.WriteLine($"{h1/10}{h1%10}:{m1/10}{m1%10}");
        }
    }
}


using System;
using System.Collections.Generic;
class X{
    public static void Main(String[] args){
	List<String> ss = new List<String>();
        for (int i = 0;i < 3;i++){
		ss.Add(System.Console.ReadLine());
	}

	List<Char> clist = new List<Char>(ss[0].ToCharArray());
	clist.Reverse();
	if (new String(clist.ToArray()) != ss[2]){
		System.Console.WriteLine("NO");
		return ;
	}

	clist = new List<Char>(ss[1].ToCharArray());
	clist.Reverse();
	if (new String(clist.ToArray()) != ss[1]){
		System.Console.WriteLine("NO");
		return ;
	}
	System.Console.WriteLine("YES");

    }
}


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

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

            int[] mas = new int[n];
            string str = Console.ReadLine();
            int L, D, U, R;
            L = 0;
            D = 0;
            U =0;
            R = 0;
            for (int i=0;i<str.Length;i++)
            {
                if (str[i] == 'L')
                    L++;
                if (str[i] == 'D')
                    D++;
                if (str[i] == 'U')
                    U++;
                if (str[i] == 'R')
                    R++;

            }
            int minx = 0;
            int miny = 0;
            if (U <= D)
                miny = U;
            else miny = D;
            if (L <= R)
                minx = L;
            else minx = R;

            int kol = 2*minx+2*miny;

            Console.WriteLine(kol);

        }
    }
}


using System;

class Program
{
    public static ulong ncr(ulong n, ulong r)
    {
        if(r>n)
            return 0;
        ulong res=1;
        //numerator
        for(ulong  i=n-r+1,j=1;i<=n;i++,j++)
            res=(res*i)/j;
        return res;
    }

    public static void Main(string[] args)
    {
        string[] inp=Console.ReadLine().Split();
        ulong numBoys,numGirls,total;
        numBoys=ulong.Parse(inp[0]);
        numGirls=ulong.Parse(inp[1]);
        total=ulong.Parse(inp[2]);

        ulong res=0,t1,t2,limit=total-5;
        for(t1=0;t1<=limit;t1++)
        {
            t2=limit-t1;
            res+=ncr(numBoys,t1+4)*ncr(numGirls,t2+1);
        }
        Console.WriteLine(res);
    }
}


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

namespace ReadWriteTemplate
{
    public static class Solver
    {
        private static void SolveCase()
        {
            long n = ReadLong();
            int m = ReadInt();

            const long MOD = 1000000007;

            long[,] a = new long[m, m];
            for (int i = 0; i < m - 1; i++)
            {
                a[i, i + 1] = 1;
            }
            a[m - 1, 0] = 1;
            a[m - 1, m - 1] = 1;

            a = MatrixBinPower(m, a, n, MOD);

            long ans = a[m - 1, m - 1];

            Writer.WriteLine(ans);
        }

        public static long[,] MatrixBinPower(int n, long[,] a, long p, long mod)
        {
            long[,] result = new long[n, n];
            for (int i = 0; i < n; i++)
            {
                result[i, i] = 1;
            }

            while (p > 0)
            {
                if ((p & 1) != 0)
                {
                    result = MatrixMult(n, result, a, mod);
                }

                a = MatrixMult(n, a, a, mod);
                p >>= 1;
            }

            return result;
        }

        public static long[,] MatrixMult(int n, long[,] a, long[,] b, long mod)
        {
            long[,] c = new long[n, n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < n; k++)
                    {
                        c[i, j] = (c[i, j] + a[i, k] * b[k, j]) % mod;
                    }
                }
            }

            return c;
        }

        public static void Solve()
        {
#if DEBUG
            var sw = Stopwatch.StartNew();
#endif

            SolveCase();

            /*int T = ReadInt();
            for (int i = 0; i < T; i++)
            {
                // Writer.Write("Case #{0}: ", i + 1);
                SolveCase();
            }*/

#if DEBUG
            sw.Stop();
            Console.WriteLine($"{sw.ElapsedMilliseconds} ms");
#endif
        }

        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if DEBUG
            //Reader = Console.In; Writer = Console.Out;
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");
#else
            Reader = Console.In; Writer = Console.Out;
#endif

            // Solve();
            Thread thread = new Thread(Solve, 64 * 1024 * 1024);
            thread.CurrentCulture = CultureInfo.InvariantCulture;
            thread.Start();
            thread.Join();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

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

        public static string ReadLine()
        {
            return Reader.ReadLine();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
    class Program
    {

        public static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int sx, sy, ax, ay;
            sx = int.Parse(s[0]);
            sy = int.Parse(s[1]);
            ax = int.Parse(s[2]);
            ay = int.Parse(s[3]);
            int ris1 = 0, ris2 = 0, ris3 = 0;
            double pendenza;

            try
            {
                pendenza = Math.Abs((double)(ay - sy) / (double)(ax - sx));
            }
            catch
            {
                pendenza = 0;
            }
                if (pendenza == 1)
            {
                ris2 = 1;
            }
            if (ax == sx || ay == sy)
            {
                ris1 = 1;
            }
            else
            {
                ris1 = 2;
            }
            ris3 = Math.Max(Math.Abs(sx - ax), Math.Abs(sy - ay));
            if (ris2 == 0)
            {
                if (sy % 2 == 0)
                {
                    if (sx % 2 == 0)
                    {
                        if ((ax % 2 == 0 && ay % 2 == 0) || (ax % 2 == 1 && ay % 2 == 1))
                        {
                            ris2 = 2;
                        }
                    }
                    else
                    {
                        if ((ax % 2 == 1 && ay % 2 == 0) || (ax % 2 == 0 && ay % 2 == 1))
                        {
                            ris2 = 2;
                        }
                    }
                }
                else
                {
                    if (sx % 2 == 0)
                    {
                        if ((ax % 2 == 0 && ay % 2 == 1) || (ax % 2 == 1 && ay % 2 == 0))
                        {
                            ris2 = 2;
                        }
                    }
                    else
                    {
                        if ((ax % 2 == 0 && ay % 2 == 0) || (ax % 2 == 1 && ay % 2 == 1))
                        {
                            ris2 = 2;
                        }
                    }
                }
            }
            Console.WriteLine(ris1 + " " + ris2 + " " + ris3);
        }
    }
}


using System;

namespace _1057С
{
    class Program
    {
        static readonly int INF = 1000000000;
        static int n, s, k;
        static int[] r;
        static int[][] dps;

        static bool[] dpsc;
        static string clr;
        static void Main(string[] args)
        {
            (n, s, k) = r3i();
            r = ris();
            s--;
            clr = Console.ReadLine();
            dpsc = new bool[n];
            dps = new int[n][];
            int result = INF;
            for (int i = 0; i < n; i++)
            {
                dp(i);
                result = Math.Min(result, dps[i][k] + Math.Abs(s-i));
            }
            Console.WriteLine(result == INF ? -1 : result);
        }

        static void dp(int cur)
        {
            if (dps[cur] != null)
                return;
            dps[cur] = new int[k+1];
            for (int i = r[cur]+1; i < k + 1; i++)
            {
                dps[cur][i] = INF;
            }
            for (int to = 0; to < n; to++)
            {
                if (r[to] > r[cur] && clr[to] != clr[cur])
                {
                    dp(to);
                    for (int i = r[cur] + 1; i < k + 1; i++)
                    {
                        dps[cur][i] = Math.Min(dps[cur][i], dps[to][i-r[cur]] + Math.Abs(cur-to));
                    }
                }
            }
        }

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

        static int ri()
        {
            var i = Console.ReadLine();
            return Int32.Parse(i);
        }
        static (int, int) r2i()
        {
            var i = Console.ReadLine().Split(' ');
            return (Int32.Parse(i[0]), Int32.Parse(i[1]));
        }
        static (int, int, int) r3i()
        {
            var i = Console.ReadLine().Split(' ');
            return (Int32.Parse(i[0]), Int32.Parse(i[1]), Int32.Parse(i[2]));
        }
    }
}


using System;

namespace Cows_and_Primitive_Roots
{
    class Program
    {
        static void Main(string[] args)
        {
            int p = short.Parse(Console.ReadLine());
            int count = 0;
            for (int n = 1; n < p; ++n)
            {
                bool ok = true;
                int x = 1;
                for (int i = 1; i < p - 1; ++i)
                {
                    x *= n;
                    x %= p;
                    if (x == 1)
                    {
                        ok = false;
                        break;
                    }
                }
                if (ok)
                {
                    x *= n;
                    x %= p;
                    if (x == 1)
                    {
                        count += 1;
                    }
                }
            }
            Console.WriteLine(count);
        }

    }
}


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

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

    }

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

namespace ConsoleApplication254
{

    class Program
    {

        static bool foo(string s1, string s2)
        {
            int k = 0;
            for (int i = 0; i < s1.Length; i++)
            {

                if (s1[i] == s2[k])
                {
                    if (k == s2.Length - 1)
                    {
                        return true;
                    }
                    k++;
                }
            }
            if (k >= s2.Length)
            {
                return true;
            }
            return false;
        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string s1 = Console.ReadLine();
            if (s1.Length > s.Length)
            {
                Console.WriteLine("need tree");
                return;
            }
            if (foo(s, s1))
            {
                Console.WriteLine("automaton");
                return;
            }
            bool f = false;
            int[] cnt = new int[26];
            int[] cnt1 = new int[26];
            for (int i = 0; i < s.Length; i++)
            {
                cnt[s[i] - 'a']++;
            }
            for (int i = 0; i < s1.Length; i++)
            {
                cnt1[s1[i] - 'a']++;
            }
            for (int i = 0; i < 26; i++)
            {
                if (cnt[i] != cnt1[i])
                {
                    f = true;
                }
            }
            if (!f)
            {
                Console.WriteLine("array");
                return;
            }
            f = false;
            for (int i = 0; i < 26; i++)
            {
                if (cnt[i] < cnt1[i])
                {
                    f = true;
                    Console.WriteLine("need tree");
                    return;
                }

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


/*
csc -debug A.cs && mono --debug A.exe <<< "4 3
1 1
1 2"
*/

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

public class HelloWorld {
    public static void SolveCodeForces() {
        var w = cin.NextLong();
        var h = cin.NextLong();

        var u1 = cin.NextLong();
        var d1 = cin.NextLong();

        var u2 = cin.NextLong();
        var d2 = cin.NextLong();

        for (; h >= 0; h--) {
            w += h;

            if (h == d1) w -= u1;
            if (w < 0) w = 0;

            if (h == d2) w -= u2;
            if (w < 0) w = 0;

            // System.Console.WriteLine(new {h, w});
        }

        System.Console.WriteLine(w);
    }

    static Scanner cin = new Scanner();
    static StringBuilder cout = new StringBuilder();

    static public void Main () {
        SolveCodeForces();
        // System.Console.Write(cout.ToString());
    }
}

public static class Helpers {
    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }

    public static IEnumerable<int> IndicesWhere<T>(this IEnumerable<T> seq, Func<T, bool> cond) {
        var i = 0;
        foreach (var item in seq) {
            if (cond(item)) yield return i;
            i++;
        }
    }
}

public class Scanner
{
    private string[] line = new string[0];
    private int index = 0;

    public string Next() {
        if (line.Length <= index) {
            line = Console.ReadLine().Split(' ');
            index = 0;
        }
        var res = line[index];
        index++;
        return res;
    }

    public int NextInt() {
        return int.Parse(Next());
    }

    public long NextLong() {
        return long.Parse(Next());
    }

    public ulong NextUlong() {
        return ulong.Parse(Next());
    }

    public string[] Array() {
        line = Console.ReadLine().Split(' ');
        index = line.Length;
        return line;
    }

    public int[] IntArray(int emptyPrefixLen = 0) {
        var array = Array();
        var result = new int[emptyPrefixLen + array.Length];
        for (int i = 0; i < array.Length; i++)
            result[emptyPrefixLen + i] = int.Parse(array[i]);
        return result;
    }

    public long[] LongArray() {
        var array = Array();
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = long.Parse(array[i]);
        return result;
    }

    public ulong[] UlongArray() {
        var array = Array();
        var result = new ulong[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = ulong.Parse(array[i]);
        return result;
    }
}


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

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

            //Console.SetIn(new StreamReader("file.in"));
            /*
            FileStream filestream = new FileStream("out.txt", FileMode.Create);
            var streamwriter = new StreamWriter(filestream);
            streamwriter.AutoFlush = true;
            Console.SetOut(streamwriter);
            */

            int k = int.Parse(Console.ReadLine());
            int[] nap = new int[10];
            for (int i = 0; i < 4; i++) {
                char[] c = Console.ReadLine().ToCharArray();
                for (int j = 0; j < 4; j++) {
                    if (c[j] != '.') {
                        nap[c[j] - '0']++;
                    }
                }
            }
            bool sol = true;
            for (int i = 1; i <= 9; i++) {
                if (nap[i] > k + k) {
                    sol = false;
                }
            }
            string ans = (sol) ? "YES" : "NO";
            Console.Write(ans);

            //Console.ReadKey();
        }
    }
}


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

public class Program
{
    long A, B;
    public void Solve()
    {
        checked
        {
            var sc = new Scanner();
            (A, B) = (sc.NextLong(), sc.NextLong());

            long ans = long.MaxValue;
            var divC = Div(A + B);
            var divA = Div(A);
            var divB = Div(B);

            for (int i = 0; i < divA.Count; i++)
            {
                long x = divA[i];
                // x以上
                int ok = divC.Count;
                int ng = -1;
                while (ok - ng > 1)
                {
                    int mid = (ok + ng) / 2;
                    if (divC[mid] >= x) ok = mid;
                    else ng = mid;
                }

                for (int t = ok; t < divC.Count && divA[divA.Count - i - 1] <= divC[divC.Count - t - 1]; t++)
                {
                    ans = Math.Min(ans, divC[t] + divC[divC.Count - t - 1]);
                }
            }

            for (int i = 0; i < divB.Count; i++)
            {
                long x = divB[i];
                // x以上
                int ok = divC.Count;
                int ng = -1;
                while (ok - ng > 1)
                {
                    int mid = (ok + ng) / 2;
                    if (divC[mid] >= x) ok = mid;
                    else ng = mid;
                }

                for (int t = ok; t < divC.Count && divB[divB.Count - i - 1] <= divC[divC.Count - t - 1]; t++)
                {
                    ans = Math.Min(ans, divC[t] + divC[divC.Count - t - 1]);
                }
            }

            Console.WriteLine((ulong)ans * 2);
        }
    }

    List<long> Div(long n)
    {
        var ans = new List<long>();
        var rev = new List<long>();
        for (long x = 1; x * x <= n; x++)
        {
            if (n % x == 0)
            {
                ans.Add(x);
                if (n / x != x) rev.Add(n / x);
            }
        }

        for (int i = rev.Count - 1; i >= 0; i--)
        {
            ans.Add(rev[i]);
        }

        return ans;
    }

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

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

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

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

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

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

            return _line[_index++];
        }

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

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

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

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


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

namespace Div._2_A.Transformation_from_A_to_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long a = long.Parse(s[0]);
            long b = long.Parse(s[1]);
            List<long> list = new List<long>();
            bool right = false;
            while (b >= a)
            {
                list.Add(b);
                if (a == b)
                {
                    right = true;
                    break;
                }
                if (b % 2 == 0)
                {
                    b /= 2;
                }
                else if(b > 10 && b % 10 == 1)
                {
                    b /= 10;
                }
                else
                {
                    right = false;
                    break;
                }
            }
            if (right)
            {
                Console.WriteLine("YES");
                Console.WriteLine(list.Count);
                for (int i = list.Count-1; i >= 0; i--)
                {
                    Console.Write(list[i] + " ");
                }
            }
            else
                Console.WriteLine("NO");
            Console.ReadLine();
        }
    }
}


using System;
using System.Linq;

namespace _808A
{
    class Program
    {
        static void Main(string[] args)
        {
            int currentYear = int.Parse(Console.ReadLine());
            int happyYear = GetNextHappyYear(currentYear);
            Console.WriteLine(happyYear - currentYear);
            Console.ReadLine();
        }

        private static int GetNextHappyYear(int currentYear)
        {
            int digitCount = GetDigitCount(currentYear);
            if (digitCount == 1)
            {
                return currentYear + 1;
            }
            else
            {
                int firstDigit = GetFirstDigit(currentYear);
                return (firstDigit + 1) * (int)Math.Pow(10, digitCount - 1);
            }
        }

        private static int GetFirstDigit(int currentYear)
        {
            while(currentYear > 9)
            {
                currentYear /= 10;
            }
            return currentYear;
        }

        private static int GetDigitCount(int currentYear)
        {
            int digitCount = 0;
            while(currentYear > 0)
            {
                currentYear /= 10;
                digitCount++;
            }
            return digitCount;
        }
    }
}


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

class Program {
	static int[] d = new int[1000001];
	static void Main() {
		string[] input = Console.ReadLine().Split();
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		int c = int.Parse(input[2]);
		long s = 0;
		divisor();
		for(int i = 1; i <= a; i++){
			for(int j = 1; j <= b; j++){
				for(int k = 1; k <= c; k++){
					s += d[i * j * k] % 1073741824 ;
				}
			}
		}
		Console.WriteLine(s);
	}
	static void divisor() {
		d[1] = 1;
		for(int i = 2; i < d.Length; i++){
			d[i]++;
			int j = 1;
			while(j * i < d.Length){
				d[j * i]++;
				j++;
			}
		}
	}
}


using System;
public class Program
{
    public static void Main() {
        int n = Convert.ToInt32(Console.ReadLine());

        if(n%2 == 0){Console.WriteLine("Mahmoud");
        return;}
        Console.WriteLine("Ehab");

  }
}


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

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            if (x != null)
                p.Out(x);
        }

        object Solve()
        {
            var s = Read();
            var max = 0;
            for (int i = 0; i < s.Length; i++)
            {
                for (int j = 1; j < s.Length - i + 1; j++)
                {
                    var s2 = s.Substring(i, j);
                    if (max < s2.Length && !IsPalindrom(s2))
                        max = s2.Length;
                }
            }

            return max;
        }

        bool IsPalindrom(string s)
        {
            for (int k = 0; k < s.Length / 2; k++)
            {
                if (s[k] != s[s.Length - k - 1])
                    return false;
            }

            return true;
        }
        void DFS(List<long>[] graph, List<List<long>> result, long current, bool[] visited)
        {
            visited[current] = true;
            foreach (var item in graph[current])
            {

            }
        }

        long CountAns(int pow, long k, long[] hopes, long[] fact, int addedOnes)
        {
            long res = 0;
            for (int i = 0; i <= pow; i++)
            {
                int realOnes = i + addedOnes;
                if (realOnes > 1000)
                    break;
                if (realOnes > 0 && hopes[realOnes] == k - 1)
                    res = (res + fact[pow] * fastpow(fact[i] * fact[pow - i] % commonMod, commonMod - 2)) % commonMod;
            }
            return res;
        }

        int CountOnes(int i)
        {
            int res = 0;
            while (i != 0)
            {
                if ((i & 1) == 1)
                    res++;
                i >>= 1;
            }
            return res;
        }

        long fastpow(long b, long x)
        {
            checked
            {
                if (x == 0)
                    return 1;
                if (x == 1)
                    return b;
                if (x % 2 == 0)
                    return fastpow(b * b % commonMod, x / 2);
                return b * fastpow(b, x - 1) % commonMod;
            }
        }
        int nod(int a, int b)
        {
            if (a < b)
                return nod(b, a);
            if (b == 0)
                return a;
            return nod(b, a % b);
        }

        class End
        {
            public long Val { get; set; }
            public bool Left { get; set; }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }

}


using System;

public class Program {
    public static void Main() {
        int leastNumber = int.Parse(Console.ReadLine());
        for (int i = 2; i <= 10; i += 2) {
            for (int j = 0; j < (1 << i); ++j) {
                int count = 0;
                long number = 0;
                for (int k = i - 1; k >= 0; --k) {
                    number *= 10;
                    if (((j >> k) & 1) == 0) {
                        number += 4;
                        ++count;
                    } else {
                        number += 7;
                    }
                }
                if (count * 2 == i && number >= leastNumber) {
                    Console.WriteLine(number);
                    return;
                }
            }
        }
    }
}


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

namespace ConsoleApplication1
{
  class Program
  {

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

      long min = long.MaxValue;

      for (long i = 1; i <= Math.Pow(n, 1.0/3.0); i++)
      {
        long sq = n / i;
        if (n % i == 0)
          for (long j = 1; j <= Math.Sqrt(sq); j++)
          {
            long k = sq / j;
            if (sq % j == 0)
              if (i * j * k == n)
              {
                min = Math.Min(min, (i + 1) * (j + 2) * (k + 2) - n);
                min = Math.Min(min, (i + 2) * (j + 1) * (k + 2) - n);
                min = Math.Min(min, (i + 2) * (j + 2) * (k + 1) - n);
              }
          }
      }

      Console.WriteLine(min + " " + ((n + 1) * 3 * 3 - n));
    }
  }
}


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

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

      string[] astr = Console.ReadLine().Split(new string[]{" "}, StringSplitOptions.RemoveEmptyEntries);
      int[] aint = new int[astr.Length];
      int i = 0;
      foreach(string s in astr) {
        aint[i] = int.Parse(s);
        i++;
      }

      long kMin;
      long kMax;
      Func1(aint[0], aint[1], out kMin, out kMax);

      Console.WriteLine(kMin + " " + kMax);
      Console.ReadLine();

    }

    public static void Func1(int n, int m, out long kMin, out long kMax) {

      int n1 = n - m;
      int nMin = n1 / m + 1;
      int nMax = n1 + 1;

      int ostMin = n - nMin * m;

      int nLastMin = nMin + ostMin;

      //kMin = (long)nMin * (nMin - 1) / 2 * (m - 1) + (long)nLastMin * (nLastMin - 1) / 2;
      kMin = (long)(nMin + 1) * nMin / 2 * ostMin + (long)nMin * (nMin - 1) / 2 * (m - ostMin);
      kMax = (long)nMax * (nMax - 1) / 2;

    }

  }
}


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

namespace ReadWriteTemplate
{
    public static class Solver
    {
        private static void SolveCase()
        {
            long la = ReadLong();
            long ra = ReadLong();
            long ta = ReadLong();
            long lb = ReadLong();
            long rb = ReadLong();
            long tb = ReadLong();
            if (ta > tb)
            {
                var tmp = la;
                la = lb;
                lb = tmp;

                tmp = ra;
                ra = rb;
                rb = tmp;

                tmp = ta;
                ta = tb;
                tb = tmp;
            }

            long gcd = Gcd(ta, tb);

            long p = tb / gcd;
            if (p == 1)
            {
                Writer.WriteLine(Length(la, ra, lb, rb));
                return;
            }

            long ans = 0;

            long l = -p;
            long r = p - 1;
            while (l < r)
            {
                long m = (l + r + 1) / 2;
                long x = la + m * gcd;
                if (x >= lb)
                {
                    r = m - 1;
                }
                else
                {
                    l = m;
                }
            }
            ans = Math.Max(ans, Length(la + r * gcd, ra + r * gcd, lb, rb));
            ans = Math.Max(ans, Length(la + (r + 1) * gcd, ra + (r + 1) * gcd, lb, rb));

            /*l = 0;
            r = p - 1;
            while (l < r)
            {
                long m = (l + r) / 2;
                long x = lb + m * gcd;
                if (x <= lb)
                {
                    l = m + 1;
                }
                else
                {
                    r = m;
                }
            }
            ans = Math.Max(ans, Length(la + l * gcd, ra + l * gcd, lb, rb));
            ans = Math.Max(ans, Length(la + (l - 1) * gcd, ra + (l - 1) * gcd, lb, rb));*/

            Writer.WriteLine(ans);
        }

        public static long Length(long a, long b, long c, long d)
        {
            return Math.Max(0, Math.Min(b, d) - Math.Max(a, c) + 1);
        }

        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static void Solve()
        {
            SolveCase();

            /*var sw = Stopwatch.StartNew();*/

            /*int T = ReadInt();
            for (int i = 0; i < T; i++)
            {
                // Writer.Write("Case #{0}: ", i + 1);
                SolveCase();
            }*/

            /*sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);*/
        }

        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if DEBUG
            //Reader = Console.In; Writer = Console.Out;
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");
#else
            Reader = Console.In; Writer = Console.Out;
#endif

            // Solve();
            Thread thread = new Thread(Solve, 64 * 1024 * 1024);
            thread.CurrentCulture = CultureInfo.InvariantCulture;
            thread.Start();
            thread.Join();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

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

        public static string ReadLine()
        {
            return Reader.ReadLine();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }
}


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

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

        private static void Main(string[] args)
        {
            int n = Next();

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }

            var dp = new int[2];
            int sum = nn[n - 1];
            dp[0] = nn[n - 1];

            for (int i = n - 2; i >= 0; i--)
            {
                var next = new int[2];

                next[0] = Math.Max(nn[i] + dp[1], dp[0]);
                next[1] = sum + nn[i] - Math.Max(nn[i] + sum - dp[0], sum - dp[1]);

                dp = next;
                sum += nn[i];
            }

            writer.Write(dp[1]);
            writer.Write(' ');
            writer.WriteLine(sum - dp[1]);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static long A, M,prod;
        static string[] read;

        static void Main(string[] args)
        {
            read = Console.ReadLine().Split();
            A = Convert.ToInt64(read[0]);
            M = Convert.ToInt64(read[1]);

            for(int i=1; i<=100000; ++i)
            {
                prod = A % M;
                A += prod;

                if (prod == 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");

            //Console.ReadKey();
        }

    }
}


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

namespace Training
{
    class Program
    {
       public static string s = Console.ReadLine();
       public static string qq = "QAQ";
        public static int[,] arr = new int[s.Length+1, 4]  ;

        public static  int Q(int m,int n)
        {
            if (arr[n , m ] != -1)
                return arr[n , m ];
            if (m == 0)
                return 1;
            if (n == 0)
                return 0;
            int i=0, j=0;
            if (qq[m-1]==s[n-1])
             i = Q( m - 1,  n - 1);

             j = Q(m, n - 1);
            arr[n , m ] = i + j;
            return i+j;

        }

        static void Main(string[] args)
        {
            for (int i = 0; i < s.Length+1; i++)
            {
                for (int j = 0; j < 4; j++)

                    arr[i, j] = -1;
            }

            Console.WriteLine(Q(3, s.Length));

        }
    }
}


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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(data[0]);
            int k = Convert.ToInt32(data[1]);
            int x = Convert.ToInt32(data[2]);

            data = Console.ReadLine().Split(' ');
            int[] c = new int[n];
            for (int i = 0; i < n; i++)
                c[i] = Convert.ToInt32(data[i]);

            int max = 0;
            for (int i = 1; i < n; i++)
            {
                if (c[i] != x || c[i - 1] != x)
                    continue;

                int l = i - 2, r = i + 1;
                int curr = 2;
                while (l >= 0 && r < n)
                {
                    int tmp = 0;
                    int q = c[r];
                    while (l >= 0 && c[l] == q)
                    {
                        l--;
                        tmp++;
                    }

                    while (r < n && c[r] == q)
                    {
                        r++;
                        tmp++;
                    }

                    if (tmp < 3)
                        break;

                    curr += tmp;
                }

                if (max < curr)
                    max = curr;
            }

            Console.WriteLine(max.ToString());
        }
    }
}