#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);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            A();

#if Online
            Console.ReadLine();
#endif

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

        static void A()
        {
            string input = ReadLine();
            int tens = 0;
            bool[] letters = new bool[10];
            int cnt = 10;
            int other = 1;
            for (int i = 0; i < input.Length; i++)
            {
                if (input[i].Equals('?'))
                {
                    if (i == 0)
                    {
                        other *= 9;
                        continue;
                    }
                    tens++;
                }
                else
                {
                    if (!char.IsDigit(input[i]))
                    {
                        if (!letters[input[i] - 'A'])
                        {
                            if (i == 0)
                            {
                                other *= 9;
                                cnt--;
                                continue;
                            }
                            other *= cnt;
                            cnt--;
                            letters[input[i] - 'A'] = true;
                        }
                    }
                }
            }
            StringBuilder ans = new StringBuilder();
            ans.Append(other.ToString());
            for (int i = 0; i < tens; i++)
                ans.Append("0");
            Console.WriteLine(ans);
        }

        static void B()
        {

        }

        static void C()
        {

        }

        static void D()
        {

        }

        static void E()
        {

        }

        static void TestGen()
        {

        }

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

        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 Stack<int> ans = new Stack<int>();
        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];
        }

        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public bool DFS(int u, ref int time)
        {
            color[u] = gray;
            time++;
            o[u] = time;
            for (int i = 0; i < g[u].Count; i++)
            {
                int v = g[u][i];
                if (color[v] == gray)
                {
                    return true;
                }
                if (color[v] == white)
                {
                    p[v] = u;
                    if (DFS(v, ref time)) return true;
                }
            }
            color[u] = black;
            ans.Push(u);
            c[u] = time;
            time++;
            return false;
        }
    }

    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 bool DFS(int u, ref int time, Graph g, Stack<int> st)
        {
            g.color[u] = gray;
            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] == gray)
                {
                    return true;
                }
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    if (DFS(v, ref time, g, st)) return true;
                }
            }
            g.color[u] = black;
            st.Push(u);
            g.c[u] = time;
            time++;
            return false;
        }

        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.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string st = Console.ReadLine();
            bool[] f = new bool[10];
            int ff = 10;
            long k=1;
            for (int i = 0; i < 10; i++)
            {
                f[i] = true;
            }
            for (int i = 0; i < st.Length; i++)
            {
                if (st[i] == '?')
                {
                    k = k * 10;
                }
                if (st[i] >= 'A' && st[i] <= 'J')
                {
                    if (ff > 0 && f[(int)st[i] - 65] == true)
                    {
                        if (i == 0)
                        {
                            k = k * 9;
                        }
                        else
                        {
                            k = k * ff;
                        }
                        ff--;
                    }
                    f[(int)st[i] - 65] = false;
                }
            }
            Console.WriteLine(k.ToString());
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {

        static void PrintAnswer(int s, List<char> text)
        {
            bool Finished = false; bool errorFound = false;
            int c = 0;
            while (!Finished)
            {
                errorFound = false;
                int biggerIndex = 0;

                // biggerIndex = text.IndexOf(text.OrderByDescending(x => (int)(x)).First());

                for (int i = biggerIndex; i < text.Count; i++)
                {
                    if (i == 0)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (((int)text[i]) - ((int)text[i + 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else if (i == text.Count - 1)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (((int)text[i]) - ((int)text[i - 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (((int)text[i]) - ((int)text[i + 1]) == 1 || ((int)text[i]) - ((int)text[i - 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                }
                if (!errorFound)
                    Finished = true;
            }
            Console.WriteLine(c);
        }
        static void Main(string[] args)
        {
            int s = Int32.Parse(Console.ReadLine());
            List<char> text = Console.ReadLine().Select(x => x).ToList();

            // PrintAnswer(s,text);
            FindMaxChars(s, text);
        }

        static void FindMaxChars(int s, List<char> text)
        {
            if (s == 1) { Console.WriteLine(0); return; }
            bool Finished = false; bool errorFound = false;
            int c = 0;
            while (!Finished)
            {
                errorFound = false;
                List<char> bigChars = text.OrderByDescending(x => (int)x).Distinct().Where(x => x != 'a').ToList();

                while (bigChars.Count > 0)
                {
                    int bigCharIndex = text.IndexOf(bigChars.First());
                    for (int i = 0; i < text.Count; i++)
                    {
                        if (text[i] == bigChars.First())
                        {
                            if (i == 0)
                            {
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                            else if (i == text.Count - 1)
                            {
                                if (((int)text[i]) - ((int)text[i - 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                            else
                            {
                                if (((int)text[i]) - ((int)text[i + 1]) == 1 || ((int)text[i]) - ((int)text[i - 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                        }
                    }
                    bigChars.RemoveAt(0);
                }

                if (!errorFound) Finished = true;
            }
            Console.WriteLine(c);
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {

        static void PrintAnswer(int s, List<char> text)
        {
            bool Finished = false; bool errorFound = false;
            int c = 0;
            while (!Finished)
            {
                errorFound = false;
                int biggerIndex = 0;

                // biggerIndex = text.IndexOf(text.OrderByDescending(x => (int)(x)).First());

                for (int i = biggerIndex; i < text.Count; i++)
                {
                    if (i == 0)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1)
                            if (((int)text[i]) - ((int)text[i + 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else if (i == text.Count - 1)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1)
                                if (((int)text[i]) - ((int)text[i - 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1 && i > 0)
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            if (text.Count > 2 && i < text.Count-2)
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                        }
                    }
                }
                if (!errorFound)
                    Finished = true;
            }
            Console.WriteLine(c);
        }
        static void Main(string[] args)
        {
            int s = Int32.Parse(Console.ReadLine());
            List<char> text = Console.ReadLine().Select(x => x).ToList();

            // PrintAnswer(s,text);
            FindMaxChars(s, text);
        }

        static void FindMaxChars(int s, List<char> text)
        {
            if (s == 1) { Console.WriteLine(0); return; }
            bool Finished = false; bool errorFound = false;
            int c = 0;
            while (!Finished)
            {
                errorFound = false;
                List<char> bigChars = text.OrderByDescending(x => (int)x).Distinct().Where(x => x != 'a').ToList();

                while (bigChars.Count > 0)
                {
                    int bigCharIndex = text.IndexOf(bigChars.First());
                    for (int i = 0; i < text.Count; i++)
                    {
                        if (text[i] == bigChars.First())
                        {
                            if (text.Count == 1) { Finished = true; bigChars = new List<char>(); break; }
                            if (i == 0)
                            {
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                            else if (i == text.Count - 1)
                            {
                                if (((int)text[i]) - ((int)text[i - 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                            else
                            {
                                if (((int)text[i]) - ((int)text[i + 1]) == 1 || ((int)text[i]) - ((int)text[i - 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                        }
                    }
                    if (bigChars.Count > 0)
                    bigChars.RemoveAt(0);
                }

                if (!errorFound) Finished = true;
            }
            Console.WriteLine(c);
        }
    }
}


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

class Test
{
    class a
    {
        public char key;
        public int value;
    }
    // Driver code
    public static void Main()
    {

        //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        {

            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];

            var x = Console.ReadLine().ToCharArray();
			if (x.Length <= 1)
			{
				Console.WriteLine(0);
				return;
			}
			int s = 0;
			for (int i = 25; i > 0; i--)
			{
				char y = (char)(i + 'a'), z = (char)(i - 1 + 'a');
				for (int j = 0; j < n; j++)
				{
					if (x[j] == y)
					{
						int l = j - 1, r = j + 1;
						while (l>=0&&(x[l] == '?' || x[l] == y))
						{
							l--;
						}
						if (l >= 0)
						{
							if (x[l] == z)
							{
								s++;
								x[j] = '?';
								continue;
							}
						}
						while (x[r] == '?' || x[r] == y)
						{
							r++;
						}
						if (r < n)
						{
							if (x[r] == z)
							{
								s++;
								x[j] = '?';
							}
						}
					}
				}
			}

			Console.WriteLine(s);

            }

        }
    }


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

class Test
{
    class a
    {
        public char key;
        public int value;
    }
    // Driver code
    public static void Main()
    {

        //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        {

            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];

            var x = Console.ReadLine().ToCharArray();
			if (x.Length <= 1)
				return 0;
			int s = 0;
			for (int i = 25; i > 0; i--)
			{
				char y = (char)(i + 'a'), z = (char)(i - 1 + 'a');
				for (int j = 0; j < n; j++)
				{
					if (x[j] == y)
					{
						int l = j - 1, r = j + 1;
						while (l>=0&&(x[l] == '?' || x[l] == y))
						{
							l--;
						}
						if (l >= 0)
						{
							if (x[l] == z)
							{
								s++;
								x[j] = '?';
								continue;
							}
						}
						while (x[r] == '?' || x[r] == y)
						{
							r++;
						}
						if (r < n)
						{
							if (x[r] == z)
							{
								s++;
								x[j] = '?';
							}
						}
					}
				}
			}

			Console.WriteLine(s);

            }

        }
    }


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

class Test
{
    class a
    {
        public char key;
        public int value;
    }
    // Driver code
    public static void Main()
    {

        //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        {

            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];

            var x = Console.ReadLine().ToCharArray();
			if (x.Length <= 1)
				return ;
			int s = 0;
			for (int i = 25; i > 0; i--)
			{
				char y = (char)(i + 'a'), z = (char)(i - 1 + 'a');
				for (int j = 0; j < n; j++)
				{
					if (x[j] == y)
					{
						int l = j - 1, r = j + 1;
						while (l>=0&&(x[l] == '?' || x[l] == y))
						{
							l--;
						}
						if (l >= 0)
						{
							if (x[l] == z)
							{
								s++;
								x[j] = '?';
								continue;
							}
						}
						while (x[r] == '?' || x[r] == y)
						{
							r++;
						}
						if (r < n)
						{
							if (x[r] == z)
							{
								s++;
								x[j] = '?';
							}
						}
					}
				}
			}

			Console.WriteLine(s);

            }

        }
    }


using System.Collections.Generic;
using System;

class _1321C
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
		List<char> list = new List<char>(s.ToCharArray());
		int cnt = 0;
		const int LetterLen = 26;
		for (int i = LetterLen - 1; i >= 1; --i)
		{
			char cur = (char)('a' + i);
			char prev = (char)(cur - 1);
			for (int j = 0; j < list.Count; ++j)
			{
				if (j >= 1)
				{
					if (list[j] == cur && list[j - 1] == prev)
					{
						list.RemoveAt(j);
						j = 0;
						++cnt;
						continue;
					}
				}
				if (j <= list.Count - 2)
				{
					if (list[j] == cur && list[j + 1] == prev)
					{
						list.RemoveAt(j);
						j = 0;
						++cnt;
						continue;
					}
				}
			}
		}
		Console.WriteLine(cnt);
	}
}


using System;
using System.Linq;

namespace Test
{
    class Program
    {
        static void Main()
        {
            while (true)
            {
            short[] input = Console.ReadLine().Split(' ').Select(num => Convert.ToInt16(num)).ToArray();
            long cost = 0;

                if (input[3] < input[1] * input[2])
                {
                    if (input[0] < input[1])
                    {
                        if (input[0] * input[2] < input[3])
                            cost = input[2];
                        else
                            cost = input[3];
                    }
                    else
                    {
                        cost += (input[0] / input[1]) * input[3];
                        if (input[0] % input[1] != 0)
                        {
                            if (input[2] > input[3])
                                cost += input[3];
                            else
                                cost += input[2];
                        }
                    }
                }
                else
                {
                    cost = input[0] * input[2];
                }
                Console.WriteLine(cost);
            }
        }
    }
}


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

class Solver
{
    Scanner sc = new Scanner();
    //
    public void Solve()
    {
        int l, r, x, y;
        sc.Make(out l, out r, out x, out y);
        var fx = Factorize(x);
        var fy = Factorize(y);
        foreach (var p in fx)
        {
            if (!fy.ContainsKey(p.Key)||fy[p.Key]<p.Value)
                Fail(0);
        }
        var n = new List<P>();
        foreach (var p in fy)
        {
            if (!fx.ContainsKey(p.Key)) fx[p.Key] = 0;
            n.Add(new P(p.Key, p.Value, fx[p.Key]));
        }
        var res = 0;
        var ok = new Dictionary<long, Dictionary<long, bool>>();
        for(var i = 0; i < (1 << n.Count); i++)
        {
            long u = 1, v = 1;
            for(var j=0;j<n.Count;j++)
                if ((1 & i >> j) == 1)
                {
                    for (var k = 0; k < n[j].x; k++)
                        u *= n[k].v;
                    for (var k = 0; k < n[j].y; k++)
                        v *= n[k].v;
                }
                else
                {
                    for (var k = 0; k < n[j].x; k++)
                        v *= n[k].v;
                    for (var k = 0; k < n[j].y; k++)
                        u *= n[k].v;
                }
            if (r < u || u < l || r < v || v < l) continue;
            if (!ok.ContainsKey(u))
                ok[u] = new Dictionary<long, bool>();
            if (!ok[u].ContainsKey(v))
            {
                res++;
                ok[u][v] = true;
            }
        }
        WriteLine(res);
    }
    struct P
    {
        public long v, x, y;
        public P(long V,int X,int Y)
        {
            v = V;x = X;y = Y;
        }
    }

    public static Dictionary<long, int> Factorize(long num)
    {
        var dic = new Dictionary<long, int>();
        for (var i = 2L; i * i <= num; i++)
        {
            var ct = 0;
            while (num % i == 0)
            {
                ct++;
                num /= i;
            }
            if (ct != 0) dic[i] = ct;
        }
        if (num != 1) dic[num] = 1;
        return dic;
    }
}

#region Template
public class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b)
    { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f();
        return rt;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<int, T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f(i);
        return rt;
    }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}

public class Scanner
{
    public string Str => ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    public Pair<T1, T2> PairMake<T1, T2>() => new Pair<T1, T2>(Next<T1>(), Next<T2>());
    public Pair<T1, T2, T3> PairMake<T1, T2, T3>() => new Pair<T1, T2, T3>(Next<T1>(), Next<T2>(), Next<T3>());
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
}

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

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

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

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


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

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

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            int l = Next(), r = Next(), x = Next(), y = Next();

            if (y % x != 0)
                return 0;

            y /= x;
            l /= x;
            r /= x;

            int ans = 0;
            for (int i = Math.Max(1, l); i <= r; i++)
            {
                if (i*i > y)
                    break;

                if (y%i == 0)
                {
                    int z = y/i;
                    int g = Gcd(i, z);
                    if (g == 1)
                    {
                        if (z <= r)
                            ans += 2;
                        if (z == i)
                            ans--;
                    }
                }
            }
            return ans;
        }

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

        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.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()
        {
            string[] s = Console.ReadLine().Split();
            l = long.Parse(s[0]);
            r = long.Parse(s[1]);
            x = long.Parse(s[2]);
            y = long.Parse(s[3]);
            List<long> yfactors = Factor(y);
            yf = new List<long>();
            long x2 = x;
            for (int i = 0; i < yfactors.Count; i++)
            {
                if(x2 % yfactors[i] == 0)
                {
                    x2 /= yfactors[i];
                }
                else if(i != 0 && yfactors[i] == yfactors[i - 1])
                {
                    yf[yf.Count - 1] *= yfactors[i];
                }
                else
                {
                    yf.Add(yfactors[i]);
                }
            }
            if(x2 != 1)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine(Count(new bool[yf.Count], 0));
            }

        }

        static long x, y, r, l;
        static List<long> yf;

        public static long Count(bool[] b, long at)
        {
            if(at == b.Length)
            {
                long n = x, m = x;
                for (int i = 0; i < b.Length; i++)
                {
                    if (b[i])
                        n *= yf[i];
                    else
                        m *= yf[i];
                }
                if (n <= r && n >= l && m <= r && m >= l)
                {
                    //Console.WriteLine(n + ", " + m);
                    return 1;
                }
                else
                    return 0;
            }
            long e = 0;
            bool[] nb = new bool[b.Length];
            Array.Copy(b, nb, b.Length);
            nb[at] = false;
            e += Count(nb, at + 1);
            nb[at] = true;
            e += Count(nb, at + 1);
            return e;
        }

        public static List<long> Factor(long n)
        {
            List<long> r = new List<long>();

            while (n % 2 == 0)
            {
                n /= 2;
                r.Add(2);
            }
            while (n % 3 == 0)
            {
                n /= 3;
                r.Add(3);
            }

            long sqrtn = (long)(Math.Sqrt(n)) + 1;
            long i = 6;
            while (n > 1 && i <= sqrtn)
            {
                bool nc = false;
                long a;
                while ((a = n % (i - 1)) == 0)
                {
                    r.Add(i - 1);
                    n /= i - 1;
                    nc = true;
                }
                while ((a = n % (i + 1)) == 0)
                {
                    r.Add(i + 1);
                    n /= i + 1;
                    nc = true;
                }
                i += 6;
                if (nc)
                    sqrtn = (long)(Math.Sqrt(n)) + 1;
            }
            if (n != 1) r.Add(n);
            return r;
        }
    }
}


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()
        {
            //Random rand = new Random();

            string[] s = Console.ReadLine().Split();
            l = long.Parse(s[0]);
            r = long.Parse(s[1]);
            x = long.Parse(s[2]);
            y = long.Parse(s[3]);
            //while (true)
            {
                Solve();
                //x = rand.Next(1, 1000000000);
                //y = x * rand.Next(1, 1000000000 / (int)x);
                //l = rand.Next(1, 1000000000);
                //r = rand.Next(1, 1000000000);
            }
        }

        static void Solve()
        {
            List<long> yfactors = Factor(y);
            yf = new List<long>();
            long x2 = x;
            long f = -1;
            for (int i = 0; i < yfactors.Count; i++)
            {
                if (x2 % yfactors[i] == 0)
                {
                    x2 /= yfactors[i];
                }
                else if (yf.Count != 0 && yfactors[i] == f)
                {
                    yf[yf.Count - 1] *= yfactors[i];
                }
                else
                {
                    yf.Add(yfactors[i]);
                    f = yfactors[i];
                }
            }
            if (x2 != 1)
            {
                Console.WriteLine("0 (-)");
            }
            else
            {
                Console.WriteLine(Count(new bool[yf.Count], 0));
            }
        }

        static long x, y, r, l;
        static List<long> yf;

        public static long Count(bool[] b, long at)
        {
            if(at == b.Length)
            {
                //Console.WriteLine(string.Join(", ", b));
                long n = x, m = x;
                for (int i = 0; i < b.Length; i++)
                {
                    if (b[i])
                        n *= yf[i];
                    else
                        m *= yf[i];
                }
                if (n <= r && n >= l && m <= r && m >= l)
                {
                    //Console.WriteLine(n + ", " + m);
                    return 1;
                }
                else
                    return 0;
            }
            long e = 0;
            bool[] nb = new bool[b.Length];
            Array.Copy(b, nb, b.Length);
            nb[at] = false;
            e += Count(nb, at + 1);
            nb[at] = true;
            e += Count(nb, at + 1);
            return e;
        }

        public static List<long> Factor(long n)
        {
            List<long> r = new List<long>();

            while (n % 2 == 0)
            {
                n /= 2;
                r.Add(2);
            }
            while (n % 3 == 0)
            {
                n /= 3;
                r.Add(3);
            }

            long sqrtn = (long)(Math.Sqrt(n)) + 1;
            long i = 6;
            while (n > 1 && i <= sqrtn)
            {
                bool nc = false;
                long a;
                while ((a = n % (i - 1)) == 0)
                {
                    r.Add(i - 1);
                    n /= i - 1;
                    nc = true;
                }
                while ((a = n % (i + 1)) == 0)
                {
                    r.Add(i + 1);
                    n /= i + 1;
                    nc = true;
                }
                i += 6;
                if (nc)
                    sqrtn = (long)(Math.Sqrt(n)) + 1;
            }
            if (n != 1) r.Add(n);
            return r;
        }
    }
}


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

namespace Task
{
  class Program
  {
    static bool InRange(int l, int r, int x)
    {
      return x >= l && x <= r;
    }

    static void Main(string[] args)
    {
      var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();
      int l = inpMas[0];
      int r = inpMas[1];
      int x = inpMas[2];
      int y = inpMas[3];

      if (y % x != 0)
      {
        Console.WriteLine(0);
        return;
      }

      int i = 0;
      int ans = 0;
      int yx = y / x;
      int yx2 = yx;
      List<int> divs = new List<int>();
      int div = 2;

      int k = 0;
      while (yx2 % div == 0)
      {
        k += 1;
        yx2 >>= 1;
      }
      if (k > 0)
          divs.Add((int)Math.Pow(div, k));

      div = 3;
      while (yx2 > 1)
      {
        k = 0;
        while (yx2 % div == 0)
        {
          k += 1;
          yx2 /= div;
        }
        if (k > 0)
          divs.Add((int)Math.Pow(div, k));
        div += 2;
      }

      div = 1 << divs.Count;
      for (i = 1; i <= div; i ++)
      {
        int j = i;
        int div1 = 1;
        int ind = divs.Count - 1;
          while (j > 0)
        {
          if ((j & 1) == 1)
          {
            div1 *= divs[ind];
            ind -= 1;
          }
          j >>= 1;
        }
        int div2 = yx / div1;
          if (InRange(l, r, div1) && InRange(l, r, div2))
        ans += 1;
      }

      Console.WriteLine(ans);
    }
  }
}


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

namespace Task
{
  class Program
  {
    static bool InRange(int l, int r, int x)
    {
      return x >= l && x <= r;
    }

    static void Main(string[] args)
    {
      var inpMas = Console.ReadLine().Split(' ').Select(item => int.Parse(item)).ToList();
      int l = inpMas[0];
      int r = inpMas[1];
      int x = inpMas[2];
      int y = inpMas[3];

      if (y % x != 0)
      {
        Console.WriteLine(0);
        return;
      }

      int i = 0;
      int ans = 0;
      int yx = y / x;
      int yx2 = yx;
      List<int> divs = new List<int>();
      int div = 2;

      int k = 0;
      while (yx2 % div == 0)
      {
        k += 1;
        yx2 >>= 1;
      }
      if (k > 0)
          divs.Add((int)Math.Pow(div, k));

      div = 3;
      while (yx2 > 1)
      {
        k = 0;
        while (yx2 % div == 0)
        {
          k += 1;
          yx2 /= div;
        }
        if (k > 0)
          divs.Add((int)Math.Pow(div, k));
        div += 2;
      }

      //divs.Add(1);
      div = (1 << divs.Count) - 1;
      for (i = 0; i <= div; i++)
      {
        int j = i;
        int div1 = 1;
        int ind = divs.Count - 1;
        while (j > 0)
        {
          if ((j & 1) == 1)
          {
            div1 *= divs[ind];
            ind -= 1;
          }
          j >>= 1;
        }
        int div2 = yx / div1;
        if (InRange(l, r, div1 * x) && InRange(l, r, div2 * x))
          ans += 1;
      }

      Console.WriteLine(ans);
    }
  }
}


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

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            long summ = MyConsoleInputStreamParser.GetLong, x = MyConsoleInputStreamParser.GetLong;
            var need = (summ - x) / 2;
            if (need < 0 || need % 2 == 1)
                Console.WriteLine(0);
            else
            {
                var bits = new int[64];
                var temp = x;
                var count = 0;
                var nonZeroBits = 0;
                while (temp > 0)
                {
                    var bit = (int)(temp % 2);
                    bits[count] = bit;
                    count++;
                    temp /= 2;
                    nonZeroBits += bit == 1 ? 1 : 0;
                }
                if (nonZeroBits == 1 && need == 0)
                    Console.WriteLine(0);
                else if (need == 0)
                    Console.WriteLine((long)Math.Pow(2, nonZeroBits) - 2);
                else
                {
                    temp = need;
                    count = 0;
                    var fail = false;
                    while (temp > 0)
                    {
                        var bit = (int)(temp % 2);
                        if (bits[count] == 1 && bit == 1)
                        {
                            fail = true;
                            break;
                        }
                        count++;
                        temp /= 2;
                    }
                    if (fail)
                        Console.WriteLine(0);
                    else
                        Console.WriteLine((long)Math.Pow(2, nonZeroBits));
                }
            }
        }

        public static class MyConsoleInputStreamParser
        {
            private static TextReader reader = new StreamReader(Console.OpenStandardInput());
            private static Queue<string> currentLineStrings = new Queue<string>();

            public static string GetLine { get { return reader.ReadLine(); } }

            public static string GetString { get { while (currentLineStrings.Count == 0) currentLineStrings = new Queue<string>(GetStringArray); return currentLineStrings.Dequeue(); } }

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

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

            public static double GetDouble { get { return double.Parse(GetString, CultureInfo.InvariantCulture); } }

            public static char[] GetCharArray { get { return GetLine.ToCharArray(); } }

            public static string[] GetStringArray { get { return GetLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } }

            public static int[] GetIntArray { get { return GetStringArray.Select(int.Parse).ToArray(); } }

            public static long[] GetLongArray { get { return GetStringArray.Select(long.Parse).ToArray(); } }

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

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

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

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

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

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


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

namespace CodeForces
{
    class B
    {
        static void Main(string[] args)
        {
           string s = Console.ReadLine();

           for(int i=0;i<s.Length;i++)
           {
              if(s[s.Length-i-1]=='0')
              {
               s = s.Replace("0","");
              }else{
                 break;
              }
           }
           int upTo = (s.Length%2==0)?s.Length/2:s.Length-1/2;
           for(int i=0;i<upTo;i++)
           {
              if(s[s.Length-i-1]!=s[i])
              {
                  Console.WriteLine("NO");
                  return;
              }
           }
           Console.WriteLine("YES");
        }

    }
}


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

namespace CodeForces
{
    class B
    {
        static void Main(string[] args)
        {
           string s = Console.ReadLine();
           int b = 0;
           for(int i=0;i<s.Length;i++)
           {
              if(s[s.Length-i-1]!='0')
              {
                break;
              }
               b++;
           }
         //  Console.WriteLine(b);
          int upTo = (s.Length%2==0)?s.Length/2:s.Length-1/2;
          if(s.Length-b==1)
          {
             Console.WriteLine("YES");
             return;
          }
          for(int i=0;i<upTo;i++)
          {
             if(s[s.Length-i-1-b]!=s[i])
             {
                  Console.WriteLine("NO");
                  return;
             }
          }
          Console.WriteLine("YES");
        }

    }
}


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

namespace codeforces
{
class Program
{

static void Main(string[] args)
{
 n = Convert.ToDouble(Console.ReadLine());
decimal value = 1;
for (int i = 0; i <= n; i++)
{
value *= 2;
}
value -= 2;
Console.WriteLine(value);
}
}
}


using System;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int days = int.Parse(Console.ReadLine());
            string cityes = Console.ReadLine();
            //string parametrs = Console.ReadLine();
            int S = 0, F = 0;
            for (int i = 0; i < days - 1; i++)
                if (cityes[i] != cityes[i + 1])
                        if (cityes[i ] == 'S') S++; F++;

                Console.WriteLine(S>F? "YES":"NO");

        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {
            byte n = Convert.ToByte(Console.ReadLine()),yes=0;
            string s = Console.ReadLine();
            for (int i = 0; i <s.Length-1; i++)
            {
                if (s[i] == 'S' && s[i + 1] == 'F') { yes++; }
                else if (s[i] == 'F' && s[i + 1] == 'S') { yes--; }
            }
            if (yes > 0) { Console.WriteLine("yes"); }
            else { Console.WriteLine("no"); }
        }
    }
}


using System;

public class Program
{
	public static void Main()
	{
		string input = "";
		int num,f=0,s=0;
		num = int.Parse(Console.ReadLine());
		input = Console.ReadLine();
		for(int i=0; i<num-1; i++)
		{
			if(input[i]=='F'||input[i]=='f'&&input[i+1]=='S'||input[i+1]=='s')
			{
				f++;
			}
			else if(input[i]=='s'||input[i]=='S'&&input[i+1]=='F'||input[i+1]=='f')
			{
				s++;
			}
		}
		if(s>f)
		{
			Console.WriteLine("YES");
		}
		else
		{
			Console.WriteLine("NO");
		}
	}
}


using System;
using System.Text.RegularExpressions;

{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine();
            var str = Console.ReadLine();
            Console.WriteLine(Regex.Matches(str, "SF").Count> Regex.Matches(str, "FS").Count ? "YES" : "NO");
        }
    }


using System;
using System.Text.RegularExpressions;

    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine();
            var str = Console.ReadLine();
            Console.WriteLine(Regex.Matches(str, "SF").Count> Regex.Matches(str, "FS").Count ? "NO" : "YES");
        }
    }


using System;

    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine();
            var str = Console.ReadLine();
            var c = 0;
            var FS = 0;
            var SF = 0;
            for (var i = 2; i < Convert.ToInt32(n); i+=2)
            {

                if (str.Substring(c, i) == "SF")
                    SF++;
                else FS++;
                c = i;
            }
           Console.WriteLine(FS > SF ? "NO" : "YES");
        }
    }


            List<string> arr = new List<string>();
            int n,Y=0,N=0,j2;
            string str,s1,s2;
            n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                arr.Add(Console.ReadLine());
            }
            for (int j = 0; j < n; j++)
            {
                if (j+1 < n)
                {
                    str = string.Concat(arr[j], arr[j + 1]);
                    if (str == "SF")
                    {
                        Y += 1;
                    }
                    if (str == "FS")
                    {
                        N += 1;
                    }
                }

            }//for
            if (Y>N)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using SB = System.Text.StringBuilder;
using System.Numerics;
using static System.Math;
namespace Program {
    public class Solver {
        Random rnd = new Random(0);
        public void Solve() {
            var n = rl;
            var k = ri;
            solve(n, k);
        }
        void solve(long n, int k) {
            Debug.WriteLine($"{n} {k}");
            var rev = Enumerate(100, x => ModInt.Inverse(x));

            ModInt all = 1;
            for (int p = 2; n != 1; p++) {
                if (n % p != 0) continue;
                var cnt = 0;
                while (n % p == 0) {
                    n /= p;
                    cnt++;
                }
                var dp = new ModInt[cnt + 1];
                dp[cnt] = 1;
                for (int i = 0; i < k; i++) {
                    var next = new ModInt[cnt + 1];
                    for (int j = 0; j < dp.Length; j++)
                        for (int jj = 0; jj <= j; jj++) {
                            next[jj] += dp[j] * rev[j + 1];
                        }
                    dp = next;
                }
                ModInt ans = 0;
                for (long i = 0, v = 1; i < dp.Length; i++, v *= p)
                    ans += v * dp[i];
                all *= ans;

            }
            Console.WriteLine(all);
        }
        const long INF = 1L << 60;
        int ri { get { return sc.Integer(); } }
        long rl { get { return sc.Long(); } }
        double rd { get { return sc.Double(); } }
        string rs { get { return sc.Scan(); } }
        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());

        static T[] Enumerate<T>(int n, Func<int, T> f) {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f(i);
            return a;
        }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#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();
        solver.Solve();
        Console.Out.Flush();
    }
}
#endregion
#region Ex
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)) { }
    }

    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 sieve O(NloglogN)
static public partial class MathEx {
    static public bool[] Sieve(int p, List<int> primes = null) {
        var isPrime = new bool[p + 1];
        for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true;
        for (int i = 2; i * i <= p; i++)
            if (!isPrime[i]) continue;
            else for (int j = i * i; j <= p; j += i) isPrime[j] = false;
        if (primes != null) for (int i = 0; i <= p; i++) if (isPrime[i]) primes.Add(i);

        return isPrime;
    }
    static public List<int> SieveList(int p) { var ret = new List<int>(); Sieve(p, ret); return ret; }
}
#endregion

#region ModInt
/// <summary>
/// [0,<see cref="Mod"/>) までの値を取るような数
/// </summary>
public struct ModInt {
    /// <summary>
    /// 剰余を取る値．
    /// </summary>
    public const long Mod = (int)1e9 + 7;

    /// <summary>
    /// 実際の数値．
    /// </summary>
    public long num;
    /// <summary>
    /// 値が <paramref name="n"/> であるようなインスタンスを構築します．
    /// </summary>
    /// <param name="n">インスタンスが持つ値</param>
    /// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
    public ModInt(long n) { num = n; }
    /// <summary>
    /// このインスタンスの数値を文字列に変換します．
    /// </summary>
    /// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
    public override string ToString() { return num.ToString(); }
    public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
    public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
    public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
    public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

    /// <summary>
    /// 与えられた 2 つの数値からべき剰余を計算します．
    /// </summary>
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }

    /// <summary>
    /// 与えられた 2 つの数値からべき剰余を計算します．
    /// </summary>
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    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);
    }
    /// <summary>
    /// 与えられた数の逆元を計算します．
    /// </summary>
    /// <param name="v">逆元を取る対象となる数</param>
    /// <returns>逆元となるような値</returns>
    /// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
    public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
}
#endregion


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

