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

namespace AprilFools
{
    internal class Program
    {
        private const string TestIn = @"..\..\In\Text.in";
        private const string TestOut = @"..\..\In\Text.out";

        private static void Solve()
        {
            var nums = ReadIntArray();
            var n = nums[0];
            var k = nums[1];
            var nk = n - k;
            var nmul = nk;
            var kmul = k;

            // factorial n
            long kf = kmul;
            while (--k > 1)
            {
                kf *= kmul;
                kf = kf%1000000007;
            }

            long nkp = nk;
            while (--nk > 0)
            {
                nkp *= nmul;
                nkp = nkp%1000000007;
            }

            if (kf == 0) kf = 1;
            if (nkp == 0) nkp = 1;
            Console.WriteLine(((nkp * kf) % 1000000007));
        }

        public static string Multiply(string source, int multiplier)
        {
            StringBuilder sb = new StringBuilder(multiplier * source.Length);
            for (int i = 0; i < multiplier; i++)
            {
                sb.Append(source);
            }

            return sb.ToString();
        }

        private static void Main()
        {
            if (Debugger.IsAttached)
            {
                Console.SetIn(new StreamReader(TestIn));
                Console.SetOut(new StreamWriter(TestOut));
            }

            Solve();

            if (Debugger.IsAttached)
            {
                Console.In.Close();
                Console.Out.Close();
                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                //Console.ReadLine();
            }
        }

        #region Reader

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

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

        private static List<int> ReadIntArray()
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();
            return input;
        }

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

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

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        #endregion
    }
}


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

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


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

class C546 {
    class Battle {
        public Queue<int>[] A;
        public int FightCount = 0;
    }

    class BattleResult: Exception {
        public int FightCount, Winner;
        public override string ToString() => $"{FightCount} {Winner}";
    }

    class BattleField: TortoiseHare<Battle> {
        public Battle Seed;

        protected override Battle Clone(Battle state) {
            return new Battle {
                A = new Queue<int>[] {
                    new Queue<int>(state.A[0]),
                    new Queue<int>(state.A[1])
                }
            };
        }

        protected override Battle GetSeed() => Seed;

        protected override bool IsEquivalent(Battle a1, Battle a2) =>
            a1.A[0].SequenceEqual(a2.A[0]) && a1.A[1].SequenceEqual(a2.A[1]);

        protected override void Next(Battle battle) {
            var head = new int[2];
            for (int i = 0; i < 2; ++i)
                if (battle.A[i].Count == 0)
                    throw new BattleResult {
                        FightCount = battle.FightCount,
                        Winner = 2 - i
                    };
                else head[i] = battle.A[i].Dequeue();
            ++battle.FightCount;
            var win = head[0] < head[1] ? 1 : 0;
            battle.A[win].Enqueue(head[1 - win]);
            battle.A[win].Enqueue(head[win]);
        }
    }

    public static void Main() {
        Console.ReadLine();
        var a1 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var a2 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        try {
            new BattleField {
                Seed = new Battle {
                    A = new Queue<int>[2] {
                        new Queue<int>(a1.Skip(1)),
                        new Queue<int>(a2.Skip(1))
                    }
                }
            }.CycleLength();
            Console.WriteLine(-1);
        } catch (BattleResult result) {
            Console.WriteLine(result);
        }
    }

    // Snippet: TortoiseHare
    abstract class TortoiseHare<T> {
        protected abstract T GetSeed();
        protected abstract T Clone(T state);
        protected abstract bool IsEquivalent(T a1, T a2);
        protected abstract void Next(T state);

        public int CycleLength() {
            int n1 = 0, n2 = 1;
            T a1 = Clone(GetSeed()), a2 = Clone(a1);
            Next(a2);
            while (!IsEquivalent(a1, a2)) {
                if (n1 + n1 < n2) {
                    n1 = n2;
                    a1 = Clone(a2);
                }
                ++n2;
                Next(a2);
            }
            return n2 - n1;
        }
    }
}


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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
           string[] token = Console.ReadLine().Split();

           int n = int.Parse(token[0]);
           int a = int.Parse(token[1]);
           int b = int.Parse(token[2]);

           int min = Math.Min(a,b);
           int max = Math.Max(a,b);

           int ans = CountTrailingZero(n);

           int N  = n;

           while(true){
             if( max>N/2 && min<=N/2){
               break;
             }else if(max>N/2&&min>N/2){
               max -= N/2;
               min -= N/2;
             } else{
               N = N/2;
               ans--;
             }
           }

           if(n==N)
            Console.WriteLine("Final!");
           else
            Console.WriteLine(ans);
        }

        static int CountTrailingZero(int x)
        {
            int []lookup = {32, 0, 1, 26, 2, 23,
                            27, 0, 3, 16, 24, 30,
                            28, 11, 0, 13, 4, 7,
                            17, 0, 25, 22, 31, 15,
                            29, 10, 12, 6, 0, 21,
                            14, 9, 5, 20, 8, 19, 18};

            return lookup[(-x & x) % 37];
        }

    }
}


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

