#define Online

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

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    public class Student
    {
        public int t;
        public int x;
        public int n;

        public Student(int t, int x, int n)
        {
            this.t = t;
            this.x = x;
            this.n = n;
        }
    }

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("triangles.in");
            StreamWriter sw = new StreamWriter("triangles.out");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            D();

#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static void A()
        {
            int n = ReadInt();
            string[] input = new string[n];
            for (int i = 0; i < n; i++)
                input[i] = ReadLine();

            int ans = 0;
            for (int i = 0; i < input[0].Length; i++)
            {
                char cur = input[0][i];
                for (int j = 0; j < n; j++)
                {
                    if (input[j][i] != cur)
                    {
                        Console.WriteLine(ans);
                        return;
                    }
                }
                ans++;
            }
            Console.WriteLine(ans);

        }

        static void B()
        {
            int a, b, m, r0;
            string[] input = ReadArray();
            a = int.Parse(input[0]);
            b = int.Parse(input[1]);
            m = int.Parse(input[2]);
            r0 = int.Parse(input[3]);
            int[] u = new int[m];
            for (int i = 0; i < m; i++)
                u[i] = -1;
            int cur = 0;
            int r;
            while (true)
            {
                r = (a * r0 + b) % m;
                if (u[r] >= 0)
                {
                    Console.WriteLine(cur - u[r]);
                    return;
                }
                r0 = r;
                u[r] = cur;
                cur++;
            }
        }

        static int CompareByTime(Student x, Student y)
        {
            if (x.t < y.t) return -1;
            if (x.t > y.t) return 1;
            return 0;
        }

        static int CompareByExit(Student x, Student y)
        {
            if (x.x < y.x) return -1;
            if (x.x > y.x) return 1;
            return 0;
        }

        static void C()
        {
            int n, m;
            string[] input = ReadArray();
            n = int.Parse(input[0]);
            m = int.Parse(input[1]);
            Student[] s = new Student[n];
            for (int i = 0; i < n; i++)
            {
                input = ReadArray();
                s[i] = new Student(int.Parse(input[0]), int.Parse(input[1]), i);
            }
            Student[] l = new Student[n];
            Student[] r = new Student[n];
            ArrayUtils.Merge_Sort(s, 0, n - 1, l, r, CompareByTime);
            int[] ans = new int[n];
            int t = 0;
            for (int i = 0; i < n; )
            {
                t += (t >= s[i + m <= n ? i + m - 1 : n - 1].t ? 0 : s[i + m <= n ? i + m - 1 : n - 1].t - t);
                ArrayUtils.Merge_Sort(s, i, (i + m <= n ? i + m - 1 : n - 1), l, r, CompareByExit);
                int last = 0;
                for (int j = 0; j < m && i + j < n; )
                {
                    int cur = s[i + j].x;
                    t += cur - last;
                    int cnt = 0;
                    while (j < m && i + j < n && cur == s[i + j].x)
                    {
                        cnt++;
                        ans[s[i + j].n] = t;
                        j++;
                    }
                    t += 1 + cnt / 2;
                    last = cur;
                }
                i = (i + m <= n ? i + m : n);
                t += s[i - 1].x;
            }
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < n; i++)
                sb.Append(ans[i] + " ");
            Console.WriteLine(sb);
        }

        static void D()
        {
            int a, n;
            string[] input = ReadArray();
            a = int.Parse(input[0]);
            n = int.Parse(input[1]);
            int sqrt = (int)Math.Sqrt(a + n - 1);
            int[] t = new int[a + n];
            for (int i = sqrt; i >= 1; i--)
            {
                int p = i * i;
                int m = (a + n - 1) / p;
                for (int j = 1; j <= m; j++)
                {
                    if (t[p * j] == 0)
                        t[p * j] = j;
                }
            }
            long ans = 0;
            for (int i = a; i < a + n; i++)
            {
                if (t[i] == 0)
                    ans += i;
                else
                    ans += t[i];
            }
            Console.WriteLine(ans);
        }

        static void E()
        {

        }

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

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

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

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }

    class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;

        public Graph(int n)
        {
            g = new List<int>[n + 1];
            for (int i = 0; i <= n; i++)
                g[i] = new List<int>();
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }
    }

    static class GraphUtils
    {
        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public static void BFS(int s, Graph g)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(s);
            while (q.Count != 0)
            {
                int u = q.Dequeue();
                for (int i = 0; i < g.g[u].Count; i++)
                {
                    int v = g.g[u][i];
                    if (g.color[v] == white)
                    {
                        g.color[v] = gray;
                        g.d[v] = g.d[u] + 1;
                        g.p[v] = u;
                        q.Enqueue(v);
                    }
                }
                g.color[u] = black;
            }
        }

        public static void DFS(int u, List<int> ans, ref int time, Graph g)
        {
            g.color[u] = gray;
            ans.Add(u);
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    DFS(v, ans, ref time, g);
                }
            }
            g.color[u] = black;
            g.c[u] = time;
            time++;
        }

        public static void FordBellman(int u, Graph g)
        {
            int n = g.g.Length;
            for (int i = 0; i <= n; i++)
            {
                g.d[i] = int.MaxValue;
                g.p[i] = 0;
            }

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }
    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (comp(L[i], R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R, comp);
            Merge_Sort(A, q + 1, r, L, R, comp);
            Merge(A, p, q, r, L, R, comp);
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}


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

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

        private static readonly StreamWriter writer =
            new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

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

            var nn = new List<long>();
            nn.Add(1);
            nn.Add(1);
            for (int i = 1;; i++)
            {
                long next = nn[i]*10 + 1;
                nn.Add(next);
                if (next > n)
                    break;
            }

            int min = int.MaxValue;

            find(n, nn.Count - 1, nn, 0, ref min);

            writer.WriteLine(min);
            writer.Flush();
        }

        private static void find(long n, int index, List<long> nn, int sum, ref int min)
        {
            if (n == 0)
            {
                if (min > sum)
                    min = sum;
            }
            if (index <= 0)
                return;

            for (int i = -10; i < 11; i++)
            {
                if (n == nn[index]*i)
                {
                    find(n - nn[index]*i, index - 1, nn, sum + index*Math.Abs(i), ref min);
                    break;
                }
            }

            for (int i = -10; i < 11; i++)
            {
                if (n < nn[index] * i)
                {
                    find(n - nn[index] * i, index - 1, nn, sum + index * Math.Abs(i), ref min);
                    break;
                }
            }

            for (int i = 10; i > -11; i--)
            {
                if (n > nn[index] * i)
                {
                    find(n - nn[index] * i, index - 1, nn, sum + index * Math.Abs(i), ref min);
                    break;
                }
            }
        }
    }
}


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

namespace bla2
{
    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int c = 0;
            while(n > 0)
            {
                n /= 2;
                c++;
            }
            Console.WriteLine(c);
        }
    }
}


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

namespace ConsoleApp1
{