namespace codeforces
{

    public class Program
    {
        private const int MOD = 1000 * 1000 * 1000 + 7;

        private static int Add(int a, int b)
        {
            int result = a + b;
            if (result >= MOD)
            {
                result -= MOD;
            }
            return result;
        }

        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 List<KeyValuePair<long, int>> GetPrimes(long x)
        {
            var result = new List<KeyValuePair<long, int>>();
            for (int i = 2; 1L * i * i <= x; ++i)
            {
                int count = 0;
                while (x % i == 0)
                {
                    x /= i;
                    count++;
                }
                if (count > 0)
                {
                    result.Add(new KeyValuePair<long, int>(i, count));
                }
            }
            if (x > 1)
            {
                result.Add(new KeyValuePair<long, int>(x, 1));
            }

            return result;
        }

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

            var primes = GetPrimes(n);
            int mp = 0;
            for (int i = 0; i < primes.Count; ++i)
            {
                mp = Math.Max(primes[i].Value, mp);
            }
            var dp = new int[k + 1, mp + 1];
            int result = 1;
            for (int i = 0; i < primes.Count; ++i)
            {
                var pair = primes[i];
                for (int j = 0; j <= pair.Value; ++j)
                {
                    dp[0, j] = 0;
                }
                dp[0, pair.Value] = 1;
                for (int l = 1; l <= k; ++l)
                {
                    for (int j = 0; j <= pair.Value; ++j)
                    {
                        dp[l, j] = 0;
                        for (int r = j; r <= pair.Value; ++r)
                        {
                            int rr = BinPow(r + 1, MOD - 2);
                            dp[l, j] = Add(dp[l, j], Mult(rr, dp[l - 1, r]));
                        }
                    }
                }
                int M = 0;
                int p = 1;
                int v = (int)(pair.Key % MOD);
                for (int j = 0; j <= pair.Value; ++j)
                {
                    M = Add(M, Mult(dp[k, j], p));
                    p = Mult(p, v);
                }
                result = Mult(result, M);
            }
            Console.WriteLine(result);
        }
    }
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
	    long mod = 1000000007;
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long K = long.Parse(str[1]);
		var Elist = enum_div(N);
		Elist.Sort((x,y)=>(int)x-(int)y);
		var Plist = PrimeFactors(N);
		Plist.Sort((x,y)=>(int)x-(int)y);
		var PAlist = new List<long[]>();
		long t = Plist[0];
		long ct = 1;
		for(var i=1;i<Plist.Count;i++){
			if(t!=Plist[i]){
				PAlist.Add(new long[2]{t,ct});
				t = Plist[i];
				ct = 1;
			} else {
				ct++;
			}
		}
		PAlist.Add(new long[2]{t,ct});
		long[]Pma = new long[PAlist.Count];
		long[]Qma = new long[PAlist.Count];
		long[]PQma = new long[PAlist.Count];
		for(var i=0;i<PAlist.Count;i++){
			long[] Pa = new long[PAlist[i][1]+1];
			long[] Qa = new long[PAlist[i][1]+1];
			long[] PQa = new long[PAlist[i][1]+1];
			for(var j=0;j<=PAlist[i][1];j++){
				Pa[j] = 1;
				Qa[j] = PAlist[i][1]+1;
				PQa[j] = Pa[j] * Mpow(Qa[j],mod-2,mod) % mod;
			}
			for(var k=1;k<K;k++){
			    for(var j=1;j<=PAlist[i][1];j++){
				    for(var h=0;h<j;h++){
					    long Pa0 = Pa[h];
					    long Qa0 = Qa[h];
					    long Pa1 = Pa[j];
					    long Qa1 = Qa[j]*(j+1);
					    Pa[h] = (Pa0*Qa1+Pa1*Qa0) % mod;
					    Qa[h] = (Qa0*Qa1) % mod;
						PQa[h] = PQa[h] + PQa[j] * Mpow(j+1,mod-2,mod) % mod;
    				}
				    Qa[j] = Qa[j]*(j+1);
					PQa[j] = PQa[j] * Mpow(j+1,mod-2,mod) % mod;
			    }
			}
			long Psum = Pa[0];
			long Qsum = Qa[0];
			long PQsum = PQa[0];
			for(var j=1;j<=PAlist[i][1];j++){
				long Pa0 = Psum;
				long Qa0 = Qsum;
				long PQa0 = PQsum;
				long Pn = 1;
				for(var a=0;a<j;a++){
				    Pn = Pn * PAlist[i][0] % mod;
				}
				Psum = (Pa0*Qa[j]+Pn*Pa[j]*Qa0) % mod;
				Qsum = (Qa0 * Qa[j]) % mod;
				PQsum = (PQsum + Pn*PQa[j]) % mod;
			}
			Pma[i] = Psum;
			Qma[i] = Qsum;
			PQma[i] = PQsum;
		}
		long Pm = Pma[0];
		long Qm = Qma[0];
		long PQm = PQma[0];
		for(var i=1;i<PAlist.Count;i++){
		    Pm *= Pma[i] % mod;
		    Qm *= Qma[i] % mod;
			PQm = PQm * PQma[i] % mod;
		}
	    Console.WriteLine(PQm);
	}

	public static List<long> PrimeFactors(long n){
		long i = 2;
		long tmp = n;
		var list = new List<long>();
		while(i*i<=n){
			if(tmp%i==0){
				tmp /= i;
				list.Add(i);
			} else {
				i++;
			}
		}
		if(tmp != 1){
			list.Add(tmp);
		}
		return list;
	}
	public static List<long> enum_div(long n){
		long tmp = n;
		var list = new List<long>();
		for(var i=1;i*i<=n;i++){
			if(n%i==0){
				list.Add(i);
				if(i*i!=n){
					list.Add(n/i);
				}
			}
		}
		return list;
	}
	public static long Mpow(long x,long n,long m)
	{
		long ans = 1;
		while(n > 0){
			if(n % 2 == 1){
				ans = ans * x % m;
				n -= 1;
			}
			x = x * x % m;
			n /= 2;
		}
		return ans;
	}
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
	    long mod = 1000000007;
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long K = long.Parse(str[1]);
		if(N==1){
		    Console.WriteLine(1);
		} else {
		    var Plist = PrimeFactors(N);
		    Plist.Sort((x,y)=>(int)x-(int)y);
		    var PAlist = new List<long[]>();
		    long t = Plist[0];
		    long ct = 1;
    		for(var i=1;i<Plist.Count;i++){
	    		if(t!=Plist[i]){
		    		PAlist.Add(new long[2]{t,ct});
			    	t = Plist[i];
			    	ct = 1;
    			} else {
	    			ct++;
			    }
		    }
    		PAlist.Add(new long[2]{t,ct});
    		int Pct = PAlist.Count;
	    	long[]PQma = new long[PAlist.Count];
		    for(var i=0;i<Pct;i++){
		        long Pi1 = PAlist[i][1];
    			long[] PQa = new long[Pi1+1];
	    		for(var j=0;j<=Pi1;j++){
		    		PQa[j] = Mpow(Pi1+1,mod-2,mod) % mod;
			    }
			    for(var k=1;k<K;k++){
			        for(var j=1;j<=Pi1;j++){
				        for(var h=0;h<j;h++){
						    PQa[h] += PQa[j] * Mpow(j+1,mod-2,mod);
						    PQa[h] %= mod;
        				}
	    				PQa[j] *= Mpow(j+1,mod-2,mod);
	    				PQa[j] %= mod;
		    	    }
			    }
			    long PQsum = PQa[0];
			    for(var j=1;j<=Pi1;j++){
				    long Pn = 1;
				    for(var a=0;a<j;a++){
				        Pn = Pn * PAlist[i][0] % mod;
    				}
	    			PQsum = (PQsum + Pn*PQa[j]) % mod;
		    	}
			    PQma[i] = PQsum;
    		}
	    	long PQm = PQma[0];
		    for(var i=1;i<Pct;i++){
			    PQm = PQm * PQma[i] % mod;
    		}
	        Console.WriteLine(PQm);
		}
	}

	public static List<long> PrimeFactors(long n){
		long i = 2;
		long tmp = n;
		var list = new List<long>();
		while(i*i<=n){
			if(tmp%i==0){
				tmp /= i;
				list.Add(i);
			} else {
				i++;
			}
		}
		if(tmp != 1){
			list.Add(tmp);
		}
		return list;
	}
	public static long Mpow(long x,long n,long m)
	{
		long ans = 1;
		while(n > 0){
			if(n % 2 == 1){
				ans = ans * x % m;
				n -= 1;
			}
			x = x * x % m;
			n /= 2;
		}
		return ans;
	}
}


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