namespace CodeForcesApp
{
    class E
    {
        #region Shortcuts
        static string RL() { return Console.ReadLine(); }
        static string[] RSA() { return RL().Split(' '); }
        static int[] RIA() { return Array.ConvertAll<string, int>(RSA(), int.Parse); }
        static int RInt() { return int.Parse(RL()); }
        static long RLong() { return long.Parse(RL()); }
        static double RDouble() { return double.Parse(RL()); }
        static void RInts2(out int p1, out int p2) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; }
        static void RInts3(out int p1, out int p2, out int p3) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; }
        static void RInts4(out int p1, out int p2, out int p3, out int p4) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; p4 = a[3]; }

        static void Swap<T>(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }
        static void Fill<T>(T[] d, T v) { for (int i = 0; i < d.Length; i++) d[i] = v; }
        static void Fill<T>(T[,] d, T v) { for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { d[i, j] = v; } } }
        #endregion

        static void Main(string[] args)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            //SolutionTester tester = new SolutionTester(CodeForcesTask.E);
            //tester.Test();

            Task task = new Task();
            task.Solve();
        }

        public class Task
        {
            public void Solve()
            {
                int xv, yv, xp, yp, xw1, yw1, xw2, yw2, xm1, ym1, xm2, ym2;
                RInts2(out xv, out yv);
                RInts2(out xp, out yp);
                RInts4(out xw1, out yw1, out xw2, out yw2);
                RInts4(out xm1, out ym1, out xm2, out ym2);

                Point v = new Point(xv, yv);
                Point p = new Point(xp, yp);

                Segment view = new Segment(xv, yv, xp, yp);
                Segment wall = new Segment(xw1, yw1, xw2, yw2);
                Segment mirror = new Segment(xm1, ym1, xm2, ym2);

                Point rp = p.Reflect(mirror.ToLine());

                Segment rview = new Segment(xv, yv, rp.x, rp.y);
                Segment rdview = new Segment(rp.x, rp.y, xp, yp);

                Point pt1, pt2;

                if (!view.Intersects(wall, out pt1, out pt2) && !view.Intersects(mirror, out pt1, out pt2))
                {
                    Console.WriteLine("YES");
                    return;
                }

                Point rpm1, rpm2;
                if (rview.Intersects(mirror, out rpm1, out rpm2))
                {
                    Segment s1 = new Segment(v, rpm1);
                    Segment s2 = new Segment(rpm1, p);
                    if (!s1.Intersects(wall, out pt1, out pt2) && !s2.Intersects(wall, out pt1, out pt2))
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }
                Console.WriteLine("NO");
            }
        }

        public class GeometryUtils
        {
            public const double EPS = 10e-12;

            public static double SqrDist(double x1, double y1, double x2, double y2)
            {
                return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
            }

            public static double Dist(double x1, double x2)
            {
                return Math.Abs(x1 - x2);
            }

            public static double Dist(double x1, double y1, double x2, double y2)
            {
                return Math.Sqrt(SqrDist(x1, y1, x2, y2));
            }

            public static double Determinant(
                double a11, double a12,
                double a21, double a22)
            {
                return a11 * a22 - a21 * a12;
            }

            public static double Determinant(
                double a11, double a12, double a13,
                double a21, double a22, double a23,
                double a31, double a32, double a33
                )
            {
                return a11 * Determinant(a22, a23, a32, a33) - a21 * Determinant(a12, a13, a32, a33) + a31 * Determinant(a12, a13, a22, a23);
            }

            public static int Sign(double val)
            {
                if (Math.Abs(val) <= EPS)
                    return 0;

                if (val > EPS)
                    return 1;

                return -1;
            }

        }

        public class Point
        {
            public double x;
            public double y;

            #region Constructors

            public Point()
            {
            }

            public Point(double _x, double _y)
            {
                x = _x;
                y = _y;
            }

            #endregion

            #region Public Methods

            public Vector ToVector()
            {
                return new Vector(x, y);
            }

            public int Orientation(Point q, Point r)
            {
                return Orientation(this, q, r);
            }

            public double Area(Point q, Point r)
            {
                return Area(this, q, r);
            }

            public double SqrDist(Point q)
            {
                return GeometryUtils.SqrDist(x, y, q.x, q.y);
            }

            public double Distance()
            {
                return GeometryUtils.Dist(x, y, 0, 0);
            }

            public double Distance(Point q)
            {
                return GeometryUtils.Dist(x, y, q.x, q.y);
            }

            public double XDist(Point q)
            {
                return GeometryUtils.Dist(x, q.x);
            }

            public double YDist(Point q)
            {
                return GeometryUtils.Dist(y, q.y);
            }

            public Point Translate(double _x, double _y)
            {
                return new Point(x + _x, y + _y);
            }

            public Point Translate(Vector v)
            {
                return new Point(x + v.x, y + v.y);
            }

            // Находит проекцию точки на прямую
            public Point Project(Line line)
            {
                Line ort = new Line(this, line.NormalVector);
                Point pt;
                line.Intersects(ort, out pt);
                return pt;
            }

            public Point Reflect(Line line)
            {
                Point pr = Project(line);
                Vector v = (pr - this).Scale(2);
                return this.Translate(v);
            }

            #endregion

            #region Static Members

            public static Vector operator -(Point p1, Point p2)
            {
                return new Vector(p1.x - p2.x, p1.y - p2.y);
            }

            public static int Orientation(Point p, Point q, Point r)
            {
                double det = GeometryUtils.Determinant(p.x, p.y, 1, q.x, q.y, 1, r.x, r.y, 1);
                if (det > 0) return 1;
                if (det < 0) return -1;
                return 0;
            }

            public static double Area(Point p, Point q, Point r)
            {
                return GeometryUtils.Determinant(q.x - p.x, q.y - p.y, r.x - p.x, r.y - p.y);
            }

            #endregion
        }

        public class Vector
        {
            public double x;
            public double y;

            public Vector()
            {
            }

            public Vector(double _x, double _y)
            {
                x = _x;
                y = _y;
            }

            public Vector Translate(double a, double b)
            {
                return new Vector(x + a, y + b);
            }

            public Vector Translate(Vector v)
            {
                return new Vector(x + v.x, y + v.y);
            }

            public Vector Scale(double d)
            {
                return new Vector(x * d, y * d);
            }
        }

        public class Segment
        {
            private Point start;
            private Point end;

            #region Constructors

            public Segment()
                : this(new Point(), new Point())
            {
            }

            public Segment(Point s, Point e)
            {
                start = s;
                end = e;
            }

            public Segment(double x1, double y1, double x2, double y2)
                : this(new Point(x1, y1), new Point(x2, y2))
            {
            }

            #endregion

            #region Public Properties

            public Point Start
            {
                get { return start; }
                set { start = value; }
            }

            public Point End
            {
                get { return end; }
                set { end = value; }
            }

            public double x1
            {
                get { return start.x; }
                set { start.x = value; }
            }

            public double y1
            {
                get { return start.y; }
                set { start.y = value; }
            }

            public double x2
            {
                get { return end.x; }
                set { end.x = value; }
            }

            public double y2
            {
                get { return end.y; }
                set { end.y = value; }
            }

            public Vector Direction
            {
                get { return End - Start; }
            }

            #endregion

            #region Public Methods

            public Line ToLine()
            {
                return new Line(this);
            }

            public bool Intersects(Segment seg, out Point p1, out Point p2)
            {
                p1 = new Point();
                p2 = new Point();

                double minx1 = Math.Min(Start.x, End.x);
                double maxx1 = Math.Max(Start.x, End.x);
                double miny1 = Math.Min(Start.y, End.y);
                double maxy1 = Math.Max(Start.y, End.y);

                double minx2 = Math.Min(seg.Start.x, seg.End.x);
                double maxx2 = Math.Max(seg.Start.x, seg.End.x);
                double miny2 = Math.Min(seg.Start.y, seg.End.y);
                double maxy2 = Math.Max(seg.Start.y, seg.End.y);

                if (minx1 > maxx2 || maxx1 < minx2 || miny1 > maxy2 || maxy1 < miny2)
                    return false;  // boundary rectangles not intersected

                Line this_line = this.ToLine();
                Line seg_line = seg.ToLine();

                if (this_line.Parallel(seg_line))
                {
                    if (this_line.Equivalent(seg_line))
                    {
                        p1.x = Math.Max(minx1, minx2);
                        p1.y = Math.Max(miny1, miny2);
                        p2.x = Math.Min(maxx1, maxx2);
                        p2.y = Math.Min(miny1, miny2);
                        return true; // intersection by segment
                    }
                    else
                        return false; // parallel
                }

                Point pt;
                if (!this_line.Intersects(seg_line, out pt))
                    return false;

                if (pt.x >= minx1 && pt.x <= maxx1 &&
                    pt.y >= miny1 && pt.y <= maxy1 &&
                    pt.x >= minx2 && pt.x <= maxx2 &&
                    pt.y >= miny2 && pt.y <= maxy2)
                {
                    p1.x = pt.x;
                    p1.y = pt.y;
                    p2.x = pt.x;
                    p2.y = pt.y;
                    return true; // in one point
                }

                return false;
            }

            public double Distance(Point p)
            {
                Line line = this.ToLine();
                double[] cc = line.Coeffs;
                double A = cc[0];
                double B = cc[1];
                double C = cc[2];

                double d = (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);
                d = Math.Min(d, p.Distance(Start));
                d = Math.Min(d, p.Distance(End));
                return d;
            }

            #endregion

        }

        public class Line
        {
            #region Private Members

            private Point bp;
            private Vector dir;

            #endregion

            #region Constructors

            public Line()
                : this(new Point(), new Vector(1, 0))
            {
            }

            public Line(Point p, Vector v)
            {
                bp = p;
                dir = v;
            }

            public Line(Point p1, Point p2)
                : this(p1, p2 - p1)
            {

            }

            public Line(double x1, double y1, double x2, double y2) :
                this(new Point(x1, y1), new Point(x2, y2))
            {
            }

            public Line(Segment s) :
                this(s.Start, s.Direction)
            {

            }

            #endregion

            #region Public Properties

            public Point BasePoint { get { return bp; } }
            public Vector Direction { get { return dir; } }
            public Vector NormalVector { get { return new Vector(-dir.y, dir.x); } }
            public double[] Coeffs
            {
                get
                {
                    return new double[3]
                {
                    dir.y,
                    -dir.x,
                    dir.x * bp.y - dir.y * bp.x
                };
                }
            }

            public double A { get { return dir.y; } }
            public double B { get { return -dir.x; } }
            public double C { get { return dir.x * bp.y - dir.y * bp.x; } }

            #endregion

            #region Public Methods

            public bool Intersects(Line line, out Point pt)
            {
                pt = new Point();

                double d = GeometryUtils.Determinant(A, B, line.A, line.B);
                if (GeometryUtils.Sign(d) == 0)
                    return false;

                pt.x = -GeometryUtils.Determinant(C, B, line.C, line.B) / d;
                pt.y = -GeometryUtils.Determinant(A, C, line.A, line.C) / d;

                return true;
            }

            public bool Parallel(Line line)
            {
                double d = GeometryUtils.Determinant(A, B, line.A, line.B);
                return GeometryUtils.Sign(d) == 0;
            }

            public bool Equivalent(Line line)
            {
                double d1 = GeometryUtils.Determinant(A, B, line.A, line.B);
                double d2 = GeometryUtils.Determinant(A, C, line.A, line.C);
                double d3 = GeometryUtils.Determinant(B, C, line.B, line.C);

                return GeometryUtils.Sign(d1) == 0 && GeometryUtils.Sign(d2) == 0 && GeometryUtils.Sign(d2) == 0;
            }

            public double Distance(Point p)
            {
                return (A * p.x + B * p.y + C) / Math.Sqrt(A * A + B * B);
            }

            #endregion
        }

    }
}


using System;
using System.IO;

namespace CF_R257
{
    public class Task_C
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new StreamReader(@"c_input.txt"));
#endif
            new Task_C().Solve();
        }

        long n;
        long m;
        long k;
        long maxArea;

        private void Solve()
        {
            var parts = Console.ReadLine().Split();
            n = long.Parse(parts[0]);
            m = long.Parse(parts[1]);
            k = long.Parse(parts[2]);

            long nsq = ((int)Math.Sqrt(n) + 1);
            long msq = ((int)Math.Sqrt(n) + 1);
            maxArea = -1;

            for (int i = 1; i <= nsq; i++)
            {
                Test(i, n / i, m);
                Test(n / i, i, m);
            }

            for (int i = 1; i <= msq; i++)
            {
                Test(i, m / i, n);
                Test(m / i, i, n);
            }

            Console.WriteLine(maxArea);
        }

        private void Test(long w1, long count1, long dim2)
        {
            long k1 = count1 - 1;
            long k2 = k - k1;

            if (w1 <= 0 || k1 < 0 || k2 < 0)
                return;

            long w2 = dim2 / (k2 + 1);
            if (w2 <= 0)
                return;

            var area = w1 * w2;
            if (area > maxArea)
            {
                maxArea = area;
            }
        }
    }
}