    class Program
    {
        struct Point
        {
            public int l;
            public int r;
            public Point(int l, int r)
            {
                this.l = l;
                this.r = r;
            }
        }
        static void Main(string[] args)
        {
            long[] n = ((Console.ReadLine().Split(' ')).Select(long.Parse)).ToArray();
            int s = 1;
            int i = 1;
            while (s <= n[0])
            {
                s += i;
                i++;
              }
            Console.Write(i-1);
            Console.ReadLine();
        }
        static string FindSecondMax(List<Point> list)
        {
            Point point = new Point(int.MaxValue, int.MaxValue);
            Point maxpoint = new Point(int.MaxValue, int.MaxValue);
            foreach (Point p in list)
            {
                if (Rast(p) >= Rast(point))
                {
                    maxpoint = point;
                    point = p;
                }
                else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }
            }
            return $"{maxpoint.l} {maxpoint.r}";
        }

        private static int Rast(Point point)
        {
            return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));
        }

        private static long S(long v)
        {
            long sum = 0;
            while (v != 0)
            {
                sum += v % 10;
                v /= 10;
            }
            return sum;
        }
    }
}


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

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private long N, K;

    private void Scan()
    {
        var line = Console.ReadLine().Split(' ');
        N = long.Parse(line[0]);
        K = long.Parse(line[1]);
    }

    public void Solve()
    {
        Scan();
        long a = N / 2;
        long b = a / (K + 1);
        long c = b * K;
        long d = N - b - c;
        Console.WriteLine("{0} {1} {2}", b, c, d);
    }
}


using System;
namespace _818A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long n = long.Parse(input[0]), k = long.Parse(input[1]);
            long x = (n / 2) / (k + 1), y = k * x, z = n - x - y;
            Console.WriteLine(x + " " + y + " " + z);
        }
    }
}


using System;

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

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

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


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

namespace FakeNP
{
    class Program
    {
        static void Main(string[] args)
        {
            Int64[] fir = Console.ReadLine().Split().Select(Int64.Parse).ToArray();
            Int64 win = fir[0] / 2;
            Int64 d = win / (fir[1] + 1);
            Int64 c = fir[1] * d;
                           Console.WriteLine(d+" "+c+" "+(fir[0]-c-d));

        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text;

namespace CodeForces
{
    class Program
    {

        public static void Main(string[] args) {
            long n, k;
            GetTwoInts(out n, out k);

            long d, g, o;
            d = n/2/(k + 1);
            g = d*k;
            o = n - d - g;

            Console.WriteLine("{0} {1} {2}", d, g, o);
        }

        public static string Rw() { return Console.ReadLine(); }

        public static long GetInt() { return Int64.Parse(Rw()); }
        public static long[] GetIntArr() { return Array.ConvertAll(Rw().Split(' '), Int64.Parse); }

        public static double GetDouble() { return Double.Parse(Rw()); }
        public static double[] GetDoubleArr() { return Array.ConvertAll(Rw().Split(' '), DoubleParse); }
        public static double DoubleParse(string s) { return Double.Parse(s, NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo("en-US")); }

        public static void GetTwoInts(out long n, out long m)
        {
            long[] input = GetIntArr();
            n = input[0];
            m = input[1];
        }

        public const long Module = 1000000000 + 7;
        public const long Max = (long)1.0e18;

    }
}


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

namespace Codeforce
{

    class Program
    {
        static long[] parseInt(string s)
        {
            string[] temp = s.Split(' ');
            long[] res = new long[temp.Length];
            for (int i = 0; i < temp.Length; i++)
            {
                res[i] = Convert.ToInt64(temp[i]);
            }
            return res;
        }

        static void Main(string[] args)
        {
            var data = parseInt(Console.ReadLine());

            long[] f = new long[65];
            long[] s = new long[65];

            int p = -1;
            for (int i = 0; i < 65; i++)
            {
                f[i] = (data[0] & (1L << (i))) > 0 ? 1 : 0;
                s[i] = (data[1] & (1L << (i))) > 0 ? 1 : 0;
                if ((1L << (i)) > data[1])
                {
                    p = i;
                    break;
                }
            }

            bool tf = false;
            long[] ress = new long[65];
            for (int i = p - 1; i >= 0; i--)
            {
                if (!tf && s[i] > f[i])
                {
                    tf = true;
                    ress[i] = 1;
                    continue;
                }
                if (f[i] == s[i])
                {
                    if (tf)
                        ress[i] = 1;
                    else
                        ress[i] = 0;
                }
                else
                    ress[i] = 1;

            }

            long resss = 0;
            for (int i = 0; i < p; i++)
            {
                resss += ress[i] * (1L << i);
            }

            Console.WriteLine(resss);
        }
    }
}
/*
3 10
15 25 30
 */


using System;
using System.Linq;

namespace D {
    internal class Program {
        private static void Main() {
            var line = Console.ReadLine().Split(' ');
            ulong a = Convert.ToUInt64(line[0]);
            ulong b = Convert.ToUInt64(line[1]);

            var ab = new int[64];
            var bb = new int[64];

            for (int i = 0; i < 64; i++) {
                ulong ex = (ulong) 1 << i;
                if ((a & ex) == ex) {
                    ab[i] = 1;
                }
                if ((b & ex) == ex) {
                    bb[i] = 1;
                }
            }

            ab = ab.Reverse().ToArray();
            bb = bb.Reverse().ToArray();
            bool bot = false;

            for (int i = 0; i < 64; i++) {
                if (ab[i] == 0 && bb[i] == 1) {
                    if (bot == false) {
                        bot = true;
                        continue;
                    }
                }

                if (bot) {
                    if (ab[i] == 0 && bb[i] == 0) {
                        ab[i] = 1;
                        continue;
                    }
                    if (ab[i] == 1 && bb[i] == 1) {
                        bb[i] = 0;
                        continue;
                    }
                }
            }

            ulong ares = 0;
            ulong bres = 0;
            for (int i = 63; i >= 0; i--) {
                ulong ex = (ulong)1 << i;
                if (ab[63-i] == 1) {
                    ares += ex;
                }
                if (bb[63-i] == 1) {
                    bres += ex;
                }
            }

            Console.WriteLine(ares ^ bres);
        }
    }
}


using System;
using System.Linq;

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

            long l = long.Parse(tokens[0]);
            long r = long.Parse(tokens[1]);

            var lBinary = Convert.ToString(l, 2).PadLeft(60, '0');
            var rBinary = Convert.ToString(r, 2).PadLeft(60, '0');

            Console.WriteLine(Enumerable.Range(0, 60).Reverse().Select(i => 1L << i).SkipWhile(x => (l & x) == (r & x)).Sum());
        }
    }
}


using System;

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


using System;

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


using System;

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


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

namespace codeforces
{
    public class Program
    {
        private const int MOD = 998244353;

        private static int Mult(int a, int b)
        {
            return (int)(1L * a * b % MOD);
        }

        private static int BinPow(int a, int n)
        {
            int result = 1;
            while (n > 0)
            {
                if (n % 2 == 1)
                {
                    result = Mult(result, a);
                }
                a = Mult(a, a);
                n /= 2;
            }
            return result;
        }

        private static void Main(string[] args)
        {
            var values = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(values[0]);
            int m = Convert.ToInt32(values[1]);

            var f = new int[m + 1];
            f[0] = 1;
            for (int i = 1; i <= m; ++i)
            {
                f[i] = Mult(f[i - 1], i);
            }

            int result = BinPow(2, n - 3);
            result = Mult(result, n - 2);
            result = Mult(result, f[m]);
            result = Mult(result, BinPow(Mult(f[n - 1], f[m - n + 1]), MOD - 2));
            Console.WriteLine(result);
        }
    }
}


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Trace;
using SB = System.Text.StringBuilder;
using static System.Math;
using static System.Numerics.BigInteger;
using static Program.IO.Scanner;