using static util;
using P = pair<int, int>;

using Binary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.ParameterExpression,
                           System.Linq.Expressions.BinaryExpression>;
using Unary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.UnaryExpression>;

class Program
{
    static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static Scan sc = new Scan();
    const int M = 1000000007;
    const int M2 = 998244353;
    const long LM = (long)1e18;
    const double eps = 1e-11;
    static readonly int[] dd = { 0, 1, 0, -1, 0 };
    const string dstring = "RDLU";
    static void Main()
    {
        long n;
        int k;
        sc.Multi(out n, out k);
        var lis = new List<pair<long, int>>();
        long m = n;
        for (long i = 2; i * i <= m; i++)
        {
            int c = 0;
            while (m % i == 0) {
                m /= i;
                ++c;
            }
            if (c > 0) {
                lis.Add(make_pair(i, c));
            }
        }
        if (m > 1) {
            lis.Add(make_pair(m, 1));
        }
        long ans = n % M;
        var inv = new long[100];
        for (int i = 1; i < 100; i++)
        {
            inv[i] = MyMath.inv(i);
        }
        foreach (var item in lis)
        {
            int c = item.v2;
            var dp = new long[c + 1];
            dp[0] = 1;
            for (int i = 0; i < k; i++)
            {
                var nex = new long[c + 1];
                for (int j = 0; j <= c; j++)
                {
                    for (int l = 0; l <= j; l++)
                    {
                        nex[j] = (nex[j] + dp[l] * inv[c - l + 1]) % M;
                    }
                }
                dp = nex;
            }
            long a = 0;
            long b = 1;
            for (int i = 0; i < c + 1; i++)
            {
                a = (a + dp[i] * MyMath.inv(b)) % M;
                b = b * (item.v1 % M) % M;
            }
            ans = ans * a % M;
        }
        Prt(ans);
        sw.Flush();
    }