using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

class cf734
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static void Main()
    {
        var t = NN;
        var res = new List<bool>();
        for (var _ = 0; _ < t; ++_)
        {
            var c = NList;
            if (c[0] == 1) res.Add(c[2] == c[1] / 2);
            else if (c[1] == 1) res.Add(c[2] == 0);
            else
            {
                var lvbs = c[1] / 2;
                var lsqs = (c[0] / 2) * lvbs;
                var min = c[0] % 2 == 0 ? 0 : lvbs;
                var max = min + lsqs * 2;
                res.Add(c[2] >= min && c[2] <= max && (c[2] - min) % 2 == 0);
            }
        }
        WriteLine(string.Join("\n", res.Select(r => r ? "YES" : "NO")));
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Numerics;
using E = System.Linq.Enumerable;

namespace ProbA {
    class Program {
        protected IOHelper io;

        long F(long x) {
            return x * (x + 1) / 2;
        }

        public Program(string inputFile, string outputFile) {
            io = new IOHelper(inputFile, outputFile, Encoding.Default);

            long n = long.Parse(io.NextToken());

            int mid, left = 1, right = 1000000000;
            while(left <= right){
                mid = (left + right) >> 1;
                if(F(mid) >= n) right = mid - 1;
                else left = mid + 1;
            }
            io.WriteLine(n-F(left-1));

            /*
            io.WriteLine(
                (from i in E.Range(0,15000002)
                    let x=n-(long)i*(long)(i+1)/2
                    where x>0
                    select x).Min()
                );*/
            io.Dispose();
        }

        static void Main(string[] args) {
            Program myProgram = new Program(null, null);
        }
    }

    class IOHelper : IDisposable {
        public StreamReader reader;
        public StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding) {
            if (inputFile == null)
                reader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                reader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                writer = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                writer = new StreamWriter(outputFile, false, encoding);

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public bool hasNext() {
            if (curTokenIdx >= curLine.Length) {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            return curTokenIdx < curLine.Length;
        }

        public string NextToken() {
            return hasNext() ? curLine[curTokenIdx++] : null;
        }

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

        public double NextDouble() {
            string tkn = NextToken();
            return double.Parse(tkn, System.Globalization.CultureInfo.InvariantCulture);
        }

        public void Write(double val, int precision) {
            writer.Write(val.ToString("F" + precision, System.Globalization.CultureInfo.InvariantCulture));
        }

        public void Write(object stringToWrite) {
            writer.Write(stringToWrite);
        }

        public void WriteLine(double val, int precision) {
            writer.WriteLine(val.ToString("F" + precision, System.Globalization.CultureInfo.InvariantCulture));
        }

        public void WriteLine(object stringToWrite) {
            writer.WriteLine(stringToWrite);
        }

        public void Dispose() {
            try {
                if (reader != null) {
                    reader.Dispose();
                }
                if (writer != null) {
                    writer.Flush();
                    writer.Dispose();
                }
            } catch { };
        }

        public void Flush() {
            if (writer != null) {
                writer.Flush();
            }
        }
    }
}


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[] t1 = Console.ReadLine().Split();
            int n = int.Parse(t1[0]); // КОЛЛИЧЕСТВО ПАПОК
            int m = int.Parse(t1[1]); // ПАПОК ПО ГОРИЗОНТАЛИ
            int a = int.Parse(t1[2]); // ОТ А
            int b = int.Parse(t1[3]); // ДО Б

            int kstrok = n / m + 1; // koll strok

            int[] array = new int[kstrok + 1];
            for (int i = 2; i < kstrok + 1; i++) //massiv zapominaet nachalo strok
                array[i] = m * i - m + 1;

            array[1] = 1;

            int[] myarray = new int[kstrok + 1];
            for (int i = 1; i < kstrok + 1; i++) //massiv zapominaet konez strok
                myarray[i] = m * i;

            int strokaa = 1;
            int strokab = 1;

            for (int i = 1; i < kstrok + 1; i++)
                if (a > myarray[i])
                    strokaa = strokaa + 1; //наход строки а

            for (int i = 1; i < kstrok + 1; i++)
                if (b > myarray[i])//наход строки б
                    strokab = strokab + 1;

            int proverkaa1 = 0;
            int proverkab1 = 0;

            for (int i = 1; i < kstrok; i++)
                if (a == array[i]) //esli a v nachale stroki
                    proverkaa1 = proverkaa1 + 1;

            for (int i = 1; i < kstrok; i++)
                if (b == myarray[i])// esli b v konze stroki
                    proverkab1 = proverkab1 + 1;

            if (proverkaa1 + proverkab1 == 2)
                Console.WriteLine(1);

            int o = 0;
                if (strokaa == strokab && proverkaa1 + proverkab1 != 2)
                {
                    Console.WriteLine(1); // esli v odnoi stroke a i b
                    o = 1;
                }

            int proverkaa2 = 0; //Нашлась ли а не по кроям строки?
            int proverkab2 = 0; //Нашлась ли б не по кроям строки?

            for (int i = 1; i < kstrok + 1; i++)
                if (a > array[i] && a <= myarray[i])
                    proverkaa2 = proverkaa2 + 1; //Нашлась ли а не по кроям строки?

            for (int i = 1; i < kstrok + 1; i++)
                if (b >= array[i] && b < myarray[i])
                    proverkab2 = proverkab2 + 1; //Нашлась ли а не по кроям строки?
            int q = 0;
            if (o == 0)
            {
                if (proverkaa2 + proverkab2 == 2 && strokaa + 1 < strokab)
                    if ((a - 1) % m == b % m)
                    {
                        Console.WriteLine(2);
                        q = 1;
                    }

                if (proverkaa2 + proverkab2 == 2 && strokaa + 1 < strokab)
                    if (b != n && q != 1)
                    Console.WriteLine(3); //если а и б находятся не по краям и расстояние > m
                    else if (q != 1)
                    Console.WriteLine(2);

                if (proverkaa2 + proverkab2 == 2 && strokaa + 1 == strokab)
                    Console.WriteLine(2); //если а и б находятся не по краям и расстояние <= m

                if (proverkaa1 + proverkab2 == 2)
                    if (b != n)
                    Console.WriteLine(2); //если а с краю, а б нет
                    else Console.WriteLine(1);

                if (proverkaa2 + proverkab1 == 2)
                Console.WriteLine(2); //если б с краю, а а неt
            }
        }
    }
}


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

using E = System.Linq.Enumerable;
using System.Threading;

internal partial class Solver {

    public static bool UpdateMin<T>(ref T x, T newValue) where T : IComparable<T> {
        if (x.CompareTo(newValue) > 0) { x = newValue; return true; }
        return false;
    }
    public static bool UpdateMax<T>(ref T x, T newValue) where T : IComparable<T> {
        if (x.CompareTo(newValue) < 0) { x = newValue; return true; }
        return false;
    }

    public void Run() {
        var n = ni();
        var k = ni();
        var s = ns();
        var t = ns();
        long ans = 0;
        if (t[0] == t[1]) {
            long count = s.Count(c => c == t[0]);
            count += k;
            if (count > s.Length) count = s.Length;
            ans = count * (count - 1) / 2;
        } else {
            var c1 = t[0];
            var c2 = t[1];
            var memo = new long?[s.Length, k + 1, n + 1]; // (changeNum, occurrence of c1)

            Func<int, int, int, long> dfs = null;

            dfs = (int pos, int changeNum, int c1Num) => {
                if (pos == s.Length) return 0;
                ref var ret = ref memo[pos, changeNum, c1Num];
                if (!ret.HasValue) {
                    long val = 0;
                    var c = s[pos];
                    if (c == c1) {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num + 1));
                    } else {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num));
                        if (changeNum < k) {
                            val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num + 1));
                        }
                    }
                    if (c == c2) {
                        val = Math.Max(val, dfs(pos + 1, changeNum, c1Num) + c1Num);
                    } else {
                        if (changeNum < k) {
                            val = Math.Max(val, dfs(pos + 1, changeNum + 1, c1Num) + c1Num);
                        }
                    }
                    ret = val;
                }
                return ret.Value;
            };
            ans = dfs(0, 0, 0);
        }
        cout.WriteLine(ans);
    }

    public static void Fill<T>(T[,] array, T value) {
        int height = array.GetLength(0);
        int width = array.GetLength(1);
        for (int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++) {
                array[i, j] = value;
            }
        }
    }

}

// PREWRITEN CODE BEGINS FROM HERE

static public class StringExtensions {
    static public string JoinToString<T>(this IEnumerable<T> source, string separator = " ") {
        return string.Join(separator, source);
    }
}

internal partial class Solver : Scanner {
    static readonly int? StackSizeInMebiByte = null; //50;
    public static void StartAndJoin(Action action, int maxStackSize) {
        var thread = new Thread(new ThreadStart(action), maxStackSize);
        thread.Start();
        thread.Join();
    }