using Number = System.Int64;
#region IO
namespace Program.IO {
	using System.IO;
	using System.Text;
	using System.Globalization;

	public class Printer : StreamWriter {
		public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
		public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
	}
	static public class Scanner {
		public static StreamScanner sc = new StreamScanner(Console.OpenStandardInput());
		public static int ri => sc.Integer();
		public static long rl => sc.Long();
		public static string rs => sc.Scan();
		public static double rd => sc.Double();
	}
	public class StreamScanner {
		public StreamScanner(Stream stream) { str = stream; }

		public readonly Stream str;
		private readonly byte[] buf = new byte[1024];
		private int len, ptr;
		public bool isEof = false;
		public bool IsEndOfStream { get { return isEof; } }

		private byte read() {
			if (isEof) return 0;
			if (ptr >= len) {
				ptr = 0;
				if ((len = str.Read(buf, 0, 1024)) <= 0) {
					isEof = true;
					return 0;
				}
			}
			return buf[ptr++];
		}

		public char Char() {
			byte b = 0;
			do b = read(); while ((b < 33 || 126 < b) && !isEof);
			return (char)b;
		}
		public string Scan() {
			var sb = new StringBuilder();
			for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);
			return sb.ToString();
		}
		public string ScanLine() {
			var sb = new StringBuilder();
			for (var b = Char(); b != '\n' && b != 0; b = (char)read()) if (b != '\r') sb.Append(b);
			return sb.ToString();
		}
		public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
		public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
		public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
	}

}

#endregion

#region main
static class Ex {
	static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
	static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
		return string.Join(st, ie);
	}

	static public void Main() {
		Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });
		var solver = new Program.Solver();
		var t = new System.Threading.Thread(solver.Solve, 100000000);
		t.Start();
		t.Join();
		//*/
		//solver.Solve();
		Console.Out.Flush();
	}
}
#endregion

namespace Program {
	public class Solver {
		Random rnd = new Random(0);
		public void Solve() {
			var n = ri;
			var m = ri;
			var binom = new BinomialCoefficient(m + 50);
			if (n == 2) {
				Console.WriteLine(0);
				return;
			}
			ModInt ans = binom[m, n - 1];
			ans *= ModInt.Pow(2, n - 3);
			ans *= n - 2;
			Console.WriteLine(ans);
		}
		const long INF = 1L << 60;
		static int[] dx = { -1, 0, 1, 0 };
		static int[] dy = { 0, 1, 0, -1 };
		static T[] Enumerate<T>(int n, Func<int, T> f) {
			var a = new T[n]; for (int i = 0; i < a.Length; ++i) a[i] = f(i); return a;
		}
		static T[][] Enumerate<T>(int n, int m, Func<int, int, T> f) {
			return Enumerate(n, x => Enumerate(m, y => f(x, y)));
		}
		static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
	}
}
#region ModInt
/// <summary>
/// [0,<see cref="Mod"/>) までの値を取るような数
/// </summary>
public struct ModInt {
	public const long Mod = 998244353 ;
	public long num;
	public ModInt(long n) { num = n; }
	public override string ToString() { return num.ToString(); }
	public static ModInt operator +(ModInt l, ModInt r) { return new ModInt(l.num + r.num < Mod ? l.num + r.num : l.num + r.num - Mod); }
	public static ModInt operator -(ModInt l, ModInt r) { return new ModInt(l.num + Mod - r.num < Mod ? l.num + Mod - r.num : l.num - r.num); }
	public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
	public static ModInt operator /(ModInt l, ModInt r) { return l * Inverse(r); }
	public static implicit operator ModInt(long n) { return new ModInt(n); }
	public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }
	public static ModInt Pow(long v, long k) {
		long ret = 1;
		for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
			if ((k & 1) == 1) ret = ret * v % Mod;
		return new ModInt(ret);
	}
	public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
	public static ModInt Modulo(long v) { return new ModInt(((v % Mod) + Mod) % Mod); }
}
#endregion

#region Binomial Coefficient
public class BinomialCoefficient {
	public ModInt[] fact, ifact;
	public BinomialCoefficient(int n) {
		fact = new ModInt[n + 1];
		ifact = new ModInt[n + 1];
		fact[0] = 1;
		for (int i = 1; i <= n; i++)
			fact[i] = fact[i - 1] * i;
		ifact[n] = ModInt.Inverse(fact[n]);
		for (int i = n - 1; i >= 0; i--)
			ifact[i] = ifact[i + 1] * (i + 1);
		ifact[0] = ifact[1];
	}
	public ModInt this[int n, int r] {
		get {
			if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;
			return fact[n] * ifact[n - r] * ifact[r];
		}
	}
	public ModInt RepeatedCombination(int n, int k) {
		if (k == 0) return 1;
		return this[n + k - 1, k];
	}
}
#endregion


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.IO;
using System.Linq;
class Program
{
    class Point
    {
        public double x, y;
        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
    }
    class Line
    {
        public double a, b, c;
        public Line(Point p1, Point p2)
        {
            a = p2.y - p1.y;
            b = p1.x - p2.x;
            c = a * p1.x + b * p1.y;
        }
        public  Line()
        {

        }

        public Line prep( Point p)
        {
            Line res=new Line();
            res.a = -b;
            res.b = a;
            res.c = res.a * p.x + res.b * p.y;
            return res;

        }
        public Point Intersect(Line l)
        {
            Point res = new Point(0,0);
            double d = a * l.b - b * l.a;
            res.x = (l.b * c - b * l.c) / d;
            res.y = (a * l.c - l.a * c) / d;
            return res;
        }

    }
    double eps = 1e-9;
    void solve()
    {
        int[] ar = new int[3];
        int[] b = new int[3];

        Point p = new Point(nextInt(), nextInt());
        Point v=new Point(nextInt(),nextInt());
        Point[]w=new Point[2];

        for (int i = 0; i < 2; i++)
            w[i] = new Point(nextInt(), nextInt());
        Point[] mir = new Point[2];
        for (int i = 0; i < 2; i++)
            mir[i] = new Point(nextInt(), nextInt());

        bool ok = false;
        if (good(p, v, w[0], w[1]))
            ok = true;
        else if (sign(cross(p, mir[0], mir[1])) * sign(cross(v, mir[0], mir[1])) ==1)
        {
            Line lm = new Line(mir[0], mir[1]);
            Line pr = lm.prep(p);
            Point inter = lm.Intersect(pr);
            Point other = new Point(inter.x + (inter.x - p.x), inter.y + (inter.y - p.y));
            {
                Line l = new Line(other, v);
                Point x = l.Intersect(lm);
                if (good(x, p, w[0], w[1]) && good(x, v, w[0], w[1]) && on(mir[0],mir[1],x))
                    ok = true;
            }

        }
        if (ok)
            println("Yes");
        else
            println("NO");

    }