    static void DBG(string a) => Console.WriteLine(a);
    static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a));
    static void DBG(params object[] a) => DBG(string.Join(" ", a));
    static void Prt(string a) => sw.WriteLine(a);
    static void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a));
    static void Prt(params object[] a) => Prt(string.Join(" ", a));
}
class pair<T, U> : IComparable<pair<T, U>>
{
    public T v1;
    public U v2;
    public pair(T v1, U v2) {
        this.v1 = v1;
        this.v2 = v2;
    }
    public int CompareTo(pair<T, U> a) {
        int c = Comparer<T>.Default.Compare(v1, a.v1);
        return c != 0 ? c : Comparer<U>.Default.Compare(v2, a.v2);
    }
    public override string ToString() => v1 + " " + v2;
    public void Deconstruct(out T a, out U b) {
        a = v1; b = v2;
    }
}
static class util
{
    public static pair<T, T> make_pair<T>(this IList<T> l) => make_pair(l[0], l[1]);
    public static pair<T, U> make_pair<T, U>(T v1, U v2) => new pair<T, U>(v1, v2);
    public static T sq<T>(T a) => Operator<T>.Multiply(a, a);
    public static T Max<T>(params T[] a) => a.Max();
    public static T Min<T>(params T[] a) => a.Min();
    public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;
    public static void swap<T>(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }
    public static void swap<T>(this IList<T> a, int i, int j) where T : struct { var t = a[i]; a[i] = a[j]; a[j] = t; }
    public static T[] copy<T>(this IList<T> a) {
        var ret = new T[a.Count];
        for (int i = 0; i < a.Count; i++) ret[i] = a[i];
        return ret;
    }
}
static class Operator<T>
{
    static readonly ParameterExpression x = Expression.Parameter(typeof(T), "x");
    static readonly ParameterExpression y = Expression.Parameter(typeof(T), "y");
    public static readonly Func<T, T, T> Add = Lambda(Expression.Add);
    public static readonly Func<T, T, T> Subtract = Lambda(Expression.Subtract);
    public static readonly Func<T, T, T> Multiply = Lambda(Expression.Multiply);
    public static readonly Func<T, T, T> Divide = Lambda(Expression.Divide);
    public static readonly Func<T, T> Plus = Lambda(Expression.UnaryPlus);
    public static readonly Func<T, T> Negate = Lambda(Expression.Negate);
    public static Func<T, T, T> Lambda(Binary op) => Expression.Lambda<Func<T, T, T>>(op(x, y), x, y).Compile();
    public static Func<T, T> Lambda(Unary op) => Expression.Lambda<Func<T, T>>(op(x), x).Compile();
}