    public static void Main() {
#if LOCAL
        byte[] inputBuffer = new byte[1000000];
        var inputStream = Console.OpenStandardInput(inputBuffer.Length);
        using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {
            Console.SetIn(reader);
            new Solver(Console.In, Console.Out).Run();
        }
#else
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        if (StackSizeInMebiByte.HasValue) {
            StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);
        } else {
            new Solver(Console.In, Console.Out).Run();
        }
        Console.Out.Flush();
#endif
    }

#pragma warning disable IDE0052
    private readonly TextReader cin;
    private readonly TextWriter cout;
    private readonly TextWriter cerr;
#pragma warning restore IDE0052

    public Solver(TextReader reader, TextWriter writer)
        : base(reader) {
        cin = reader;
        cout = writer;
        cerr = Console.Error;
    }

    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer) {
    }

#pragma warning disable IDE1006
#pragma warning disable IDE0051
    private int ni() { return NextInt(); }
    private int[] ni(int n) { return NextIntArray(n); }
    private long nl() { return NextLong(); }
    private long[] nl(int n) { return NextLongArray(n); }
    private double nd() { return NextDouble(); }
    private double[] nd(int n) { return NextDoubleArray(n); }
    private string ns() { return Next(); }
    private string[] ns(int n) { return NextArray(n); }
#pragma warning restore IDE1006
#pragma warning restore IDE0051
}

#if DEBUG
internal static class LinqPadExtension {
    public static string TextDump<T>(this T obj) {
        if (obj is IEnumerable) return (obj as IEnumerable).Cast<object>().JoinToString().Dump();
        else return obj.ToString().Dump();
    }
    public static T Dump<T>(this T obj) {
        return LINQPad.Extensions.Dump(obj);
    }
}
#endif

public class Scanner {
    private readonly TextReader Reader;
    private readonly CultureInfo ci = CultureInfo.InvariantCulture;

    private readonly char[] buffer = new char[2 * 1024];
    private int cursor = 0, length = 0;
    private string Token;
    private readonly StringBuilder sb = new StringBuilder(1024);

    public Scanner()
        : this(Console.In) {
    }

    public Scanner(TextReader reader) {
        Reader = reader;
    }

    public int NextInt() { return checked((int)NextLong()); }
    public long NextLong() {
        var s = Next();
        long r = 0;
        int i = 0;
        bool negative = false;
        if (s[i] == '-') {
            negative = true;
            i++;
        }
        for (; i < s.Length; i++) {
            r = r * 10 + (s[i] - '0');
#if DEBUG
            if (!char.IsDigit(s[i])) throw new FormatException();
#endif
        }
        return negative ? -r : r;
    }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size) {
        string[] array = new string[size];
        for (int i = 0; i < size; i++) {
            array[i] = Next();
        }

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

        return array;
    }

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

        return array;
    }

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

        return array;
    }

    public string Next() {
        if (Token == null) {
            if (!StockToken()) {
                throw new Exception();
            }
        }
        var token = Token;
        Token = null;
        return token;
    }

    public bool HasNext() {
        if (Token != null) {
            return true;
        }

        return StockToken();
    }

    private bool StockToken() {
        while (true) {
            sb.Clear();
            while (true) {
                if (cursor >= length) {
                    cursor = 0;
                    if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {
                        break;
                    }
                }
                var c = buffer[cursor++];
                if (33 <= c && c <= 126) {
                    sb.Append(c);
                } else {
                    if (sb.Length > 0) break;
                }
            }

            if (sb.Length > 0) {
                Token = sb.ToString();
                return true;
            }

            return false;
        }
    }
}


using System;
using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.X86;
using EducationalCodeforcesRound98.Questions;
using ModInt = EducationalCodeforcesRound98.StaticModInt<EducationalCodeforcesRound98.Mod998244353>;

namespace EducationalCodeforcesRound98.Questions
{
    public class QuestionD : AtCoderQuestionBase
    {
        [MethodImpl(MethodImplOptions.AggressiveOptimization)]
        public override void Solve(IOManager io)
        {
            var n = io.ReadInt();
            var oddBit = new BinaryIndexedTree(n + 1);
            var evenBit = new BinaryIndexedTree(n + 1);

            evenBit[0] = ModInt.One;

            for (int i = 1; i <= n; i++)
            {
                var even = evenBit.Sum(0, i);
                oddBit.AddAt(i, even);
                (oddBit, evenBit) = (evenBit, oddBit);
            }

            var result = evenBit[n] / ModInt.Raw(2).Pow(n);
            io.WriteLine(result);
        }

        public class BinaryIndexedTree
        {
            ModInt[] _data;
            public int Length { get; }

            public BinaryIndexedTree(int length)
            {
                _data = new ModInt[length + 1];   // 内部的には1-indexedにする
                Length = length;
            }

            public BinaryIndexedTree(IEnumerable<ModInt> data, int length) : this(length)
            {
                var count = 0;
                foreach (var n in data)
                {
                    AddAt(count++, n);
                }
            }

            public BinaryIndexedTree(ICollection<ModInt> collection) : this(collection, collection.Count) { }

            public ModInt this[int index]
            {
                get => Sum(index, index + 1);
                set => AddAt(index, value - this[index]);
            }

            ///
            /// BITの<c>index</c>番目の要素に<c>n</c>を加算します。
            ///
            /// <param name="index">加算するインデックス（0-indexed）</param>
            /// <param name="value">加算する数</param>
            public void AddAt(Index index, ModInt value)
            {
                var i = index.GetOffset(Length);
                unchecked
                {
                    if ((uint)i >= (uint)Length)
                    {
                        throw new ArgumentOutOfRangeException(nameof(index));
                    }
                }

                i++;  // 1-indexedにする

                while (i <= Length)
                {
                    _data[i] += value;
                    i += i & -i;    // LSBの加算
                }
            }

            ///
            /// [0, <c>end</c>)の部分和を返します。
            ///
            /// <param name="end">部分和を求める半開区間の終了インデックス</param>
            /// <returns>区間の部分和</returns>
            public ModInt Sum(Index end)
            {
                var i = end.GetOffset(Length);  // 0-indexedの半開区間＝1-indexedの閉区間なので+1は不要
                unchecked
                {
                    if ((uint)i >= (uint)_data.Length)
                    {
                        throw new ArgumentOutOfRangeException(nameof(end));
                    }
                }

                ModInt sum = 0;
                while (i > 0)
                {
                    sum += _data[i];
                    i -= i & -i;    // LSBの減算
                }
                return sum;
            }

            ///
            /// <c>range</c>の部分和を返します。
            ///
            /// <param name="range">部分和を求める半開区間</param>
            /// <returns>区間の部分和</returns>
            public ModInt Sum(Range range) => Sum(range.End) - Sum(range.Start);

            ///
            /// [<c>start</c>, <c>end</c>)の部分和を返します。
            ///
            /// <param name="start">部分和を求める半開区間の開始インデックス</param>
            /// <param name="end">部分和を求める半開区間の終了インデックス</param>
            /// <returns>区間の部分和</returns>
            public ModInt Sum(int start, int end) => Sum(end) - Sum(start);
        }

    }
}

namespace EducationalCodeforcesRound98
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionD();
            using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());
            question.Solve(io);
        }
    }
}

#region Base Class

namespace EducationalCodeforcesRound98.Questions
{
    public interface IAtCoderQuestion
    {
        string Solve(string input);
        void Solve(IOManager io);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public string Solve(string input)
        {
            var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));
            var outputStream = new MemoryStream();
            using var manager = new IOManager(inputStream, outputStream);

            Solve(manager);
            manager.Flush();

            outputStream.Seek(0, SeekOrigin.Begin);
            var reader = new StreamReader(outputStream);
            return reader.ReadToEnd();
        }

        public abstract void Solve(IOManager io);
    }
}

#endregion

#region Utils

namespace EducationalCodeforcesRound98
{
    public class IOManager : IDisposable
    {
        private readonly BinaryReader _reader;
        private readonly StreamWriter _writer;
        private bool _disposedValue;
        private byte[] _buffer = new byte[1024];
        private int _length;
        private int _cursor;
        private bool _eof;

        const char ValidFirstChar = '!';
        const char ValidLastChar = '~';