    private bool good(Point p1, Point p2, Point p3, Point p4)
    {
        double d1 = cross(p1, p2, p3);
        double d2 = cross(p1, p2, p4);
        double d3 = cross(p3, p4,p1);
        double d4 = cross(p3, p4, p2);
        int x1 = sign(d1);
        int x2 = sign(d2);
        int x3 = sign(d3);
        int x4 = sign(d4);
        if (x1 * x2 < 0 && x3 * x4 < 0)
            return false;
        if (x1 == 0)
        {
            if (on(p1, p2, p3))
                return false;
        }
        if (x2 == 0)
        {
            if (on(p1, p2, p4))
                return false;
        }
        if (x3 == 0)
        {
            if (on(p3, p4, p1))
                return false;
        }
        if (x4 == 0)
        {
            if (on(p3, p4, p2))
                return false;
        }

        return true;

    }

    private bool on(Point p1, Point p2, Point p3)
    {
        return on(p1.x, p2.x, p3.x) && on(p1.y, p2.y, p3.y);
    }

    private bool on(double x, double y, double z)
    {
        return z >= Math.Min(x, y) - eps && z <= Math.Max(x, y) + eps;
    }

    private int sign(double d1)
    {
        return Math.Abs(d1) < eps ? 0 : Math.Sign(d1);
    }

    private double cross(Point p1, Point p2, Point p3)
    {
        return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);
    }

    ////////////
    private void println(int[] ar)
    {
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i]);
            else
                print(ar[i] + " ");
        }
    }
    private void println(int[] ar, bool add)
    {
        int A = 0;
        if (add)
            A++;
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i] + A);
            else
                print((ar[i] + A) + " ");
        }
    }

    private void println(string Stringst)
    {
        Console.WriteLine(Stringst);
    }
    private void println(char charnum)
    {
        Console.WriteLine(charnum);
    }
    private void println(int Intnum)
    {
        Console.WriteLine(Intnum);
    }
    private void println(long Longnum)
    {
        Console.WriteLine(Longnum);
    }
    private void println(double Doublenum)
    {
        string s = Doublenum.ToString(CultureInfo.InvariantCulture);
        Console.WriteLine(s);
    }

    private void print(string Stringst)
    {
        Console.Write(Stringst);
    }
    private void print(int Intnum)
    {
        Console.Write(Intnum);
    }
    private void print(char charnum)
    {
        Console.Write(charnum);
    }
    private void print(long Longnum)
    {
        Console.Write(Longnum);
    }
    private void print(double Doublenum)
    {
        Console.Write(Doublenum);
    }

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (inputLine.Length == 0)
            readInput();

    }
    int nextInt()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return int.Parse(inputLine[inputInd++]);
    }
    long nextLong()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return long.Parse(inputLine[inputInd++]);
    }
    double nextDouble()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return double.Parse(inputLine[inputInd++]);
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        new Program().solve();
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.IO;
using System.Linq;
class Program
{
    class Point
    {
        public double x, y;
        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
    }
    class Line
    {
        public double a, b, c;
        public Line(Point p1, Point p2)
        {
            a = p2.y - p1.y;
            b = p1.x - p2.x;
            c = a * p1.x + b * p1.y;
        }
        public  Line()
        {

        }

        public Line prep( Point p)
        {
            Line res=new Line();
            res.a = -b;
            res.b = a;
            res.c = res.a * p.x + res.b * p.y;
            return res;

        }
        public Point Intersect(Line l)
        {
            Point res = new Point(0,0);
            double d = a * l.b - b * l.a;
            res.x = (l.b * c - b * l.c) / d;
            res.y = (a * l.c - l.a * c) / d;
            return res;
        }

    }
    double eps = 1e-9;
    void solve()
    {
        int[] ar = new int[3];
        int[] b = new int[3];

        Point p = new Point(nextInt(), nextInt());
        Point v=new Point(nextInt(),nextInt());
        Point[]w=new Point[2];

        for (int i = 0; i < 2; i++)
            w[i] = new Point(nextInt(), nextInt());
        Point[] mir = new Point[2];
        for (int i = 0; i < 2; i++)
            mir[i] = new Point(nextInt(), nextInt());

        bool ok = false;
        if (good(p, v, w[0], w[1]))
            ok = true;
        else if (sign(cross(mir[0], mir[1],p)) * sign(cross(mir[0], mir[1],p)) ==1)
        {
            Line lm = new Line(mir[0], mir[1]);
            Line pr = lm.prep(p);
            Point inter = lm.Intersect(pr);
            Point other = new Point(inter.x + (inter.x - p.x), inter.y + (inter.y - p.y));
            {
                Line l = new Line(other, v);
                Point x = l.Intersect(lm);
                if (good(x, p, w[0], w[1]) && good(x, v, w[0], w[1]) && on(mir[0],mir[1],x))
                    ok = true;
            }

        }
        if (ok)
            println("Yes");
        else
            println("NO");

    }

    private bool good(Point p1, Point p2, Point p3, Point p4)
    {
        double d1 = cross(p1, p2, p3);
        double d2 = cross(p1, p2, p4);
        double d3 = cross(p3, p4,p1);
        double d4 = cross(p3, p4, p2);
        int x1 = sign(d1);
        int x2 = sign(d2);
        int x3 = sign(d3);
        int x4 = sign(d4);
        if (x1 * x2 < 0 && x3 * x4 < 0)
            return false;
        if (x1 == 0)
        {
            if (on(p1, p2, p3))
                return false;
        }
        if (x2 == 0)
        {
            if (on(p1, p2, p4))
                return false;
        }
        if (x3 == 0)
        {
            if (on(p3, p4, p1))
                return false;
        }
        if (x4 == 0)
        {
            if (on(p3, p4, p2))
                return false;
        }

        return true;

    }

    private bool on(Point p1, Point p2, Point p3)
    {
        return on(p1.x, p2.x, p3.x) && on(p1.y, p2.y, p3.y);
    }

    private bool on(double x, double y, double z)
    {
        return z >= Math.Min(x, y) - eps && z <= Math.Max(x, y) + eps;
    }

    private int sign(double d1)
    {
        return Math.Abs(d1) < eps ? 0 : Math.Sign(d1);
    }

    private double cross(Point p1, Point p2, Point p3)
    {
        return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);
    }

    ////////////
    private void println(int[] ar)
    {
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i]);
            else
                print(ar[i] + " ");
        }
    }
    private void println(int[] ar, bool add)
    {
        int A = 0;
        if (add)
            A++;
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i] + A);
            else
                print((ar[i] + A) + " ");
        }
    }

    private void println(string Stringst)
    {
        Console.WriteLine(Stringst);
    }
    private void println(char charnum)
    {
        Console.WriteLine(charnum);
    }
    private void println(int Intnum)
    {
        Console.WriteLine(Intnum);
    }
    private void println(long Longnum)
    {
        Console.WriteLine(Longnum);
    }
    private void println(double Doublenum)
    {
        string s = Doublenum.ToString(CultureInfo.InvariantCulture);
        Console.WriteLine(s);
    }

    private void print(string Stringst)
    {
        Console.Write(Stringst);
    }
    private void print(int Intnum)
    {
        Console.Write(Intnum);
    }
    private void print(char charnum)
    {
        Console.Write(charnum);
    }
    private void print(long Longnum)
    {
        Console.Write(Longnum);
    }
    private void print(double Doublenum)
    {
        Console.Write(Doublenum);
    }

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (inputLine.Length == 0)
            readInput();

    }
    int nextInt()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return int.Parse(inputLine[inputInd++]);
    }
    long nextLong()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return long.Parse(inputLine[inputInd++]);
    }
    double nextDouble()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return double.Parse(inputLine[inputInd++]);
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        new Program().solve();
    }
}


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