class Scan
{
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public string Str => Console.ReadLine().Trim();
    public pair<T, U> Pair<T, U>() where T : IComparable<T> where U : IComparable<U> {
        T a; U b;
        Multi(out a, out b);
        return new pair<T, U>(a, b);
    }
    public P P {
        get {
            int a, b;
            Multi(out a, out b);
            return new P(a, b);
        }
    }
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();
    public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
                       : eq<T, long>()   ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>()   ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    public void Multi<T>(out T a) => a = cv<T>(Str);
    public void Multi<T, U>(out T a, out U b)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); }
    public void Multi<T, U, V>(out T a, out U b, out V c)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); }
    public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); }
    public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); }
    public void Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); f = cv<Y>(ar[5]); }
}

static class MyMath
{
    public static long Mod = 1000000007;
    public static bool isprime(long a) {
        if (a < 2) return false;
        for (long i = 2; i * i <= a; i++) if (a % i == 0) return false;
        return true;
    }
    public static bool[] sieve(int n) {
        var p = new bool[n + 1];
        for (int i = 2; i <= n; i++) p[i] = true;
        for (int i = 2; i * i <= n; i++) if (p[i]) for (int j = i * i; j <= n; j += i) p[j] = false;
        return p;
    }
    public static List<int> getprimes(int n) {
        var prs = new List<int>();
        var p = sieve(n);
        for (int i = 2; i <= n; i++) if (p[i]) prs.Add(i);
        return prs;
    }
    public static long pow(long a, long b) {
        a %= Mod;
        if (a == 0) return 0;
        if (b == 0) return 1;
        var t = pow(a, b / 2);
        if ((b & 1) == 0) return t * t % Mod;
        return t * t % Mod * a % Mod;
    }
    public static long inv(long a) => pow(a, Mod - 2);
    public static long gcd(long a, long b) {
        while (b > 0) { var t = a % b; a = b; b = t; } return a;
    }
    // a x + b y = gcd(a, b)
    public static long extgcd(long a, long b, out long x, out long y) {
        long g = a; x = 1; y = 0;
        if (b > 0) { g = extgcd(b, a % b, out y, out x); y -= a / b * x; }
        return g;
    }
    public static long lcm(long a, long b) => a / gcd(a, b) * b;