        public IOManager(Stream input, Stream output)
        {
            _reader = new BinaryReader(input);
            _writer = new StreamWriter(output) { AutoFlush = false };
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private char ReadAscii()
        {
            if (_cursor == _length)
            {
                _cursor = 0;
                _length = _reader.Read(_buffer);

                if (_length == 0)
                {
                    if (!_eof)
                    {
                        _eof = true;
                        return char.MinValue;
                    }
                    else
                    {
                        ThrowEndOfStreamException();
                    }
                }
            }

            return (char)_buffer[_cursor++];
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public char ReadChar()
        {
            char c;
            while (!IsValidChar(c = ReadAscii())) { }
            return c;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public string ReadString()
        {
            var builder = new StringBuilder();
            char c;
            while (!IsValidChar(c = ReadAscii())) { }

            do
            {
                builder.Append(c);
            } while (IsValidChar(c = ReadAscii()));

            return builder.ToString();
        }

        public int ReadInt() => (int)ReadLong();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long ReadLong()
        {
            long result = 0;
            bool isPositive = true;
            char c;

            while (!IsNumericChar(c = ReadAscii())) { }

            if (c == '-')
            {
                isPositive = false;
                c = ReadAscii();
            }

            do
            {
                result *= 10;
                result += c - '0';
            } while (IsNumericChar(c = ReadAscii()));

            return isPositive ? result : -result;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private Span<char> ReadChunk(Span<char> span)
        {
            var i = 0;
            char c;
            while (!IsValidChar(c = ReadAscii())) { }

            do
            {
                span[i++] = c;
            } while (IsValidChar(c = ReadAscii()));

            return span.Slice(0, i);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public double ReadDouble() => double.Parse(ReadChunk(stackalloc char[32]));

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public decimal ReadDecimal() => decimal.Parse(ReadChunk(stackalloc char[32]));

        public int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }

        public long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }

        public double[] ReadDoubleArray(int n)
        {
            var a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadDouble();
            }
            return a;
        }

        public decimal[] ReadDecimalArray(int n)
        {
            var a = new decimal[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadDecimal();
            }
            return a;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Write<T>(T value) => _writer.Write(value.ToString());

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteLine<T>(T value) => _writer.WriteLine(value.ToString());

        public void WriteLine<T>(IEnumerable<T> values, char separator)
        {
            var e = values.GetEnumerator();
            if (e.MoveNext())
            {
                _writer.Write(e.Current.ToString());

                while (e.MoveNext())
                {
                    _writer.Write(separator);
                    _writer.Write(e.Current.ToString());
                }
            }

            _writer.WriteLine();
        }

        public void WriteLine<T>(T[] values, char separator) => WriteLine((ReadOnlySpan<T>)values, separator);
        public void WriteLine<T>(Span<T> values, char separator) => WriteLine((ReadOnlySpan<T>)values, separator);

        public void WriteLine<T>(ReadOnlySpan<T> values, char separator)
        {
            for (int i = 0; i < values.Length - 1; i++)
            {
                _writer.Write(values[i]);
                _writer.Write(separator);
            }

            if (values.Length > 0)
            {
                _writer.Write(values[^1]);
            }

            _writer.WriteLine();
        }

        public void Flush() => _writer.Flush();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static bool IsNumericChar(char c) => ('0' <= c && c <= '9') || c == '-';

        private void ThrowEndOfStreamException() => throw new EndOfStreamException();

        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _reader.Dispose();
                    _writer.Flush();
                    _writer.Dispose();
                }

                _disposedValue = true;
            }
        }

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

    public static class UtilExtensions
    {
        public static bool ChangeMax<T>(ref this T value, T other) where T : struct, IComparable<T>
        {
            if (value.CompareTo(other) < 0)
            {
                value = other;
                return true;
            }
            return false;
        }

        public static bool ChangeMin<T>(ref this T value, T other) where T : struct, IComparable<T>
        {
            if (value.CompareTo(other) > 0)
            {
                value = other;
                return true;
            }
            return false;
        }

        public static void SwapIfLargerThan<T>(ref this T a, ref T b) where T : struct, IComparable<T>
        {
            if (a.CompareTo(b) > 0)
            {
                (a, b) = (b, a);
            }
        }

        public static void SwapIfSmallerThan<T>(ref this T a, ref T b) where T : struct, IComparable<T>
        {
            if (a.CompareTo(b) < 0)
            {
                (a, b) = (b, a);
            }
        }

        public static void Sort<T>(this T[] array) where T : IComparable<T> => Array.Sort(array);
        public static void Sort<T>(this T[] array, Comparison<T> comparison) => Array.Sort(array, comparison);
    }

    public static class CollectionExtensions
    {
        private class ArrayWrapper<T>
        {
#pragma warning disable CS0649
            public T[] Array;
#pragma warning restore CS0649
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static Span<T> AsSpan<T>(this List<T> list)
        {
            return Unsafe.As<ArrayWrapper<T>>(list).Array.AsSpan(0, list.Count);
        }

        public static void Fill<T>(this T[] array, T value) => array.AsSpan().Fill(value);
        public static void Fill<T>(this T[,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0], array.Length).Fill(value);
        public static void Fill<T>(this T[,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0], array.Length).Fill(value);
        public static void Fill<T>(this T[,,,] array, T value) => MemoryMarshal.CreateSpan(ref array[0, 0, 0, 0], array.Length).Fill(value);
    }

    public static class SearchExtensions
    {
        struct LowerBoundComparer<T> : IComparer<T> where T : IComparable<T>
        {
            public int Compare(T x, T y) => 0 <= x.CompareTo(y) ? 1 : -1;
        }

        struct UpperBoundComparer<T> : IComparer<T> where T : IComparable<T>
        {
            public int Compare(T x, T y) => 0 < x.CompareTo(y) ? 1 : -1;
        }

        // https://trsing.hatenablog.com/entry/2019/08/27/211038
        public static int GetGreaterEqualIndex<T>(this ReadOnlySpan<T> span, T inclusiveMin) where T : IComparable<T> => ~span.BinarySearch(inclusiveMin, new UpperBoundComparer<T>());
        public static int GetGreaterThanIndex<T>(this ReadOnlySpan<T> span, T exclusiveMin) where T : IComparable<T> => ~span.BinarySearch(exclusiveMin, new LowerBoundComparer<T>());
        public static int GetLessEqualIndex<T>(this ReadOnlySpan<T> span, T inclusiveMax) where T : IComparable<T> => ~span.BinarySearch(inclusiveMax, new LowerBoundComparer<T>()) - 1;
        public static int GetLessThanIndex<T>(this ReadOnlySpan<T> span, T exclusiveMax) where T : IComparable<T> => ~span.BinarySearch(exclusiveMax, new UpperBoundComparer<T>()) - 1;
        public static int GetGreaterEqualIndex<T>(this Span<T> span, T inclusiveMin) where T : IComparable<T> => ((ReadOnlySpan<T>)span).GetGreaterEqualIndex(inclusiveMin);
        public static int GetGreaterThanIndex<T>(this Span<T> span, T exclusiveMin) where T : IComparable<T> => ((ReadOnlySpan<T>)span).GetGreaterThanIndex(exclusiveMin);
        public static int GetLessEqualIndex<T>(this Span<T> span, T inclusiveMax) where T : IComparable<T> => ((ReadOnlySpan<T>)span).GetLessEqualIndex(inclusiveMax);
        public static int GetLessThanIndex<T>(this Span<T> span, T exclusiveMax) where T : IComparable<T> => ((ReadOnlySpan<T>)span).GetLessThanIndex(exclusiveMax);

        public static int BoundaryBinarySearch(Predicate<int> predicate, int ok, int ng)
        {
            while (Math.Abs(ok - ng) > 1)
            {
                int mid = (ok + ng) / 2;
                if (predicate(mid))
                {
                    ok = mid;
                }
                else
                {
                    ng = mid;
                }
            }
            return ok;
        }

        public static long BoundaryBinarySearch(Predicate<long> predicate, long ok, long ng)
        {
            while (Math.Abs(ok - ng) > 1)
            {
                long mid = (ok + ng) / 2;
                if (predicate(mid))
                {
                    ok = mid;
                }
                else
                {
                    ng = mid;
                }
            }
            return ok;
        }

        public static double Bisection(Func<double, double> f, double a, double b, double eps = 1e-9)
        {
            if (f(a) * f(b) >= 0)
            {
                throw new ArgumentException("f(a)とf(b)は異符号である必要があります。");
            }

            const int maxLoop = 100;
            double mid = (a + b) / 2;

            for (int i = 0; i < maxLoop; i++)
            {
                if (f(a) * f(mid) < 0)
                {
                    b = mid;
                }
                else
                {
                    a = mid;
                }
                mid = (a + b) / 2;
                if (Math.Abs(b - a) < eps)
                {
                    break;
                }
            }
            return mid;
        }

    }

    #region ModInt

    ///
    /// コンパイル時に決定する mod を表します。
    ///
    /// <example>
    ///
    /// public readonly struct Mod1000000009 : IStaticMod
    /// {
    ///     public uint Mod => 1000000009;
    ///     public bool IsPrime => true;
    /// }
    ///
    /// </example>
    public interface IStaticMod
    {
        ///
        /// mod を取得します。
        ///
        uint Mod { get; }

        ///
        /// mod が素数であるか識別します。
        ///
        bool IsPrime { get; }
    }

    public readonly struct Mod1000000007 : IStaticMod
    {
        public uint Mod => 1000000007;
        public bool IsPrime => true;
    }

    public readonly struct Mod998244353 : IStaticMod
    {
        public uint Mod => 998244353;
        public bool IsPrime => true;
    }

    ///
    /// 実行時に決定する mod の ID を表します。
    ///
    /// <example>
    ///
    /// public readonly struct ModID123 : IDynamicModID { }
    ///
    /// </example>
    public interface IDynamicModID { }

    public readonly struct ModID0 : IDynamicModID { }
    public readonly struct ModID1 : IDynamicModID { }
    public readonly struct ModID2 : IDynamicModID { }