namespace Snail
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] x = new int[n];
            for (int i = 0; i < n; i++)
                x[i] = int.Parse(Console.ReadLine());
            for(int i = 0; i < (1<<n); i++)
            {
                int cs = 0;
                for (int j = 0; j < n; j++)
                    if ((i & (1 << j)) > 0)
                        cs += x[j];
                    else cs -= x[j];
                if (cs % 360 == 0)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }
    }
}


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

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

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

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

            reader = iReader;
            writer = oWriter;

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

        string[] curLine;
        int curTokenIdx;

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

        public string ReadNextToken()
        {
            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;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

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

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

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString("F8");
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

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

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

    class Program
    {
        protected IOHelper ioHelper;

        int n;

        List<int> rotations = new List<int>();
        bool[,] bPossib;

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            bPossib = new bool[370,2];

            int JJ=0;
            bPossib[0, JJ] = true;
            int i;
            for(i=0;i<n;i++)
            {
                int rot = ioHelper.ReadNextInt();
                int grade;
                for(grade = 0; grade < 360; grade++)
                    if(bPossib[grade,JJ])
                    {
                        int newCh = grade + rot;
                        newCh %= 360;
                        bPossib[newCh, 1 - JJ] = true;
                        newCh = grade - rot;
                        if (newCh < 0)
                            newCh += 360;
                        bPossib[newCh, 1 - JJ] = true;

                        bPossib[grade, JJ] = false;
                    }
                JJ = 1 - JJ;
            }

            if (bPossib[0, JJ])
                ioHelper.WriteLine("YES");
            else
                ioHelper.WriteLine("NO");

            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

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


#region Usings
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

using static System.Math;
#endregion

// https://codeforces.com/problemset/problem/1097/B
public class B___Petr_and_a_Combination_Lock
{
    private static void Solve()
    {
        int n = ReadInt();
        int[] A = new int[n];

        for (int i = 0; i < n; i++)
        {
            A[i] = ReadInt();
        }

        if (Dfs(0, A, 0))
            Write("YES");
        else
            Write("NO");
    }

    static bool Dfs(int idx, int[] A, int sum)
    {
        if (idx == A.Length && (sum % 360 == 0 || sum == 0))
            return true;

        for (int i = idx; i < A.Length; i++)
        {
            return Dfs(i + 1, A, sum + A[i]) || Dfs(idx + 1, A, sum - A[i]);
        }

        return false;
    }

    #region Main

    private static TextReader reader;
    private static TextWriter writer;

    public static void Main()
    {
#if DEBUG

        //reader = new StreamReader("C:\\Users\\Axel\\Desktop\\input.txt");
        reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;

        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());

        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            Solve();

            //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion Main

    #region Read / Write

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

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

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

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

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

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

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

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

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

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

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }

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

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

    public static void Write(params object[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array) writer.WriteLine(a);
    }

    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }

    private static T[] Init<T>(int size) where T : new()
    {
        var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;
    }

    #endregion Read / Write
}


using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var numbers = new int[n];
            for(var i = 0; i < n; i++) {
                numbers[i] = int.Parse(Console.ReadLine());
            }
            Console.WriteLine(Summable(numbers, 0, 0, n) ? "YES" : "NO");
        }
        static bool Summable(int[] arr, int i, int sum, int n) {
            sum%=360;
            if(i >= n - 1)
                return (sum+arr[i])%360 == 0 || (sum-arr[i])%360 == 0;
            return Summable(arr, i+1, sum+arr[i], n) || Summable(arr, i+1, sum-arr[i], n);
        }
    }
}


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

using System.Collections;

namespace Кратные
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] a = new int[n];
       //     int[] sgn = new int[n];
            string sgn;
            bool yes = false;

            for (int i=0; i<n; i++)
                a[i] = Convert.ToInt32(Console.ReadLine());

            long nn = (long)Math.Pow(2, 4);

     //       BitArray sgn = new BitArray(n);
            for (long i = 0; i < nn; i++)
            {
                sgn=Convert.ToString(i, 2);
                sgn += "00000000000000000";
                long summ = 0;
                for (int j = 0; j < n; j++)
                {
                    if (sgn[j] == '1') summ += a[j];
                    else summ -= a[j];
                }
                if (summ % 360 == 0) yes = true;
            }

            if (yes) Console.WriteLine("YES");
                   else Console.WriteLine("NO");

         //           Console.ReadKey();

        }
    }
}


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

internal class Program
{
    private static List<int> _list { get; set; }

    public static bool recursiveSolve(int x, int y)
    {
        if (y < 0)
            return false;
        if (x % 360 == 0 && y < 0)
            return true;
        return recursiveSolve(x - _list[y], y - 1) || recursiveSolve(x + _list[y], y - 1);
    }

    public static void Main(string[] args)
    {
        _list = new List<int>();
        var n = Convert.ToInt32(Console.ReadLine());
        for (int i = 0; i < n; i++)
        {
            _list.Add(Convert.ToInt32(Console.ReadLine()));
        }

        Console.WriteLine(recursiveSolve(0, n-1) ? "NO" : "YES");

    }
}


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

namespace ConsoleApp
{
    public class Program
    {
        public static void Main()
        {
            //int n = Convert.ToInt32(Console.ReadLine());
            //int[] array = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            //StringBuilder stringBuilder = new StringBuilder();
            int n = Convert.ToInt32(Console.ReadLine());
            int degree = Convert.ToInt32(Console.ReadLine());
            BitArray bitArray = new BitArray(360);
            bitArray[degree] = true;
            bitArray[360 - degree] = true;
            BitArray left = (BitArray)bitArray.Clone();
            BitArray right = (BitArray)bitArray.Clone();
            BitArray temp1;
            BitArray temp2;
            for (; n > 1; n--)
            {
                degree = Convert.ToInt32(Console.ReadLine());
                temp1 = (BitArray)left.Clone();
                temp2 = (BitArray)left.Clone();
                left = (BitArray)(temp1.LeftShift(degree).Or(temp2.LeftShift(360 - degree))).Clone();
                temp1 = (BitArray)right.Clone();
                temp2 = (BitArray)right.Clone();
                right = (BitArray)(temp1.RightShift(degree).Or(temp2.RightShift(360 - degree))).Clone();

                bitArray = (BitArray)left.Or(right).Clone();
            }

            if (bitArray[0])
            {
                Console.Write("YES");
            }
            else
            {
                Console.Write("NO");
            }
        }
    }
}


using System;

class Program
{