    static long[] facts, invs;
    public static void setfacts(int n) {
        facts = new long[n + 1];
        facts[0] = 1;
        for (int i = 1; i <= n; i++) facts[i] = facts[i - 1] * i % Mod;
        invs = new long[n + 1];
        invs[n] = inv(facts[n]);
        for (int i = n; i > 0 ; i--) invs[i - 1] = invs[i] * i % Mod;
    }
    public static long comb(long n, long r) {
        if (n < 0 || r < 0 || r > n) return 0;
        if (facts != null && facts.Length > n) return facts[n] * invs[r] % Mod * invs[n - r] % Mod;
        if (n - r < r) r = n - r;
        long numer = 1, denom = 1;
        for (long i = 0; i < r; i++) {
            numer = numer * ((n - i) % Mod) % Mod;
            denom = denom * ((i + 1) % Mod) % Mod;
        }
        return numer * inv(denom) % Mod;
    }
    public static long[][] getcombs(int n) {
        var ret = new long[n + 1][];
        for (int i = 0; i <= n; i++) {
            ret[i] = new long[i + 1];
            ret[i][0] = ret[i][i] = 1;
            for (int j = 1; j < i; j++) ret[i][j] = (ret[i - 1][j - 1] + ret[i - 1][j]) % Mod;
        }
        return ret;
    }
    // nC0, nC2, ..., nCn
    public static long[] getcomb(int n) {
        var ret = new long[n + 1];
        ret[0] = 1;
        for (int i = 0; i < n; i++) ret[i + 1] = ret[i] * (n - i) % Mod * inv(i + 1) % Mod;
        return ret;
    }
    public static bool nextPermutation<T>(IList<T> p) where T : struct, IComparable<T> {
        for (int i = p.Count - 2; i >= 0; --i) {
            if (p[i].CompareTo(p[i + 1]) < 0) {
                for (int j = p.Count - 1; ; --j) {
                    if (p[j].CompareTo(p[i]) > 0) {
                        p.swap(i, j);
                        for(++i, j = p.Count - 1; i < j; ++i, --j)
                            p.swap(i, j);

                        return true;
                    }
                }
            }
        }
        return false;
    }
    public static bool nextPermutation<T>(IList<T> p, Comparison<T> compare) where T : struct {
        for (int i = p.Count - 2; i >= 0; --i) {
            if (compare(p[i], p[i + 1]) < 0) {
                for (int j = p.Count - 1; ; --j) {
                    if (compare(p[j], p[i]) > 0) {
                        p.swap(i, j);
                        for (++i, j = p.Count - 1; i < j; ++i, --j)
                            p.swap(i, j);

                        return true;
                    }
                }
            }
        }
        return false;
    }
}


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