    ///
    /// 四則演算時に自動で mod を取る整数型。mod の値はコンパイル時に決定している必要があります。
    ///
    /// <typeparam name="T">定数 mod を表す構造体</typeparam>
    /// <example>
    ///
    /// using ModInt = AtCoder.StaticModInt<AtCoder.Mod1000000007>;
    ///
    /// void SomeMethod()
    /// {
    ///     var m = new ModInt(1);
    ///     m -= 2;
    ///     Console.WriteLine(m);   // 1000000006
    /// }
    ///
    /// </example>
    public readonly struct StaticModInt<T> : IEquatable<StaticModInt<T>> where T : struct, IStaticMod
    {
        private readonly uint _v;

        ///
        /// 格納されている値を返します。
        ///
        public int Value => (int)_v;

        ///
        /// mod を返します。
        ///
        public static int Mod => (int)default(T).Mod;

        public static StaticModInt<T> Zero => new StaticModInt<T>();
        public static StaticModInt<T> One => new StaticModInt<T>(1u);

        ///
        /// <paramref name="v"/> に対して mod を取らずに StaticModInt<<typeparamref name="T"/>> 型のインスタンスを生成します。
        ///
        /// <remarks>
        /// <para>定数倍高速化のための関数です。 <paramref name="v"/> に 0 未満または mod 以上の値を入れた場合の挙動は未定義です。</para>
        /// <para>制約: 0≤|<paramref name="v"/>|<mod</para>
        /// </remarks>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static StaticModInt<T> Raw(int v)
        {
            var u = unchecked((uint)v);
            Debug.Assert(u < Mod);
            return new StaticModInt<T>(u);
        }

        ///
        /// StaticModInt<<typeparamref name="T"/>> 型のインスタンスを生成します。
        ///
        /// <remarks>
        /// <paramref name="v"/>が 0 未満、もしくは mod 以上の場合、自動で mod を取ります。
        /// </remarks>
        public StaticModInt(long v) : this(Round(v)) { }

        private StaticModInt(uint v) => _v = v;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static uint Round(long v)
        {
            var x = v % default(T).Mod;
            if (x < 0)
            {
                x += default(T).Mod;
            }
            return (uint)x;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static StaticModInt<T> operator ++(StaticModInt<T> value)
        {
            var v = value._v + 1;
            if (v == default(T).Mod)
            {
                v = 0;
            }
            return new StaticModInt<T>(v);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static StaticModInt<T> operator --(StaticModInt<T> value)
        {
            var v = value._v;
            if (v == 0)
            {
                v = default(T).Mod;
            }
            return new StaticModInt<T>(v - 1);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static StaticModInt<T> operator +(StaticModInt<T> lhs, StaticModInt<T> rhs)
        {
            var v = lhs._v + rhs._v;
            if (v >= default(T).Mod)
            {
                v -= default(T).Mod;
            }
            return new StaticModInt<T>(v);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static StaticModInt<T> operator -(StaticModInt<T> lhs, StaticModInt<T> rhs)
        {
            unchecked
            {
                var v = lhs._v - rhs._v;
                if (v >= default(T).Mod)
                {
                    v += default(T).Mod;
                }
                return new StaticModInt<T>(v);
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static StaticModInt<T> operator *(StaticModInt<T> lhs, StaticModInt<T> rhs)
        {
            return new StaticModInt<T>((uint)((ulong)lhs._v * rhs._v % default(T).Mod));
        }

        ///
        /// 除算を行います。
        ///
        /// <remarks>
        /// <para>- 制約: <paramref name="rhs"/> に乗法の逆元が存在する。（gcd(<paramref name="rhs"/>, mod) = 1）</para>
        /// <para>- 計算量: O(log(mod))</para>
        /// </remarks>
        public static StaticModInt<T> operator /(StaticModInt<T> lhs, StaticModInt<T> rhs) => lhs * rhs.Inverse();

        public static StaticModInt<T> operator +(StaticModInt<T> value) => value;
        public static StaticModInt<T> operator -(StaticModInt<T> value) => new StaticModInt<T>() - value;
        public static bool operator ==(StaticModInt<T> lhs, StaticModInt<T> rhs) => lhs._v == rhs._v;
        public static bool operator !=(StaticModInt<T> lhs, StaticModInt<T> rhs) => lhs._v != rhs._v;
        public static implicit operator StaticModInt<T>(int value) => new StaticModInt<T>(value);
        public static implicit operator StaticModInt<T>(long value) => new StaticModInt<T>(value);

        ///
        /// 自身を x として、x^<paramref name="n"/> を返します。
        ///
        /// <remarks>
        /// <para>制約: 0≤|<paramref name="n"/>|</para>
        /// <para>計算量: O(log(<paramref name="n"/>))</para>
        /// </remarks>
        public StaticModInt<T> Pow(long n)
        {
            Debug.Assert(0 <= n);
            var x = this;
            var r = Raw(1);

            while (n > 0)
            {
                if ((n & 1) > 0)
                {
                    r *= x;
                }
                x *= x;
                n >>= 1;
            }

            return r;
        }

        ///
        /// 自身を x として、 xy≡1 なる y を返します。
        ///
        /// <remarks>
        /// <para>制約: gcd(x, mod) = 1</para>
        /// </remarks>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public StaticModInt<T> Inverse()
        {
            if (default(T).IsPrime)
            {
                Debug.Assert(_v > 0);
                return Pow(default(T).Mod - 2);
            }
            else
            {
                var (g, x) = InternalMath.InvGCD(_v, default(T).Mod);
                Debug.Assert(g == 1);
                return new StaticModInt<T>(x);
            }
        }

        public override string ToString() => _v.ToString();
        public override bool Equals(object obj) => obj is StaticModInt<T> && Equals((StaticModInt<T>)obj);
        public bool Equals(StaticModInt<T> other) => Value == other.Value;
        public override int GetHashCode() => _v.GetHashCode();
    }

    ///
    /// 四則演算時に自動で mod を取る整数型。実行時に mod が決まる場合でも使用可能です。
    ///
    /// <remarks>
    /// 使用前に DynamicModInt<<typeparamref name="T"/>>.Mod に mod の値を設定する必要があります。
    /// </remarks>
    /// <typeparam name="T">mod の ID を表す構造体</typeparam>
    /// <example>
    ///
    /// using AtCoder.ModInt = AtCoder.DynamicModInt<AtCoder.ModID0>;
    ///
    /// void SomeMethod()
    /// {
    ///     ModInt.Mod = 1000000009;
    ///     var m = new ModInt(1);
    ///     m -= 2;
    ///     Console.WriteLine(m);   // 1000000008
    /// }
    ///
    /// </example>
    public readonly struct DynamicModInt<T> : IEquatable<DynamicModInt<T>> where T : struct, IDynamicModID
    {
        private readonly uint _v;
        private static Barrett bt;

        ///
        /// 格納されている値を返します。
        ///
        public int Value => (int)_v;

        ///
        /// mod を返します。
        ///
        public static int Mod
        {
            get => (int)bt.Mod;
            set
            {
                Debug.Assert(1 <= value);
                bt = new Barrett((uint)value);
            }
        }

        ///
        /// <paramref name="v"/> に対して mod を取らずに DynamicModInt<<typeparamref name="T"/>> 型のインスタンスを生成します。
        ///
        /// <remarks>
        /// <para>定数倍高速化のための関数です。 <paramref name="v"/> に 0 未満または mod 以上の値を入れた場合の挙動は未定義です。</para>
        /// <para>制約: 0≤|<paramref name="v"/>|<mod</para>
        /// </remarks>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static DynamicModInt<T> Raw(int v)
        {
            var u = unchecked((uint)v);
            Debug.Assert(bt != null, $"使用前に {nameof(DynamicModInt<T>)}<{nameof(T)}>.{nameof(Mod)} プロパティに mod の値を設定してください。");
            Debug.Assert(u < Mod);
            return new DynamicModInt<T>(u);
        }

        ///
        /// DynamicModInt<<typeparamref name="T"/>> 型のインスタンスを生成します。
        ///
        /// <remarks>
        /// <para>- 使用前に DynamicModInt<<typeparamref name="T"/>>.Mod に mod の値を設定する必要があります。</para>
        /// <para>- <paramref name="v"/> が 0 未満、もしくは mod 以上の場合、自動で mod を取ります。</para>
        /// </remarks>
        public DynamicModInt(long v) : this(Round(v)) { }

        private DynamicModInt(uint v) => _v = v;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static uint Round(long v)
        {
            Debug.Assert(bt != null, $"使用前に {nameof(DynamicModInt<T>)}<{nameof(T)}>.{nameof(Mod)} プロパティに mod の値を設定してください。");
            var x = v % bt.Mod;
            if (x < 0)
            {
                x += bt.Mod;
            }
            return (uint)x;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static DynamicModInt<T> operator ++(DynamicModInt<T> value)
        {
            var v = value._v + 1;
            if (v == bt.Mod)
            {
                v = 0;
            }
            return new DynamicModInt<T>(v);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static DynamicModInt<T> operator --(DynamicModInt<T> value)
        {
            var v = value._v;
            if (v == 0)
            {
                v = bt.Mod;
            }
            return new DynamicModInt<T>(v - 1);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static DynamicModInt<T> operator +(DynamicModInt<T> lhs, DynamicModInt<T> rhs)
        {
            var v = lhs._v + rhs._v;
            if (v >= bt.Mod)
            {
                v -= bt.Mod;
            }
            return new DynamicModInt<T>(v);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static DynamicModInt<T> operator -(DynamicModInt<T> lhs, DynamicModInt<T> rhs)
        {
            unchecked
            {
                var v = lhs._v - rhs._v;
                if (v >= bt.Mod)
                {
                    v += bt.Mod;
                }
                return new DynamicModInt<T>(v);
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static DynamicModInt<T> operator *(DynamicModInt<T> lhs, DynamicModInt<T> rhs)
        {
            uint z = bt.Mul(lhs._v, rhs._v);
            return new DynamicModInt<T>(z);
        }

        ///
        /// 除算を行います。
        ///
        /// <remarks>
        /// <para>- 制約: <paramref name="rhs"/> に乗法の逆元が存在する。（gcd(<paramref name="rhs"/>, mod) = 1）</para>
        /// <para>- 計算量: O(log(mod))</para>
        /// </remarks>
        public static DynamicModInt<T> operator /(DynamicModInt<T> lhs, DynamicModInt<T> rhs) => lhs * rhs.Inverse();

        public static DynamicModInt<T> operator +(DynamicModInt<T> value) => value;
        public static DynamicModInt<T> operator -(DynamicModInt<T> value) => new DynamicModInt<T>() - value;
        public static bool operator ==(DynamicModInt<T> lhs, DynamicModInt<T> rhs) => lhs._v == rhs._v;
        public static bool operator !=(DynamicModInt<T> lhs, DynamicModInt<T> rhs) => lhs._v != rhs._v;
        public static implicit operator DynamicModInt<T>(int value) => new DynamicModInt<T>(value);
        public static implicit operator DynamicModInt<T>(long value) => new DynamicModInt<T>(value);

        ///
        /// 自身を x として、x^<paramref name="n"/> を返します。
        ///
        /// <remarks>
        /// <para>制約: 0≤|<paramref name="n"/>|</para>
        /// <para>計算量: O(log(<paramref name="n"/>))</para>
        /// </remarks>
        public DynamicModInt<T> Pow(long n)
        {
            Debug.Assert(0 <= n);
            var x = this;
            var r = Raw(1);

            while (n > 0)
            {
                if ((n & 1) > 0)
                {
                    r *= x;
                }
                x *= x;
                n >>= 1;
            }

            return r;
        }

        ///
        /// 自身を x として、 xy≡1 なる y を返します。
        ///
        /// <remarks>
        /// <para>制約: gcd(x, mod) = 1</para>
        /// </remarks>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public DynamicModInt<T> Inverse()
        {
            var (g, x) = InternalMath.InvGCD(_v, bt.Mod);
            Debug.Assert(g == 1);
            return new DynamicModInt<T>(x);
        }

        public override string ToString() => _v.ToString();
        public override bool Equals(object obj) => obj is DynamicModInt<T> && Equals((DynamicModInt<T>)obj);
        public bool Equals(DynamicModInt<T> other) => Value == other.Value;
        public override int GetHashCode() => _v.GetHashCode();
    }

    ///
    /// Fast moduler by barrett reduction
    /// <seealso href="https://en.wikipedia.org/wiki/Barrett_reduction"/>
    ///
    public class Barrett
    {
        public uint Mod { get; private set; }
        private ulong IM;
        public Barrett(uint m)
        {
            Mod = m;
            IM = unchecked((ulong)-1) / m + 1;
        }

        ///
        /// <paramref name="a"/> * <paramref name="b"/> mod m
        ///
        public uint Mul(uint a, uint b)
        {
            ulong z = a;
            z *= b;
            if (!Bmi2.X64.IsSupported) return (uint)(z % Mod);
            var x = Bmi2.X64.MultiplyNoFlags(z, IM);
            var v = unchecked((uint)(z - x * Mod));
            if (Mod <= v) v += Mod;
            return v;
        }
    }

    public static class InternalMath
    {
        ///
        /// g=gcd(a,b),xa=g(mod b) となるような 0≤x<b/g の(g, x)
        ///
        /// <remarks>
        /// <para>制約: 1≤<paramref name="b"/></para>
        /// </remarks>
        public static (long, long) InvGCD(long a, long b)
        {
            a = SafeMod(a, b);
            if (a == 0) return (b, 0);

            long s = b, t = a;
            long m0 = 0, m1 = 1;

            long u;
            while (true)
            {
                if (t == 0)
                {
                    if (m0 < 0) m0 += b / s;
                    return (s, m0);
                }
                u = s / t;
                s -= t * u;
                m0 -= m1 * u;

                if (s == 0)
                {
                    if (m1 < 0) m1 += b / t;
                    return (t, m1);
                }
                u = t / s;
                t -= s * u;
                m1 -= m0 * u;
            }
        }

        public static long SafeMod(long x, long m)
        {
            x %= m;
            if (x < 0) x += m;
            return x;
        }
    }

    public class ModCombination<T> where T : struct, IStaticMod
    {
        readonly StaticModInt<T>[] _factorials;
        readonly StaticModInt<T>[] _invFactorials;

        public ModCombination(int max = 1000000)
        {
            if (max >= default(T).Mod)
            {
                ThrowArgumentOutOfRangeException();
            }

            _factorials = new StaticModInt<T>[max + 1];
            _invFactorials = new StaticModInt<T>[max + 1];

            _factorials[0] = _factorials[1] = StaticModInt<T>.Raw(1);
            _invFactorials[0] = _invFactorials[1] = StaticModInt<T>.Raw(1);

            for (int i = 2; i < _factorials.Length; i++)
            {
                _factorials[i] = _factorials[i - 1] * StaticModInt<T>.Raw(i);
            }

            _invFactorials[^1] = _factorials[^1].Inverse();

            for (int i = _invFactorials.Length - 2; i >= 0; i--)
            {
                _invFactorials[i] = _invFactorials[i + 1] * StaticModInt<T>.Raw(i + 1);
            }
        }

        public StaticModInt<T> Factorial(int n) => _factorials[n];

        public StaticModInt<T> Permutation(int n, int k) => _factorials[n] * _invFactorials[n - k];

        public StaticModInt<T> Combination(int n, int k) => _factorials[n] * _invFactorials[k] * _invFactorials[n - k];

        public StaticModInt<T> CombinationWithRepetition(int n, int k) => Combination(n + k - 1, k);

        public void ThrowArgumentOutOfRangeException() => throw new ArgumentOutOfRangeException();
    }

    #endregion
}

#endregion


using System;

namespace Codeforces
{
    internal class Program
    {
        private static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }

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

        private static int ReadNextInt(string input, int index)
        {
            var ints = input.Split(' ');
            return Int32.Parse(ints[index]);
        }

        private static void Main()
        {
            var input = Console.ReadLine();
            var t1 = ReadNextInt(input, 0);
            var t2 = ReadNextInt(input, 1);
            var x1 = ReadNextInt(input, 2);
            var x2 = ReadNextInt(input, 3);
            var t0 = ReadNextInt(input, 4);

            if(t1 == t2)
            {
                Console.WriteLine(x1 + " " + x2);
                return;
            }
            if(t1==t0)
            {
                Console.WriteLine(x1 + " " + 0);
                return;
            }
            if(t2 == t0)
            {
                Console.WriteLine(0 + " " + x2);
                return;
            }
            var T = (double)t2;
            var maxX = 0;
            var maxY = x2;
            for (int x= 1; x <= x1; x++)
            {
                var y = (int)(((double) (t0 - t1)*x)/(t2 - t0));
                if ((long)y * (t2 - t0) != (long)(t0 - t1) * x)
                    y++;

                if (y <= 0 || y > x2)
                    continue;

                var tempT = ((double)x * t1 + (double)y * t2) / (x + y);
                if(tempT < t0)
                    continue;

                if(T < t0 || T > tempT || (T==tempT && maxX + maxY < x+y))
                {
                    T = tempT;
                    maxX = x;
                    maxY = y;
                }
            }
            Console.WriteLine(maxX + " " + maxY);
        }
    }
}


using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;
using System.Numerics;

class Solution
{

    static BigInteger pow2(BigInteger p)
    {
        BigInteger res = 1;
        while (p > 0)
        {
            res *= 2;
            p--;
        }
        return res;
    }

    static BigInteger calc(BigInteger a, BigInteger r, int i)
    {
        if (i == 1) return a;
        if (i == 2) return a + r;
        return (a + r) * pow2(i - 1);

    }

    static int? log2(BigInteger a)
    {
        if (a == 1) return 0;
        if (a == 2) return 1;
        int res = 0;
        while (a > 1)
        {

            res += 1;
            a = a / 2;
        }
        return res;
    }

    static bool recurs(int cnt, BigInteger b, BigInteger m, List<BigInteger> res)
    {
        if (cnt == 1)
        {
            if (b <= m)
            {
                res.Add(b);
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            var i = cnt - 1;
            var tmpp = pow2(i - 1);
            var r = (b / tmpp) - 1;
            var l = (b % tmpp == 0 ? b / tmpp : 1 + b / tmpp) - m;

            if (l > m || r < 1)
                return false;
            r = r > m ? m : r;
            l = l < 1 ? 1 : l;
            var a = (l + r) / 2;
            res.Add(a);
            var newb = b - a * tmpp;
            return recurs(cnt - 1, newb, m, res);
        }
    }

    static void Main(string[] args)
    {
        var t = int.Parse(Console.ReadLine().Trim());
        for (int l = 0; l < t; l++)
        {
            var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), BigInteger.Parse);
            var a = nm[0];
            var b = nm[1];
            var m = nm[2];
            if (a == b)
            {
                Console.Write(1);
                Console.Write(' ');
                Console.WriteLine(a);
                continue;
            }
            if (b - a <= m)
            {

                Console.Write(2);
                Console.Write(' ');
                Console.Write(a);
                Console.Write(' ');
                Console.WriteLine(b);
                continue;
            }
            if (m == 1)
            {
                if (b % (a + 1) == 1)
                {
                    Console.WriteLine(-1);
                    continue;
                }
                var b2 = b / (a + 1);
                var res = 1 + log2(b2);
                if (res == null || pow2(res.Value - 1) * (a + 1) != b)
                {
                    Console.WriteLine(-1);
                    continue;
                }
                Console.Write(res.Value + 1);
                Console.Write(' ');

                Console.Write(a);
                Console.Write(' ');
                a += 1;
                for (int i = 0; i < res; i++)
                {
                    Console.Write(a);
                    Console.Write(' ');
                    a = 2 * a;
                }
                continue;
            }

            var li = log2(b / (a + 1)) + 1;
            if (li == null || li > 50)
            {
                Console.WriteLine(-1);
                continue;
            }
            var bsht = (a + m) * pow2(li.Value - 1);
            if (bsht < b)
            {
                Console.WriteLine(-1);
                continue;
            }

            List<BigInteger> rs = new List<BigInteger>();
            var newb = b - a * pow2(li.Value - 1);
            if (!recurs(li.Value, newb, m, rs))
            {
                Console.WriteLine(-1);
                continue;
            }
            Console.Write(rs.Count + 1);
            Console.Write(' ');

            Console.Write(a);
            Console.Write(' ');

            foreach (var el in rs)
            {
                if (el > m)
                {
                    break;
                }
                a += el;
                Console.Write(a);
                Console.Write(' ');
                a = 2 * (a - el) + el;
            }
            Console.WriteLine();

        }

    }
}


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

namespace GoToBed
{
    class Program
    {
        static void Main(string[] args)
        {
            var currTime = Console.ReadLine().Split(new char[] { ':' }).Select(x => int.Parse(x)).ToArray();
            var sleepDurration  = Console.ReadLine().Split(new char[] { ':' }).Select(x => int.Parse(x)).ToArray();

            int resMin;
            int resHour;

            var substraction = currTime[1] - sleepDurration[1];

            bool carry = false;

            if (substraction < 0)
            {
                substraction = 60 + currTime[1] - sleepDurration[1];
                carry = true;
            }

            resMin = substraction;

            if (carry)
            {
                currTime[0]--;

                // 01:11
                // 00:12
            }

            substraction = currTime[0] - sleepDurration[0];

            if (substraction < 0)
            {
                substraction = 24 + currTime[0] - sleepDurration[0];
            }

            resHour = substraction;

            Console.WriteLine("{0:00}:{1:00}", resHour, resMin);

        }
    }
}


using System;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args) {
            int length = 0;
            int max = 0;
            int min = 0;
            string code = string.Empty;

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

            code = Console.ReadLine();

            for (int i = 0; i < length; i++) {
                if (code[i] == 'L')
                    min--;
                else
                    max++;
            }
            Console.WriteLine((max-min+1));
            //Console.ReadKey();
        }

    }
}


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

public class Program
{
    private long N;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();

        /*
         * N個タイル
         *
         * タイル i,j
         * |j-i| がnの1より大きいなら同じ色
         */

        List<long> p = new List<long>();
        long tmp = N;
        for (long l = 2; l * l <= tmp; l++)
        {
            if (tmp % l == 0)
            {
                p.Add(l);
                while (tmp % l == 0)
                {
                    tmp /= l;
                }
            }
        }

        if (tmp != 1) p.Add(tmp);

        if (p.Count == 1)
        {
            Console.WriteLine(p[0]);
            return;
        }

        Console.WriteLine(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.Diagnostics;
using System.IO;
using System.Linq;

namespace Codeforces
{
	internal class Template
	{
		private void Solve()
		{
		    var n = cin.NextInt();
		    if (n%2 == 1 || n < 6)
		    {
		        Console.WriteLine(0);
		        return;
		    }
		    n /= 2;
		    n = (n- 1) / 2;
            Console.WriteLine(n);
		}

		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
#if DEBUG
			var inputText = File.ReadAllText(@"..\..\input.txt");
			var testCases = inputText.Split(new[] { "input" }, StringSplitOptions.RemoveEmptyEntries);
			var consoleOut = Console.Out;
			for (var i = 0; i < testCases.Length; i++)
			{
				var parts = testCases[i].Split(new[] { "output" }, StringSplitOptions.RemoveEmptyEntries);
				Console.SetIn(new StringReader(parts[0].Trim()));
				var stringWriter = new StringWriter();
				Console.SetOut(stringWriter);
				var sw = Stopwatch.StartNew();
				new Template().Solve();
				sw.Stop();
				var output = stringWriter.ToString();

				Console.SetOut(consoleOut);
				var color = ConsoleColor.Green;
				var status = "Passed";
				if (parts[1].Trim() != output.Trim())
				{
					color = ConsoleColor.Red;
					status = "Failed";
				}
				Console.ForegroundColor = color;
				Console.WriteLine("Test {0} {1} in {2}ms", i + 1, status, sw.ElapsedMilliseconds);
			}
			Console.ReadLine();
			Console.ReadKey();
#else
			new Template().Solve();
			Console.ReadLine();
#endif
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = { ' ' };

		public string NextString()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

		public double NextDouble()
		{
			return double.Parse(NextString());
		}

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

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


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public void Solve(Scanner sc)
    {
        int N, M;
        sc.Make(out N, out M);
        var A = sc.ArrInt;
        Array.Sort(A,(a,b)=>b-a);
        int l = 0, r = N+1;
        while (r - l > 1)
        {
            var m = (r + l) / 2;
            long res = 0;
            int ct = 0;
            for(int i = 0; i < N; i++)
            {
                var d = Max(0, A[i] - ct / m);
                if (d == 0) continue;
                res += d;ct++;
            }
            if (res >= M) r = m;
            else l = m;
        }
        if (r == N + 1) Fail(-1);
        WriteLine(r);
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve(new Scanner());
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


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

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

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

        struct Answer
        {
            public string Winner;
        }

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

        private static Answer Parse(TextReader tr)
        {
            var n = int.Parse(tr.ReadLine());
            var board = new string[n];
            for (var i = 0; i < n; ++i)
                board[i] = tr.ReadLine();
            return Calc(board);
        }

        private static Answer Calc(string[] board)
        {
            var answer = new Answer();
            var memo = new Dictionary<(int, int), int>();
            var r = Rec("" + board[0][0], 1, 0, board, memo);

            if (r > 0)
                answer.Winner = "FIRST";
            else if (r < 0)
                answer.Winner = "SECOND";
            else
                answer.Winner = "DRAW";

            return answer;
        }

        private static int Rec(string str, int mask, int currentC, string[] board, Dictionary<(int, int), int> memo)
        {
            var n = board.Length;
            var numStr = str.Length;

            var key = (numStr, mask);
            if (memo.ContainsKey(key))
                return memo[key];

            if (numStr == n * 2 - 1)
            {
                if (str.Last() == 'a')
                    return 1;
                else if (str.Last() == 'b')
                    return -1;
                return 0;
            }

            var res = numStr % 2 == 0 ? int.MinValue : int.MaxValue;

            for (var ch = 'a'; ch <= 'z'; ++ch)
            {
                var nm = 0;

                for (var y = 0; y < n; ++y)
                {
                    if ((mask & (1 << y)) == 0)
                        continue;
                    var x = numStr - y - 1;
                    if (x < 0 || x >= n)
                        continue;
                    if (x < n - 1 && board[y][x + 1] == ch)
                        nm |= 1 << y;
                    if (y < n - 1 && board[y + 1][x] == ch)
                        nm |= 1 << y + 1;
                }
                if (nm == 0)
                    continue;

                if (numStr % 2 == 0)
                    res = Math.Max(res, Rec(str + ch, nm, 0, board, memo));
                else
                    res = Math.Min(res, Rec(str + ch, nm, 0, board, memo));
            }

            if (str.Last() == 'a')
                res += 1;
            else if (str.Last() == 'b')
                res += -1;

            return memo[key] = res;
        }
    }
}