    static void Main()
    {
        int n = Convert.ToInt32(Console.ReadLine());
        int[] a = new int[n];
        int[] f = new int[n];
        int fcnt = 0;

        string str = Console.ReadLine();
        string[] words = str.Split(' ');

        for (int i = 0; i < n; i++)
            a[i] = Convert.ToInt32(words[i]);

        for(int i = 0, now = n-1; i < n; i++)
        {
            now += 7;
            now %= n;
            f[now] = i;
            if (now == n-1)
                break;
            fcnt++;
        }

        {
            Int64 l = 0;
            Int64 r = Convert.ToInt64(5e4 * 10e9);
            while(l+1 != r)
            {
                Int64 mid = (l + r) / 2;
                bool ok = true;
                for(int i = 0; i < n; i++)
                {
                    Int64 cost = mid / n;
                    if ((i + 1) <= mid % n)
                        cost++;
                    Int64 disc = mid / (7 * fcnt);
                    if(7*(f[i]+1) <= mid % (7*fcnt))
                        disc++;
                    cost -= disc;
                    if (cost >= a[i])
                        ok = false;
                }

                if (ok)
                    l = mid;
                else
                    r = mid;
            }

            Console.WriteLine(((r-1) % n + 1).ToString());
        }

    }
}


using System;

class Program
{

    static void Main()
    {
        int n = Convert.ToInt32(Console.ReadLine());
        int[] a = new int[n];
        int[] f = new int[n];
        int fcnt = 0;

        string str = Console.ReadLine();
        string[] words = str.Split(' ');

        for (int i = 0; i < n; i++)
            a[i] = Convert.ToInt32(words[i]);

        for(int i = 0, now = n-1; i < n; i++)
        {
            now += 7;
            now %= n;
            f[now] = i;
            if (now == n-1)
                break;
            fcnt++;
        }

        {
            Int64 l = 0;
            Int64 r = Convert.ToInt64(5e4 * 10e9);
            while(l+1 != r)
            {
                Int64 mid = (l + r) / 2;
                bool ok = true;
                for(int i = 0; i < n; i++)
                {
                    Int64 cost = mid / n;
                    if ((i + 1) <= mid % n)
                        cost++;
                    Int64 disc = mid / (7 * fcnt);
                    if(7*(f[i]+1) <= mid % (7*fcnt))
                        disc++;
                    cost -= disc;
                    if (cost >= a[i])
                        ok = false;
                }

                Console.Write(mid.ToString());
                Console.WriteLine(ok.ToString());
                if (ok)
                    l = mid;
                else
                    r = mid;
            }

            Console.WriteLine(((r-1) % n + 1).ToString());
        }

    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    long Fun(long a, long b, long x)
    {
        if (b > x)
            return 0;
        return (x - b) / a + 1;
    }

    long Fun(long a, long b, long l, long r)
    {
        return Fun(a, b, r) - Fun(a, b, l - 1);
    }

    long Gcd(long a, long b, out long x, out long y)
    {
        if (a == 0)
        {
            x = 0;
            y = 1;
            return b;
        }
	    long x1, y1;
	    long d = Gcd(b % a, a, out x1, out y1);
	    x = y1 - (b / a) * x1;
	    y = x1;
	    return d;
    }

    bool Dio(long a, long b, long c, out long x0, out long y0, out long g)
    {
	    g = Gcd(Math.Abs(a), Math.Abs(b), out x0, out y0);
	    if (c % g != 0)
		    return false;
	    x0 *= c / g;
	    y0 *= c / g;
	    if (a < 0)
            x0 *= -1;
	    if (b < 0)
            y0 *= -1;
	    return true;
    }

    public void Solve()
    {
        long a1 = ReadInt();
        long b1 = ReadInt();
        long a2 = ReadInt();
        long b2 = ReadInt();
        long l = ReadInt();
        long r = ReadInt();

        if (a1 == a2)
        {
            if (Math.Abs(b1 - b2) % a1 != 0)
                Write(0);
            else
                Write(Fun(a1, Math.Max(b1, b2), l, r));
            return;
        }

        long x0, y0, g;
        if (!Dio(a1, -a2, b2 - b1, out x0, out y0, out g))
        {
            Write(0);
            return;
        }

        long d1 = a2 / g;
        long d2 = a1 / g;
        if (x0 < 0)
        {
            long z = ((-x0 - 1) / d1 + 1);
            x0 += z * d1;
            y0 += z * d2;
        }
        if (y0 < 0)
        {
            long z = ((-y0 - 1) / d2 + 1);
            x0 += z * d1;
            y0 += z * d2;
        }

        long t = Math.Min(x0 / d1, y0 / d2);
        x0 -= t * d1;
        y0 -= t * d2;
        Write(Fun(d1 * a1, a1 * x0 + b1, l, r));
    }

    #region Main

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

    #endregion

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


using System;

namespace Problem51Nod
{
    class Program
    {
        public static void Main(String[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(input[0]);
            long sum = Convert.ToInt64(input[1]);
            input = Console.ReadLine().Split(' ');
            long[] nums = new long[n];

            for (int i = 0; i < n; i++)
                nums[i] = Convert.ToInt64(input[i]);

            Init(nums);
            long result = Cal(Nums.Length - 1, sum);
            result = (result + Mod) % Mod;
            Console.WriteLine(result);
        }

        static long Mod = 1000000007;
        static long[] Nums, InvFacts;

        static void Init(long[] nums)
        {
            long[] invs = new long[30];
            InvFacts = new long[30];
            invs[1] = InvFacts[1] = 1;

            for (int i = 2; i < invs.Length; i++)
            {
                invs[i] = (Mod - Mod / i * invs[Mod % i] % Mod) % Mod;
                InvFacts[i] = InvFacts[i - 1] * invs[i] % Mod;
            }

            Nums = new long[nums.Length];

            for (int i = 0; i < nums.Length; i++)
                Nums[i] = nums[i] + 1;

            Array.Sort(Nums, (a, b) => b.CompareTo(a));
        }

        static long Cal(int index, long sum)
        {
            int k = Nums.Length - 1;
            long result = Cmn(sum + k, k);

            for(int i = index; i >= 0 && Nums[i] <= sum; i--)
                result -= Cal(i - 1, sum - Nums[i]);

            return result % Mod;
        }

        static long Cmn(long m, long n)
        {
            long result = 1;

            for(long i = m - n + 1; i <= m; i++)
                result = i % Mod * result % Mod;

            result = result * InvFacts[n] % Mod;
            return result;
        }
    }
}


//#define LOCAL
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace _258_E
{
    class Program
    {
        class Files
        {
            StreamReader fin = new StreamReader("d:\\date.in");
            StreamWriter fout = new StreamWriter("d:\\date.out");
            public string ReadLine()
            {
                return fin.ReadLine();
            }
            public void Write(string s)
            {
                fout.Write(s);
            }
            public void WriteLine(string s)
            {
                fout.WriteLine(s);
            }
            public void Close()
            {
                fout.Close();
            }
        }
        #if LOCAL
            static Files Console = new Files();
        #endif
        const Int64 Mod = (int)1e9+7;
        static string[] s;
        static string Line;
        static int step = 0, Length = 0;
        static Int64 GetNext()
        {
            if (step == Length)
            {
                Line = Console.ReadLine();
                s = Line.Split(' ');
                Length = s.Length;
                step = 0;
            }
            ++step;
            return Int64.Parse(s[step - 1]);
        }
        static Int64[] a = new Int64[30];
        static Int64 Inv = 1;
        static Int64 Comb(Int64 n, Int64 k)
        {
            if (n < k)
                return 0;
            Int64 result = 1;
            for (Int64 i = n - k + 1; i <= n; ++i)
                result = (Int64)result*i%Mod;
            result = (Int64)result*Inv%Mod;
            return result;
        }
        static Int64 Fix(Int64 x)
        {
            Int64 ret = x;
            if (ret >= Mod)
                ret -= Mod;
            if (ret < 0)
                ret += Mod;
            return ret;
        }
        static Int64 Pow_Log(Int64 x,Int64 p)
        {
            if (p == 0)
                return 1;
            Int64 y;
            if(p%2==1)
               y = (Int64)Pow_Log(x,p-1)*x%Mod;
            else
            {
                y = Pow_Log(x,p/2);
                y = (Int64)y*y%Mod;
            }
            return y;
        }
        static void Main(string[] args)
        {
            Int64 n = GetNext(), S = GetNext(), sum = 0, Max = 1;
            Inv = 1;
            for (int i = 0; i < n; ++i)
            {
                Max *= 2;
                if (i > 0)
                    Inv *= i;
                a[i] = GetNext();
                sum += a[i];
            }
            if (sum < S)
            {
                Console.WriteLine("0\n");
                return;
            }
            Inv = Pow_Log(Inv, Mod - 2);
            Int64 Solution = Comb(S + n - 1, n - 1),cnt = 0;
            for (int i = 1; i < Max; ++i)
            {
                Int64 k = 0;
                int nr = 0;
                for (int j = 0; j < n; ++j)
                    if (((1 << j) & i) != 0)
                    {
                        ++nr;
                        k += a[j]+1;
                    }
                k = S - k;
                if (nr % 2 == 1)
                    cnt += Comb(k + n - 1, n - 1);
                else
                    cnt -= Comb(k + n - 1, n - 1);
                cnt = Fix(cnt);
            }
            Solution -= cnt;
            Fix(Solution);
            Console.WriteLine(Solution.ToString());
            #if LOCAL
                Console.Close();
            #endif
        }
    }
}


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

namespace Codeforces.R258
{
    public class Task_E
    {
        private static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new StreamReader(@"input.txt"));
#endif
            new Task_E().Solve();
        }

        private long[] f;
        private int n;
        private const long MOD = (long)(1e9 + 7);

        private void Solve()
        {
            var parts = Console.ReadLine().Split().Select(long.Parse).ToArray();
            n = (int)parts[0];
            long s = parts[1];
            f = Console.ReadLine().Split().Select(long.Parse).ToArray();
            for (int i = 0; i < f.Length; i++)
            {
                f[i]++;
            }

            var ans = go(0, s);
            Console.WriteLine(ans);
        }

        private long go(int pos, long s)
        {
            if (s < 0)
                return 0;

            long result = 0;
            if (pos == n)
            {
                result = C(s + n - 1, n - 1);
            }
            else
            {
                result = (go(pos + 1, s) - go(pos + 1, s - f[pos]) + MOD) % MOD;
            }

            //            Console.WriteLine("go({0},{1}) = {2}", pos, s, result);
            return result;
        }

        private long C(long n, long k)
        {
            long result = 1;
            for (long i = 2; i <= k; i++)
                result = (result * inv(i) % MOD) % MOD;

            for (long i = n - k + 1; i <= n; i++)
                result = (result * (i % MOD)) % MOD;

            //   Console.WriteLine("C({0}, {1}) = {2}", n, k, result);
            return result;
        }

        private static void ExEuclidean(long a, long b, out long x, out long y)
        {
            if (a == 1)
            {
                x = 1;
                y = 0;
            }
            else
            {
                long x1, y1;
                ExEuclidean(b % a, a, out x1, out y1);
                x = y1 - (b / a) * x1;
                y = x1;
            }
        }

        private static long inv(long a)
        {
            long x, y;
            ExEuclidean(a, MOD, out x, out y);
            return (x + MOD) % MOD;
        }
    }
}


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

namespace C.Peasant
{
    class Program
    {
        private static IEnumerable<long> Factor(long x)
        {
            for (int i = 1; i * i <= x; i++)
            {
                if (x % i == 0)
                {
                    yield return i;
                    yield return x / i;
                }
            }
        }