namespace Codeforces
{
    public class MakotoAndABlackboard
    {
        const int MOD = 1000000000 + 7;

        ModMath math = new ModMath(MOD);

        public static void Main()
        {
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            new MakotoAndABlackboard().Solve(Console.In, sw);
            sw.Flush();
        }

        public void Solve(TextReader tr, TextWriter tw)
        {
            var a = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            tw.WriteLine(Solve(a[0], a[1]));
        }

        public int Solve(long n, int k)
        {
            var res = 1L;
            for (long a = 2; a * a <= n; a++)
            {
                var np = GetNumPrime(a, n);
                var numPrime = np.Item1;
                n = np.Item2;
                if (numPrime == 0)
                {
                    continue;
                }

                res = math.Mul(res, Calculate(k, a, numPrime));
            }
            if (n != 1)
            {
                res = math.Mul(res, Calculate(k, n, 1));
            }
            return (int)(res);
        }

        private long Calculate(int k, long a, long numPrime)
        {
            var dp = new long[k + 1, numPrime + 1];
            dp[0, numPrime] = 1;
            for (int i = 1; i <= k; i++)
            {
                for (int j = 0; j <= numPrime; j++)
                {
                    for (int l = j; l <= numPrime; l++)
                    {
                        dp[i, j] = math.Add(dp[i, j], math.Div(dp[i - 1, l], l + 1));
                    }
                }
            }

            var t = 0L;
            for (int j = 0; j <= numPrime; j++)
            {
                t = math.Add(t, math.Mul(dp[k, j], math.Pow(a, j)));
            }
            return t;
        }

        Tuple<long, long> GetNumPrime(long a, long n)
        {
            var numPrime = 0L;
            while (n % a == 0)
            {
                numPrime++;
                n /= a;
            }
            return Tuple.Create(numPrime, n);
        }
    }
}


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

namespace Codeforces
{
    public class ModMath
    {
        private int mod;

        public ModMath(int mod)
        {
            this.mod = mod;
        }

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

        public long Div(long l, long r)
        {
            return l * Pow(r, mod - 2) % mod;
        }

        internal long Add(long v1, long v2)
        {
            return (v1 + v2) % mod;
        }

        internal long Mul(long v1, long v2)
        {
            return v1 * v2 % mod;
        }
    }

    public class MakotoAndABlackboard
    {
        const int MOD = 1000000000 + 7;

        ModMath math = new ModMath(MOD);

        public static void Main()
        {
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            new MakotoAndABlackboard().Solve(Console.In, sw);
            sw.Flush();
        }

        public void Solve(TextReader tr, TextWriter tw)
        {
            var a = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            tw.WriteLine(Solve(a[0], a[1]));
        }

        public int Solve(long n, int k)
        {
            var res = 1L;
            for (long a = 2; a * a <= n; a++)
            {
                var np = GetNumPrime(a, n);
                var numPrime = np.Item1;
                n = np.Item2;
                if (numPrime == 0)
                {
                    continue;
                }

                res = math.Mul(res, Calculate(k, a, numPrime));
            }
            if (n != 1)
            {
                res = math.Mul(res, Calculate(k, n, 1));
            }
            return (int)(res);
        }

        private long Calculate(int k, long a, long numPrime)
        {
            var dp = new long[k + 1, numPrime + 1];
            dp[0, numPrime] = 1;
            for (int i = 1; i <= k; i++)
            {
                for (int j = 0; j <= numPrime; j++)
                {
                    for (int l = j; l <= numPrime; l++)
                    {
                        dp[i, j] = math.Add(dp[i, j], math.Div(dp[i - 1, l], l + 1));
                    }
                }
            }

            var t = 0L;
            for (int j = 0; j <= numPrime; j++)
            {
                t = math.Add(t, math.Mul(dp[k, j], math.Pow(a, j)));
            }
            return t;
        }

        Tuple<long, long> GetNumPrime(long a, long n)
        {
            var numPrime = 0L;
            while (n % a == 0)
            {
                numPrime++;
                n /= a;
            }
            return Tuple.Create(numPrime, n);
        }
    }
}


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

namespace Codeforces
{
    public class MakotoAndABlackboard
    {
        public class ModMath
        {
            private int mod;
            Dictionary<Tuple<long, int>, long> cache = new Dictionary<Tuple<long, int>, long>();

            public ModMath(int mod)
            {
                this.mod = mod;
            }

            public long Pow(long x, int n)
            {
                var key = Tuple.Create(x, n);
                if (cache.ContainsKey(key))
                {
                    return cache[key];
                }
                long res = 1;
                for (; n > 0; n >>= 1)
                {
                    if ((n & 1) > 0)
                    {
                        res = res * x % mod;
                    }
                    x = x * x % mod;
                }
                return cache[key] = res;
            }

            public long Div(long l, long r)
            {
                return l * Pow(r, mod - 2) % mod;
            }

            internal long Add(long v1, long v2)
            {
                return (v1 + v2) % mod;
            }

            internal long Mul(long v1, long v2)
            {
                return v1 * v2 % mod;
            }
        }

        const int MOD = 1000000000 + 7;

        ModMath math = new ModMath(MOD);

        public static void Main()
        {
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            new MakotoAndABlackboard().Solve(Console.In, sw);
            sw.Flush();
        }

        public void Solve(TextReader tr, TextWriter tw)
        {
            var a = tr.ReadLine().Split();
            tw.WriteLine(Solve(long.Parse(a[0]), int.Parse(a[1])));
        }

        public int Solve(long n, int k)
        {
            var res = 1L;
            for (long a = 2; a * a <= n; a++)
            {
                var np = GetNumPrime(a, n);
                var numPrime = np.Item1;
                n = np.Item2;
                if (numPrime == 0)
                {
                    continue;
                }

                res = math.Mul(res, Calculate(k, a, numPrime));
            }
            if (n != 1)
            {
                res = math.Mul(res, Calculate(k, n, 1));
            }
            return (int)(res);
        }

        private long Calculate(int k, long a, long numPrime)
        {
            var current = 0;
            var next = 1;
            var dp = new long[2, numPrime + 1];
            dp[current, numPrime] = 1;
            for (int i = 1; i <= k; i++)
            {
                for (int j = 0; j <= numPrime; j++)
                {
                    dp[next, j] = 0;
                    for (int l = j; l <= numPrime; l++)
                    {
                        dp[next, j] = math.Add(dp[next, j], math.Div(dp[current, l], l + 1));
                    }
                }
                current ^= 1;
                next ^= 1;
            }

            var t = 0L;
            for (int j = 0; j <= numPrime; j++)
            {
                t = math.Add(t, math.Mul(dp[current, j], math.Pow(a, j)));
            }
            return t;
        }

        Tuple<long, long> GetNumPrime(long a, long n)
        {
            var numPrime = 0L;
            while (n % a == 0)
            {
                numPrime++;
                n /= a;
            }
            return Tuple.Create(numPrime, n);
        }
    }
}


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

namespace Pipeline
{
    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 = Next();
            long k = Next();

            long all = k + (k - 1)*(k - 2)/2;
            if (all < n)
                writer.WriteLine("-1");
            else if (n <= k)
            {
                writer.WriteLine("1");
            }
            else
            {
                long l = 1, r = k - 1;

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

                    if (all - m*(m - 1)/2 < n)
                        r = m;
                    else l = m + 1;
                }
                writer.WriteLine(k - l + 1);
            }

            writer.Flush();
        }

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


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

namespace _725B
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int L = S.Length; int A2 = 0;
            char C = char.Parse(S.Substring(L-1));
            int N = int.Parse(S.Substring(0,L-1));

            switch (C)
            {
                case 'f':
                    A2 = 1;
                    break;
                case 'e':
                    A2 = 2;
                    break;
                case 'd':
                    A2 = 3;
                    break;
                case 'a':
                    A2 = 4;
                    break;
                case 'b':
                    A2 = 5;
                    break;
                case 'c':
                    A2 = 6;
                    break;

            }

            int A1 = 16 * ((N - 1) / 4);
            int A3 = 0;
            if ((N % 2) == 0) A3 = 7;
            int T = A1 + A2 + A3;

            Console.WriteLine(T);

        }
    }
}


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

namespace ConsoleApplication1
{
    class CanadaCup2
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader(@"D:\Sergey\Code\1.txt"));

            string ns = Console.ReadLine();
            int n = int.Parse(ns.Substring(0, ns.Length - 1));
            char s = ns[ns.Length - 1];
            int c = s - 'a';
            int[] d = new int[] { 3, 4, 5, 2, 1, 0 };
            int a = (n - 1) % 2;
            int b = (n - 1) / 4;
            //if (b > 1)
            //    b -= 2;

            int e = b * 16;
            if (a > 0)
                e+=7;
            e += d[c] + 1;

            Console.WriteLine(e);

        } // Main
    }
}


using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main()
        {
            //var s = Console.ReadLine().Split(' ');
            var str = Console.ReadLine();
            var k = int.Parse(str.Substring(0,str.Length-1));
            byte g = 0;
            switch (str[str.Length - 1])
            {
                case 'a':
                    g = 4;
                    break;
                case 'b':
                    g = 5;
                    break;
                case 'c':
                    g = 6;
                    break;
                case 'd':
                    g = 3;
                    break;
                case 'e':
                    g = 2;
                    break;
                case 'f':
                    g = 1;
                    break;
            }
            var result = k/5*16;
            k %= 4;
            if (k%2 == 0)
            {
                result += 7 + g;
            }
            else result += g;
            Console.WriteLine(result);
        }
    }
}


using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main()
        {
            //var s = Console.ReadLine().Split(' ');
            var str = Console.ReadLine();
            var k = long.Parse(str.Substring(0,str.Length-1));
            byte g = 0;
            switch (str[str.Length - 1])
            {
                case 'a':
                    g = 4;
                    break;
                case 'b':
                    g = 5;
                    break;
                case 'c':
                    g = 6;
                    break;
                case 'd':
                    g = 3;
                    break;
                case 'e':
                    g = 2;
                    break;
                case 'f':
                    g = 1;
                    break;
            }
            var result = k/5*16;
            k = k%4 == 0 ? 4 : k%4;
            if (k%2 == 0)
            {
                result += 7 + g;
            }
            else result += g;
            Console.WriteLine(result);
        }
    }
}