        private static long F(long n, long a, long b, long c)
        {
            return (a + 1) * (b + 2) * (c + 2) - n;
        }

        static void Main(string[] args)
        {
            long n = int.Parse(Console.ReadLine());
            long max = 0, min = long.MaxValue;

            long[] factors = Factor(n).ToArray();

            foreach (long f1 in factors)
            {
                foreach (long f2 in factors)
                {
                    if (n % (f1 * f2) == 0)
                    {
                        long f3 = n / (f1 * f2);
                        long y = F(n, f1, f2, f3);

                        if (y < min)
                            min = y;

                        if (y > max)
                            max = y;
                    }
                }
            }

            Console.WriteLine("{0} {1}", min, max);
        }
    }
}


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

namespace ConsoleApplication1
{
  class Program
  {

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

      long min = long.MaxValue;

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

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


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

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

            var n = long.Parse(Console.ReadLine());

            var min = long.MaxValue;
            var max = (n + 1) * 9 - n;
            var root = Math.Sqrt(n);
            var up = root % 1 > 0.5 ? Math.Round(root) : Math.Round(root + 0.5);

            for (int a = 1; a < up + 5; a++)
            {
                for (int c = 1; c < up + 5; c++)
                {
                    var b = n / a / c;
                    if (n == a * b * c)
                    {
                        var temp = (a + 1) * (b + 2) * (c + 2) - n;
                        if (temp < min) min = temp;
                    }
                }
            }

            Console.WriteLine("{0} {1}", min, max);
        }

    }
}


using System;
using System.Linq;

namespace globalLogin
{
	public class Program
	{
		public static void Main(string[] str)
		{
			int[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();
			Solution sol = new Solution();
			Console.WriteLine(sol.Intersect(info[0], info[1], info[2], info[3], info[4]) ? "YES" : "NO");
		}
	}

	internal class Solution
	{
		public bool Intersect(int n, int a, int x, int b, int y)
		{
			int stationA = 0;
			int stationB = n - 1;
			--x;
			--y;
			bool AInTrain = false, BInTrain = false;

			for(int i = 0; i <= 2 * n; ++i,
				stationA = ++stationA % n,
				stationB = ((stationB - 1) % n + n) %n)
			{
				if(stationA == a)
					AInTrain = true;
				if(stationB == b)
					BInTrain = true;

				if(stationA == stationB && BInTrain == AInTrain && AInTrain == true)
					return true;

				if(stationA == x || stationB == y)
					return false;
			}
			return false;
		}
	}
}


using System;
using System.Collections.Generic;

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

            //100 2 97 84 89
            //5 1 4 3 2
            bool yes = false;

            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int a = int.Parse(s[1]);
            int x = int.Parse(s[2]);

            int b = int.Parse(s[3]);
            int y = int.Parse(s[4]);

            List<int> ax = new List<int>();
            List<int> by = new List<int>();
            Queue<int> qax = new Queue<int>();
            Queue<int> qby = new Queue<int>();

            //Daniel
            if (a > x)
            {
                int c = a + 1;
                while (c <= n)
                {
                    qax.Enqueue(c++);
                }
            }
            int sa = (a > x)? 1: a + 1;
            for (int i = sa; i <= x; i++)
            {
                qax.Enqueue(i);
            }

            //vlad
            if (b < y)
            {
                int c = b - 1;
                while (c > 0)
                {
                    qby.Enqueue(c--);
                }
            }

            int sb = (b < y) ? n : b;
            for (int i = sb; i >=y; i--)
            {
                qby.Enqueue(i);
            }
            //100 2 97 84 89
            //yes
            while (qax.Count > 0 && qby.Count > 0)
            {
                int t1 = qax.Dequeue();
                int t2 = qby.Dequeue();
                if (t1 == t2)
                {
                    yes = true;
                    break;
                }
            }
            Console.WriteLine(yes == true ? "YES" : "NO");

        }
    }
}


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

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

public class HelloWorld {
    public static void SolveCodeForces() {
        var n = cin.NextInt();
        var a = cin.NextInt() - 1;
        var x = cin.NextInt() - 1;
        var b = cin.NextInt() - 1;
        var y = cin.NextInt() - 1;

        for (var t = 0; t <= n+5; t++) {
            if (a == b) {
                System.Console.WriteLine("YES");
                return;
            }
            if (a == x || b == y) break;
            a = (a + 1) % n;
            b = (b - 1) % n;
        }
        System.Console.WriteLine("NO");
    }

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

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

    public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)
    {
        var thread = new Thread(action, stackSize);
        thread.Start();
        thread.Join();
    }
}

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

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

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

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

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

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

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

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

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

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


using System.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 int? getVal(char c)
    {
        if (c >= 'a' && c <= 'f')
            return 10 + (c - 'a');
        if (c >= 'A' && c <= 'F')
            return 10 + (c - 'A');
        if (c >= '0' && c <= '9')
            return c - '0';
        return null;
    }

    static char? convert(char? A, char? B)
    {
        if (A == null || B == null)
            return null;
        var x = getVal(A.Value);
        var y = getVal(B.Value);
        if (x == null || y == null)
            return null;
        var res = x.Value * 16 + y.Value;
        return (char)res;
    }

    static void Main(string[] args)
    {
        var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);
        var n = nm[0];
        var a = nm[1];
        var x = nm[2];
        var b = nm[3];
        var y = nm[4];
        for (int i = 0; i < n; i++)
        {
            var c1 = (a - 1 + i) % n;
            var c2 = (b - 1 - i) % n;
            c2 = c2 < 0 ? c2 + n : c2;
            if (c1 == c2 )
            {
                Console.WriteLine("YES");
                return;
            }
            if (c1 == x - 1 || c2 == y - 1)
            {
                Console.WriteLine("NO");
                return;
            }
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve() ? "Yes" : "No");
            writer.Flush();
        }

        private static bool Solve()
        {
            int n = Next(), a = Next(), x = Next(), b = Next(), y = Next();

            while (true)
            {
                a++;
                b--;
                if (a > n)
                    a = 1;
                if (b == 0)
                    b = n;
                if (a == b)
                    return true;
                if (a == x || b == y)
                    return false;
            }
        }

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


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

namespace CodeForces
{
	class Program
	{
		static void Main(string[] args)
		{
			var arr = Ints();
			var n = arr[0];
			var a = --arr[1];
			var x = --arr[2];
			var b = --arr[3];
			var y = --arr[4];

			while (true)
			{
				if (a == b)
				{
					Console.WriteLine("YES");
					return;
				}

				if (a == x || b == y)
				{
					Console.WriteLine("NO");
					return;
				}

				a = (a + 1) % n;
				b = (b - 1 + n) % n;
			}

		}

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

		static (int, int) Int2()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
			return (arr[0], arr[1]);
		}

		static (int, int, int) Int3()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
			return (arr[0], arr[1], arr[3]);
		}

		static int[] Ints()
		{
			return Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
		}

		static long Long()
		{
			return Int64.Parse(Console.ReadLine());
		}

		static (long, long) Long2()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
			return (arr[0], arr[1]);
		}

		static (long, long, long) Long3()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
			return (arr[0], arr[1], arr[2]);
		}

		static long[] Longs()
		{
			return Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
		}

		static string Str()
		{
			return Console.ReadLine();
		}

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


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
class problem
{
    static void Main()
    {
        var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );
        int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];
        int t=x>a?x-a:x+n-a;
        t=Math.Min(t,y>b?b+n-y:b-y);
        while(t-->-1)
        {
            if(a == b)
            {
                Console.WriteLine( "YES" );
                return;
            }
            else
            {
                a = a == n ? 1 : a+1;
                b = b == 1 ? n : b-1;
            }
        }
        Console.WriteLine( "NO" );

    }
}


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

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var n = getInt();
			Console.WriteLine((long)(n - 2) * (n - 2));
			/*			input.Close();
			output.Close();*/
		}
	}
}


using System;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            if(n == 3) Console.WriteLine(1);
            else Console.WriteLine((n-2)*(n-1) - (n-2));
        }
    }
}


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

namespace Solving
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                new Solver().Solve();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadKey();
            }
        }
    }

    class Solver
    {
        public void Solve()
        {
            long n = long.Parse(Console.ReadLine());
            long ans = (n - 2) * (n - 2);
            Console.WriteLine(ans);
            //Console.ReadKey();
        }

    }

    class InputReader
    {
        public static int[] ReadIntArr()
        {
            return Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray

();
        }
        public static string ReadString()
        {
            return Console.ReadLine();
        }
        public static long[] ReadLongArr()
        {
            return Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray

();
        }
        public static double[] ReadDoubleArr()
        {
            return Console.ReadLine().Split(' ').Select(s => Double.Parse(s,

CultureInfo.InvariantCulture)).ToArray();
        }
        public static string[] ReadSplitString()
        {
            return Console.ReadLine().Split(' ').ToArray();
        }
        public static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }
        public static long ReadLong()
        {
            return Int64.Parse(Console.ReadLine());
        }
        public static double ReadDouble()
        {
            return Double.Parse(Console.ReadLine(),

CultureInfo.InvariantCulture);
        }
        public static int[][] ReadIntMatrix(int numberofrows)
        {
            int[][] matrix = new int[numberofrows][];
            for (int i = 0; i < numberofrows; i++)
            {
                matrix[i] = ReadIntArr();
            }
            return matrix;
        }
        public static string[] ReadStringLines(int numberoflines)
        {
            string[] arr = new string[numberoflines];
            for (int i = 0; i < numberoflines; i++)
            {
                arr[i] = Console.ReadLine().Trim();
            }
            return arr;
        }
    }

    class OutputWriter
    {
        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Console.WriteLine(string.Join(" ", array));
        }
        public static void WriteLines<T>(IEnumerable<T> array)
        {
            foreach (var a in array) { Console.WriteLine(a); }
        }
    }
    class RDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
}


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

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

            long answer = 1;
            long prev=1;
            for (int i = 4; i <= n; i++)
            {
                prev += 2;
                answer += prev;
            }

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


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine((n-2)*(n-2));
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(3 * (n - 3) + (n - 3) * (n - 4) + 1);
        }
    }
}