import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author zodiacLeo
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA
    {
        private int[] rx;
        private int[] ry;
        private int[] dx;
        private int[] dy;

        public void solve(int testNumber, FastScanner in, PrintWriter out)
        {
            int n = in.nextInt();
            dx = new int[n];
            dy = new int[n];
            rx = new int[n];
            ry = new int[n];
            String ns = in.next();
            for (int i = 0; i < n; i++)
            {
                int num = ns.charAt(i) - '0';
                //out.println(num);
                if (num == 0)
                {
                    rx[i] = 3;
                    ry[i] = 1;
                } else
                {
                    rx[i] = (num - 1) / 3;
                    ry[i] = (num - 1) % 3;
                }
                if (i > 0)
                {
                    dx[i] = rx[i] - rx[i - 1];
                    dy[i] = ry[i] - ry[i - 1];
                }
            }

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (i == rx[0] && j == ry[0])
                    {
                        continue;
                    }
                    if (move(i, j))
                    {
                        out.println("NO");
                        return;
                    }
                }
            }
            if (rx[0] != 3 || ry[0] != 1)
            {
                if (move(3, 1))
                {
                    out.println("NO");
                } else
                {
                    out.println("YES");
                }
            } else
            {
                out.println("YES");
            }
        }

        public boolean move(int r1, int c1)
        {
            for (int i = 1; i < dx.length; i++)
            {
                int r2 = r1 + dx[i];
                int c2 = c1 + dy[i];
                if (r2 == 3 && c2 == 1)
                {
                    r1 = r2;
                    c1 = c2;
                    continue;
                }
                if (r2 >= 0 && r2 <= 2 && c2 >= 0 && c2 <= 2)
                {
                    r1 = r2;
                    c1 = c2;
                    continue;
                }
                return false;
            }
            return true;
        }

    }

    static class FastScanner
    {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream is)
        {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

    }
}


import java.io.*;
import java.util.*;

public class C {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	static final int MOD = 1_000_000_009;

	int[] fact, invFact;

	int pow(int a, int b) {
		int res = 1;
		while (b != 0) {
			if ((b & 1) == 1) {
				res = (int)((long) res * a % MOD);
			}
			a = (int)((long)a * a % MOD);
			b >>= 1;
		}
		return res;
	}

	int C(int n, int k) {
		if (n < 0 || k < 0 || k > n)
			return 0;
		return (int)((long)fact[n] * invFact[k] % MOD * invFact[n - k] % MOD);
	}

	void solve() throws IOException {
		int n = nextInt();
		int w = nextInt();
		int b = nextInt();

		fact = new int[n + Math.max(w, b)];
		invFact = new int[fact.length];

		fact[0] = invFact[0] = 1;
		for (int i = 1; i < fact.length; i++) {
			fact[i] = (int)((long)fact[i - 1] * i % MOD);
			invFact[i] = pow(fact[i], MOD - 2);
		}

		int ans = 0;

		for (int lenB = 1; lenB <= n - 2 && lenB <= b; lenB++) {
			int ways = (int)((long)(n - 1 - lenB) * C(b - 1, lenB - 1) % MOD * C(w - 1, n - lenB - 1) % MOD);
//			System.err.println(b + " " + lenB);
//			System.err.println(w + " " + (n - lenB));
			ans += ways;
			if (ans >= MOD)
				ans -= MOD;
		}

		ans = (int)((long)ans * fact[b] % MOD * fact[w] % MOD);
		out.println(ans);
	}

	C() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new C();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}


import java.lang.*;
import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author Mido
 */
public class Test {

    /**
     * @param args the command
     */
    public static int weight(char c)
    {
        c=Character.toLowerCase(c);
        switch(c)
        {
            case 'q': return 9;
            case 'r': return 5;
            case 'b': return 3;
            case 'n': return 3;
            case 'p': return 1;
            case 'k':
            break;
        }
        return 0;
    }
    public static void main(String[] args) {
        int j,i,w,b;
        String ans;
        char c;
        String []a=new String[8];
        Scanner sc=new Scanner(System.in);
       w=b=0;
       for(i=0;i<8;i++) a[i]=sc.next();
       for(i=0;i<8;i++)
       {
           for(j=0;j<8;j++)
           {
               c=a[i].charAt(j);

               if(c!='.')
               {
                   if(c>='a'&&c<='z')b+=weight(c);
                   else w+=weight(c);
               }
           }
       }
       if(w>b)System.out.println("White");
       else if(w<b)System.out.println("Black");
       else System.out.println("Draw");
    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author and_so_on
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            String home = in.next();
            int count = 0;
            for (int i = 0; i < n; i++) {
                count++;
            }

            if (count % 2 == 0) {
                out.println("home");
            } else {
                out.println("contest");
            }
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FCards solver = new FCards();
        solver.solve(1, in, out);
        out.close();
    }

    static class FCards {
        long mod = 998244353;

        long modExp(long x, long y) {
            if (y == 0)
                return 1;
            if (y == 1)
                return x;
            long ret = modExp(x, y >> 1);
            ret = ret * ret % mod;
            if ((y & 1) == 1)
                ret = ret * x % mod;
            return ret;
        }

        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int n = s.nextInt(), m = s.nextInt(), k = s.nextInt();
            //dp[tuple size][number of distinct elements] = number of such tuples
            long[][] dp = new long[k + 1][Math.min(n, k) + 1];
            dp[0][0] = 1;
            for (int i = 1; i <= k; i++) {
                for (int j = 1; j <= Math.min(n, k); j++) {
                    dp[i][j] = (dp[i][j] + dp[i - 1][j] * j % mod) % mod;
                    dp[i][j] = (dp[i][j] + dp[i - 1][j - 1] * (n - j + 1) % mod) % mod;
                }
            }
            long invm = modExp(m, mod - 2);
            long res = 0;
            long prob = 1;
            for (int i = 0; i <= Math.min(n, k); i++) {
                res = (res + dp[k][i] * prob % mod) % mod;
                prob = prob * invm % mod;
            }
            w.println(res);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.*;
public class Eqn {
	public static void main(String[] args)throws IOException {
		BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));
		String s[]=ob.readLine().split(" ");
		int n=Integer.parseInt(s[0]);
		int m=Integer.parseInt(s[1]);
		int c=0;
		for(int i=0;i<=1000;i++) {
			for(int j=0;j<=1000;j++) {
				int x=i*i + j;
				int y=j*j + i;
				if(x==n && y==m)
					c++;
			}
		}
		System.out.println(c);
	}

}


import java.util.Scanner;

public class muhandstick {

    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
           int [] c=new int[6]; int op=0;
           int [] c1=new int[6];
           int count=0,k=-1,k1=-1;
           for(int i=0;i<6;i++)
           {
              c[i]=s.nextInt();
           }
           int p=1;
           for(int i=0;i<6;i++)
           {count=0;
           p=0;
               for(int j=0;j<6;j++)
               {
                   if(c[i]==c[j])
                   {
                    count++;
                    if(count==4)
                    {p=c[j];
                    op=1;
                    break;
                    }
                   }

               }
                if(count==4)
                   {

                       break;
                   }
               }

               if(count==4)
               {
                   for(int i=0;i<6;i++)
                   {
                       if(c[i]!=p)

                       {

                           if(k!=-1)
                           {
                               k1=c[i];
                               break;
                           }
                           k=c[i];
                       }
                   }

                   if(k==k1)
                   {
                       System.out.println("Elephant");
                   }
                   else
                       System.out.println("Bear");

             }
               else
               {
                   System.out.println("Alien");
               }
              }

}


import java.util.*;
public class C {
	Scanner sc = new Scanner(System.in);

	void doIt()
	{
		int n = sc.nextInt();
		UnionFindTree uft = new UnionFindTree(n);
		int k = sc.nextInt();
		for(int i = 0; i < k; i++) {
			int u = sc.nextInt()-1, v = sc.nextInt()-1;
			uft.unite(u, v);
		}
		HashMap<Integer, Integer> grp = new HashMap<Integer, Integer>();
		for(int i = 0; i < n; i++) {
			int root = uft.find(i);
			if(grp.containsKey(root)) {
				grp.put(root, grp.get(root)+1);
			} else {
				grp.put(root, 1);
			}
		}
		int m = sc.nextInt();
		for(int i = 0; i < m; i++) {
			int u = sc.nextInt()-1, v = sc.nextInt()-1;
			int r1 = uft.find(u), r2 = uft.find(v);
			if(r1 == r2) grp.put(r1, 0);
		}
		int ans = 0;
		for(Integer key: grp.keySet()) {
			//System.out.println(key + " " + grp.get(key));
			ans = Math.max(ans, grp.get(key));
		}
		if(ans <= 0) ans = 0;
		System.out.println(ans);

	}
	public static void main(String[] args) {
		new C().doIt();
	}
	class UnionFindTree
	{
		int [] par, rank;
		UnionFindTree(int n)
		{
			par = new int [n];
			rank = new int [n];
			for(int i = 0; i < n; i++) par[i] = i;
		}
		int find (int x) {
			if(par[x] == x) {
				return x;
			} else {
				return par[x] = find(par[x]);
			}
		}
		void unite(int x, int y)
		{
			x = find(x);
			y = find(y);
			if( x == y) return;

			if(rank[x] < rank[y]) {
				par[x] = y;
			} else {
				par[y] = x;
				if (rank[x] == rank[y]) rank[x]++;
			}
		}
		boolean same(int x, int y)
		{
			return find(x) == find(y);
		}
	}
}


//package com.codeforce.challenge;

import java.util.Scanner;

public class CodeForce {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int c = 0;

		while (a <= b) {
			a *= 3;
			b *= 2;
			c++;

		};

		System.out.println(c);
	}
}


import java.util.Scanner;
public class Main {
    Scanner input=new Scanner(System.in);

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
        String arr=input.next();
        int count=0;
        for(int i=0;i<arr.length()-1;i++) {
        	if((arr.charAt(i)=='U'&&arr.charAt(i+1)=='R')||(arr.charAt(i)=='R'&&arr.charAt(i+1)=='U')) {
        		count++;
        		i=i+1;
        	}
        }
        System.out.print(arr.length()-count);
	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.BufferedOutputStream;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author An Almost Retired Guy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        MogohuReaIdol solver = new MogohuReaIdol();
        solver.solve(1, in, out);
        out.close();
    }

    static class MogohuReaIdol {
        void add(TreeSet<Point> set, Point point) {
            Point l = set.lower(point);
            if (l == null) set.add(point);
            else {
                Point r = set.higher(point);
                if (r == null || l.ccw(point, r)) set.add(point);
                else return;
            }
            l = set.lower(point);
            if (l != null) while (true) {
                Point ll = set.lower(l);
                if (ll == null || ll.ccw(l, point)) break;
                set.remove(l);
                l = ll;
            }
            Point r = set.higher(point);
            if (r == null) return;
            while (true) {
                Point rr = set.higher(r);
                if (rr == null || point.ccw(r, rr)) break;
                set.remove(r);
                r = rr;
            }
        }

        boolean test(TreeSet<Point> set, Point point) {
            if (set.contains(point)) return true;
            Point l = set.lower(point);
            if (l == null) return false;
            Point r = set.higher(point);
            if (r == null) return false;
            return !l.ccw(point, r);
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            Point[] sum = minkowskiSum(minkowskiSum(readPolygon(in), readPolygon(in)), readPolygon(in));
            Point[] query = readPolygon(in);
            for (int i = 0; i < query.length; i++) query[i] = query[i].mul(3);
            TreeSet<Point> lower = new TreeSet<>(), upper = new TreeSet<>((i, j) -> j.compareTo(i));
            for (Point P : sum) {
                add(lower, P);
                add(upper, P);
            }
            for (Point P : query) {
                boolean ans = test(lower, P) && test(upper, P);
                out.println(ans ? "YES" : "NO");
            }
        }

        Point[] minkowskiSum(Point[] A, Point[] B) {
            int idxA = 0, idxB = 0;
            for (int i = 1; i < A.length; i++) if (A[i].compareTo(A[idxA]) < 0) idxA = i;
            for (int i = 1; i < B.length; i++) if (B[i].compareTo(B[idxB]) < 0) idxB = i;
            Point[] ans = new Point[A.length + B.length];
            Point P = A[idxA].add(B[idxB]);
            for (int i = 0, j = 0; i < A.length || j < B.length; ) {
                ans[i + j] = P;
                int I = idxA + i, J = idxB + j;
                Point U = new Point(A[I % A.length], A[(I + 1) % A.length]), V = new Point(B[J % B.length], B[(J + 1) % B.length]);
                if (j == B.length || (i < A.length && U.cross(V) >= 0)) {
                    P = P.add(U);
                    i++;
                } else {
                    P = P.add(V);
                    j++;
                }
            }
            return ans;
        }

        Point[] readPolygon(InputReader in) {
            int n = in.nextInt();
            Point[] ans = new Point[n];
            for (int i = 0; i < n; i++) ans[i] = new Point(in.nextInt(), in.nextInt());
            return ans;
        }

        class Point extends ConvexHull.Point implements Comparable<Point> {
            Point(int x, int y) {
                super(x, y);
            }

            Point(Point A, Point B) {
                this(B.x - A.x, B.y - A.y);
            }

            public int compareTo(Point that) {
                int cmp = Integer.compare(this.x, that.x);
                if (cmp != 0) return cmp;
                return Integer.compare(this.y, that.y);
            }

            long cross(Point that) {
                return (long) this.x * that.y - (long) this.y * that.x;
            }

            Point add(Point that) {
                return new Point(this.x + that.x, this.y + that.y);
            }

            Point mul(int factor) {
                return new Point(x * factor, y * factor);
            }

            boolean ccw(Point A, Point B) {
                Point U = new Point(A.x - x, A.y - y), V = new Point(B.x - x, B.y - y);
                long cross = (long) U.x * V.y - (long) U.y * V.x;
                return cross > 0;
            }

        }

    }

    static class ConvexHull {
        public static class Point {
            public final int x;
            public final int y;

            public Point(int x, int y) {
                this.x = x;
                this.y = y;
            }

        }

    }

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(new BufferedOutputStream(outputStream));
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public void close() {
            super.close();
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }
}


import java.io.*;
import java.util.StringTokenizer;

public class Main {
    static final int mod = (int) 1e9 + 7;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int a = sc.nextInt(), b = sc.nextInt(), n = sc.nextInt();
        int[] fac = new int[n + 1];
        fac[0] = 1;
        for (int i = 1; i <= n; i++)
            fac[i] = (int) ((1l*fac[i - 1] * i) % mod);
        int ans = 0;
        for (int as = 0; as <= n; as++) {
            int bs = n - as;
            int sum = as * a + bs * b;
            if (!checkGood(sum, a, b)) continue;
            ans = (int) ((ans + ((1l * fac[n] * modInverse(fac[as])) % mod * modInverse(fac[bs]))) % mod);
        }
        out.println(ans);
        out.close();
        out.flush();
    }

    static boolean checkGood(int n, int a, int b) {
        while (n != 0) {
            int cur = n % 10;
            if (cur != a && cur != b) return false;
            n /= 10;
        }
        return true;
    }

    static int modInverse(int n) {
        int res = 1;
        int e = mod - 2;
        while (e > 0) {
            if ((e & 1) == 1) res = (int) ((1l*res * n) % mod);
            n = (int) ((1l * n * n) % mod);
            e >>= 1;
        }
        return (res % mod);
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}


import java.io.*;
import java.util.*;

public class c {
	public static void main(String[] args) { new c(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int n, e, o;
	int[] p;
	boolean[] has;
	int[][][][] dp;

	c() {
		n = in.nextInt();
		p = new int[n + 1];
		has = new boolean[n + 1];
		for (int i = 0; i < n; i++)
			has[p[i] = in.nextInt()] = true;

		e = 0; o = 0;
		for (int i = 1; i <= n; i++) {
			if (has[i]) continue;
			if ((i & 1) == 0) e++;
			else o++;
		}

		// dp(idx, parity of idx - 1, o, e)
		dp = new int[2][e + 1][o + 1][n];
		for (int i = 0; i < 2; i++)
			for (int j = 0; j <= e; j++)
				for (int k = 0; k <= o; k++)
					Arrays.fill(dp[i][j][k], -1);

		out.println(dp(0, e, o, 0));

		out.close();
	}

	int dp(int par, int remE, int remO, int idx) {
		if (idx == n) return 0;
		if (dp[par][remE][remO][idx] != -1)
			return dp[par][remE][remO][idx];

		int ans = n + 1;
		if (p[idx] != 0) {
			int pd = (p[idx] & 1);
			if (idx == 0) ans = dp(pd, remE, remO, idx + 1);
			else if (pd == par) ans = dp(pd, remE, remO, idx + 1);
			else ans = 1 + dp(pd, remE, remO, idx + 1);
		}
		else {
			if (remE > 0) {
				if (idx == 0) ans = min(ans, dp(0, remE - 1, remO, idx + 1));
				else if (par == 0) ans = min(ans, dp(0, remE - 1, remO, idx + 1));
				else ans = min(ans, 1 + dp(0, remE - 1, remO, idx + 1));
			}
			if (remO > 0) {
				if (idx == 0) ans = min(ans, dp(1, remE, remO - 1, idx + 1));
				else if (par == 1) ans = min(ans, dp(1, remE, remO - 1, idx + 1));
				else ans = min(ans, 1 + dp(1, remE, remO - 1, idx + 1));
			}
		}

		return dp[par][remE][remO][idx] = ans;
	}

	int abs(int x) { if (x < 0) return -x; return x; }
	long abs(long x) { if (x < 0) return -x; return x; }
	int max(int x, int y) { if (x < y) return y; return x; }
	int min(int x, int y) { if (x > y) return y; return x; }
	long max(long x, long y) { if (x < y) return y; return x; }
	long min(long x, long y) { if (x > y) return y; return x; }

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }

		void intArr(int sz, int[] x) { for (int i = 0; i < sz; i++) x[i] = nextInt(); }
		void longArr(int sz, long[] x) { for (int i = 0; i < sz; i++) x[i] = nextLong(); }
		void doubleArr(int sz, double[] x) { for (int i = 0; i < sz; i++) x[i] = nextDouble(); }
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class H {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		BigInteger N = BigInteger.valueOf(n);
		BigInteger ret = BigInteger.ONE;
		for (int i = 0; i < 5; i++) {
			ret = ret.multiply(N.subtract(BigInteger.valueOf(i)));
			ret = ret.multiply(N.subtract(BigInteger.valueOf(i)));
		}
		BigInteger divide = ret.divide(BigInteger.valueOf(120));
		System.out.println(divide);
	}
}


import java.util.Scanner;

public class Panoramixs_Prediction {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        Scanner in=new Scanner(System.in);
        int a[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,51};
        int n=in.nextInt();
        int m=in.nextInt();
                int i;
        for( i=0;a[i]!=n;i++);
        if(a[i+1]==m)
        System.out.println("YES");
        else
            System.out.println("NO");

    }}


import java.util.Scanner;

public class Nineteen {

	public static void main(String[] args) {
		int n_nineteens, nineteen[];// 0-n, 1-i, 2-e, 3-t
		String in;
		Scanner keyboard = new Scanner(System.in);
		in = keyboard.nextLine();
		nineteen = new int[4];
		for (int i = 0; i < in.length(); i++) {
			switch (in.charAt(i)) {
			case 'n':
				nineteen[0]++;
				break;
			case 'i':
				nineteen[1]++;
				break;
			case 'e':
				nineteen[2]++;
				break;
			case 't':
				nineteen[3]++;
				break;
			}
		}
		n_nineteens = nineteen[3]; // Number of 't's
		if (nineteen[2] / 3 < n_nineteens) // Number of 'e's
			n_nineteens = nineteen[2] / 3;
		if (nineteen[1] < n_nineteens) // Number of 'i's
			n_nineteens = nineteen[1];
		if ((nineteen[0] - 1) / 2 < n_nineteens) // Number of 't's
			n_nineteens = (nineteen[0] - 1) / 2;
		System.out.println(n_nineteens);

		keyboard.close();
	}

}


import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String [] args) {
        Scanner scan = new Scanner(System.in);
        String line = scan.nextLine();
        String[] parts = line.split(" ");
        int n = Integer.parseInt(parts[0]);
        int k = Integer.parseInt(parts[1]);
        String path = scan.nextLine();
        int grassIndex = 0;
        int treasureIndex = 0;
        for(int i = 0; i < n; i++) {
            char c = path.charAt(i);
            if(c == 'G') {
                grassIndex = i;
            }
            else if(c == 'T') {
                treasureIndex = i;
            }
        }
        String s = helper(path, grassIndex, treasureIndex, k);
        System.out.println(s);
    }
    private static String helper(String path, int index, int indexTwo, int k) {
        int curIndex = index;
        int destIndex = indexTwo;
        if(curIndex < destIndex) {
            while(curIndex + k < path.length()) {
                curIndex += k;
                char c = path.charAt(curIndex);
                if(c == '#') {
                    return "NO";
                }
                else if(c == 'T') {
                    return "YES";
                }
            }
        }
        else {
            while(curIndex - k >= 0) {
                curIndex -= k;
                char c = path.charAt(curIndex);
                if(c == '#') {
                    return "NO";
                }
                else if(c == 'T') {
                    return "YES";
                }
            }
        }
        return "NO";
    }
}


import java.util.*;

/**
 * Created by mcl on 2017/12/2.
 */
public class Main {

  public static void main(String[] args) {
    new Main().cal();
  }

  int n;
  int p;
  int left;
  int right;
  long[][] fact = null;
  List<Integer[]> list = new ArrayList<>();

  void cal() {
    Scanner in = new Scanner(System.in);
    n = in.nextInt();
    p = in.nextInt();
    left = in.nextInt();
    right = in.nextInt();
    if (p == 1) {
      System.out.println(0);
      return;
    }
    int remain = p;
    for (int i = 2; i * i <= remain; ++ i) {
      if (remain % i == 0) {
        int s = 1;
        while (remain % i == 0) {
          remain /= i;
          s *= i;
        }
        list.add(new Integer[]{i, s});
      }
    }
    if (remain > 1) {
      list.add(new Integer[]{remain, remain});
    }
    fact = new long[list.size()][n + 1];
    for (int i = 0; i < list.size(); ++ i) {
      int mod = list.get(i)[1];
      int prime = list.get(i)[0];
      fact[i][0] = 1;
      for (int j = 1; j <= n; ++ j) {
        fact[i][j] = fact[i][j - 1];
        int t = j;
        while (t % prime == 0) {
          t /= prime;
        }
        fact[i][j] = fact[i][j] * t % mod;
      }
    }
    long result = 0;
    for (int cNum = 0; cNum <= n; ++ cNum) {
      long t = calculate(cNum, (cNum + left + 1) / 2) - calculate(cNum, (cNum + right) / 2 + 1);
      t %= p;
      t *= calculate(n, cNum);
      t %= p;
      result += t;
      result %= p;
    }
    if (result < 0) {
      result += p;
    }
    System.out.println(result);
  }

  long calculate(int n, int m) {
    if (m < 0 || m > n) {
      return 0;
    }
    if (m == 0 || m == n) {
      return 1;
    }
    long[] A = new long[list.size()];
    long[] M = new long[list.size()];
    for (int i = 0; i < list.size(); ++ i) {
      M[i] = list.get(i)[1];
      int t = list.get(i)[0];
      int cnt = count(n, t) - count(m, t) - count(n - m, t);
      A[i] = fact[i][n] * reverse(fact[i][m] * fact[i][n - m] % M[i], M[i]) % M[i]
          * Pow(t, cnt, M[i]) % M[i];
    }
    return modular(A, M)[1];
  }

  static int count(int n, int p) {
    int cnt = 0;
    while (n > 0) {
      cnt += n / p;
      n /= p;
    }
    return cnt;
  }

  static long Pow(long a, long b, long mod) {
    long result = 1;
    while (b > 0) {
      if (b % 2 == 1) {
        result = result * a % mod;
      }
      a = a * a % mod;
      b >>= 1;
    }
    return result;
  }

  static long[] modular(long[] a,long[] m)
  {
    long cura = a[0];
    long curm = m[0];

    for(int i = 1; i < a.length; ++ i)
    {
      long[] result = exGcd(curm, m[i]);
      long d = result[0];
      long x = result[1];
      long c=a[i]-cura;
      if (c % d != 0) {
        return new long[]{0, 0};
      }
      long t = m[i] / d;
      x = (c / d * x % t + t) % t;
      cura = curm * x + cura;
      curm = curm * m[i] / d;
    }
    return new long[]{1, cura};
  }

  static long reverse(long a, long b)
  {
    long[] r = exGcd(a,b);
    return (r[1] % b + b) % b;
  }

  static long[] exGcd(long a,long b)
  {
    if (b == 0)
    {
      return new long[]{a, 1, 0};
    }
    long[] result = exGcd(b, a % b);
    return new long[]{result[0], result[2], result[1] - a / b * result[2]};
  }

}


/*
Setting up my ambitions
Check 'em one at a time, yeah, I made it
Now it's time for ignition
I'm the start, heat it up
They follow, burning up a chain reaction, oh-oh-oh
Go fire it up, oh, oh, no
Assemble the crowd now, now
Line 'em up on the ground
No leaving anyone behind
 */
import static java.lang.Math.*;
import java.util.*;
import java.io.*;
import java.math.*;

public class x1606E
{
    static final long MOD = 998244353L;
    public static void main(String hi[]) throws Exception
    {
        fac = new long[1000];
        invfac = new long[1000];
        fac[0] = invfac[0] = 1L;
        for(int i=1; i < 1000; i++)
        {
            fac[i] = (fac[i-1]*i)%MOD;
            invfac[i] = power(fac[i], MOD-2, MOD);
        }
        long[][] calc = new long[501][501];
        for(int a=0; a <= 500; a++)
            for(int b=0; b <= a; b++)
                calc[a][b] = nCr(a, b);
        BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(infile.readLine());
        int N = Integer.parseInt(st.nextToken());
        int K = Integer.parseInt(st.nextToken());
        long[][] dp = new long[N+1][K+1];
        dp[N][0] = 1L;
        for(int i=N; i >= 2; i--)
            for(int x=0; x < K; x++)
            {
                int d = x+i-1;
                d = min(d, K);
                int lb = x+1;
                int ub = min(K, x+i-1);
                long ways = max(0, ub-lb+1);
                long invWay = power(ways, MOD-2, MOD);
                ways = power(ways, i, MOD);
                for(int j=0; j <= i; j++)
                {
                    long temp = (ways*calc[i][j])%MOD;
                    temp = (temp*dp[i][x])%MOD;
                    dp[j][d] += temp;
                    if(dp[j][d] >= MOD)
                        dp[j][d] -= MOD;
                    ways = (ways*invWay)%MOD;
                }
            }
        long res = 0L;
        for(int k=1; k <= K; k++)
            res += dp[0][k];
        System.out.println(res%MOD);
    }
    static long[] fac;
    static long[] invfac;
    public static long nCr(int a, int b)
    {
        long res = (fac[a]*invfac[b])%MOD;
        return (res*invfac[a-b])%MOD;
    }
    public static long power(long x, long y, long p)
    {
        //0^0 = 1
        long res = 1L;
        x = x%p;
        while(y > 0)
        {
            if((y&1)==1)
                res = (res*x)%p;
            y >>= 1;
            x = (x*x)%p;
        }
        return res;
    }
}
/*
dp[i][x] = i currently alive, each taken x damage, and n-i dead (need to be assigned)
dp[j <= i][d == x+i-1] += dp[i][x]*nCr(i, j)*(# of values such that j+1 <= v <= i-1)^(i-j)
 */


import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws Exception {
		long time = System.nanoTime();

		int n = next();
		int k = next();

		int mod = 1000000007;

		int[] d = new int[k];
		int count = 0;
		int kol = 1;
		for (int i = 0; i < k; i++) kol *= k;
		for (int i = 0; i < kol; i++) {
//			for (int j = 0; j < k; j++) System.out.print(d[j] + " ");
//			System.out.println();
			int t = k - 1;
			while (t >= 0 && d[t] == k - 1) {
				d[t] = 0;
				t--;
			}
			if (t >= 0) d[t]++;

			boolean flag = true;
			for (int j = 0; j < k && flag; j++) {
//				System.out.println(j);
				int x = d[j];
				boolean[] w = new boolean[k];
				while (x != 0 && !w[x]) {
					w[x] = true;
					x = d[x];
				}
				if (x != 0) flag = false;
			}
			if (flag) count++;
		}
		for (int i = k; i < n; i++) count = (int)(1L * count * (n - k) % mod);

		out.println(count);

//		System.out.println((System.nanoTime() - time)* 1e-9);
		out.close();
	}
	static PrintWriter out = new PrintWriter(System.out);

	static BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer in = new StringTokenizer("");

	static String nextToken() throws Exception {
		if (!in.hasMoreTokens()) in = new StringTokenizer(bufferedreader.readLine());
		return in.nextToken();
	}

	static int next()  throws Exception {return Integer.parseInt(nextToken());};
	static int[] next(int n) throws Exception {
		int[] x = new int[n];
		for (int i = 0; i < n; i++) x[i] = next();
		return x;
	}
	static int[][] next(int n, int m) throws Exception {
		int[][] x = new int[n][];
		for (int i = 0; i < n; i++) x[i] = next(m);
		return x;
	}

	static long nextl() throws Exception {return Long.parseLong(nextToken());};
	static long[] nextl(int n) throws Exception {
		long[] x = new long[n];
		for (int i = 0; i < n; i++) x[i] = nextl();
		return x;
	}
	static long[][] nextl(int n, int m) throws Exception {
		long[][] x = new long[n][];
		for (int i = 0; i < n; i++) x[i] = nextl(m);
		return x;
	}

	static double nextd() throws Exception {return Double.parseDouble(nextToken());};
	static double[] nextd(int n) throws Exception {
		double[] x = new double[n];
		for (int i = 0; i < n; i++) x[i] = nextd();
		return x;
	}
	static double[][] nextd(int n, int m) throws Exception {
		double[][] x = new double[n][];
		for (int i = 0; i < n; i++) x[i] = nextd(m);
		return x;
	}

	static String nextline() throws Exception {
		in = new StringTokenizer("");
		return bufferedreader.readLine();
	}

}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;

public class Main {

	static double eps=(double)1e-7;
	static long mod=(int)1e9+7;
	public static void main(String args[]) throws FileNotFoundException, UnsupportedEncodingException{
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//---------------My Code-----------------
		long m=in.nextLong();
		long l=0,r=(long)1e17;
		long mid=-1;
		while(l<=r){
			mid=(l+r)/2;
			double val=check(mid);
			if(val>=m){
				r=mid-1;
			}
			else{
				l=mid+1;
			}
		}
		if(Math.abs(check(l)-m)<eps){
			out.println((long)l);
		}
		else{
			out.println("-1");
		}
		out.close();
		//---------------The End------------------

	}
	static long check(double m){
		long count=0;
		for(long i=2;i<=1000000;i++){
			double v=(Math.pow(i, 3));
			if(v>m){
				break;
			}
			double tmp=m/v;
			long add=(long)Math.floor(tmp);
			count+=add;
		}
		return count;
	}
	static class Pair implements Comparable<Pair> {
		int u;
		int v;

		public Pair(int u, int v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        String sticks = read.nextLine();
        int a = sticks.split("\\+")[0].length();
        int b = sticks.split("\\+")[1].split("=")[0].length();
        int c = sticks.split("=")[1].length();

        if (a+b+1 == c-1 || a+b-1 == c+1 || a+b==c) {
            if (a+b > c) {
                while (a+b > c) {
                    if (a > 1) a--;
                    else if (b > 1) b--;
                    c++;
                }
            } else {
                while (a+b < c) {
                    a++;
                    c--;
                }
            }
            printSticks(a,b,c);
        } else {
            System.out.println("Impossible");
        }
    }

    private static void printSticks(int a, int b, int c) {
        StringBuilder s = new StringBuilder();
        for (int i = 0; i < a; i++) {
            s.append("|");
        }
        s.append("+");
        for (int i = 0; i < b; i++) {
            s.append("|");
        }
        s.append("=");
        for (int i = 0; i < c; i++) {
            s.append("|");
        }
        System.out.println(s);
    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class cf1081c {

    public static void main(String[] args) throws IOException {
        int n = rni(), m = ni(), k = ni(), dp[][] = new int[n][k + 1];
        dp[0][0] = m;
        for (int i = 1; i < n; ++i) {
            dp[i][0] = m;
            for (int j = 1; j <= k; ++j) {
                dp[i][j] = madd(dp[i - 1][j], mmul(m - 1, dp[i - 1][j - 1]));
            }
        }
        prln(dp[n - 1][k]);
        close();
    }

    static int mmod = 998244353;

    static int madd(int a, int b) {
        return (a + b) % mmod;
    }

    static int madd(int... a) {
        int ans = a[0];
        for (int i = 1; i < a.length; ++i) {
            ans = madd(ans, a[i]);
        }
        return ans;
    }

    static int msub(int a, int b) {
        return (a - b + mmod) % mmod;
    }

    static int mmul(int a, int b) {
        return (int) ((long) a * b % mmod);
    }

    static int mmul(int... a) {
        int ans = a[0];
        for (int i = 1; i < a.length; ++i) {
            ans = mmul(ans, a[i]);
        }
        return ans;
    }

    static int minv(int x) {
        return mpow(x, mmod - 2);
    }

    static int mpow(int a, int b) {
        if (a == 0) {
            return 0;
        }
        int ans = 1;
        while (b > 0) {
            if ((b & 1) > 0) {
                ans = mmul(ans, a);
            }
            a = mmul(a, a);
            b >>= 1;
        }
        return ans;
    }

    static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));
    static StringTokenizer input;
    static Random __rand = new Random();

    // references
    // IBIG = 1e9 + 7
    // IMAX ~= 2e9
    // LMAX ~= 9e18

    // constants
    static final int IBIG = 1000000007;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;
    // math util
    static int minof(int a, int b, int c) {return min(a, min(b, c));}
    static int minof(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static long minof(long a, long b, long c) {return min(a, min(b, c));}
    static long minof(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static int maxof(int a, int b, int c) {return max(a, max(b, c));}
    static int maxof(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static long maxof(long a, long b, long c) {return max(a, max(b, c));}
    static long maxof(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static int fli(double d) {return (int)d;}
    static int cei(double d) {return (int)ceil(d);}
    static long fll(double d) {return (long)d;}
    static long cel(double d) {return (long)ceil(d);}
    static int gcf(int a, int b) {return b == 0 ? a : gcf(b, a % b);}
    static long gcf(long a, long b) {return b == 0 ? a : gcf(b, a % b);}
    static int lcm(int a, int b) {return a * b / gcf(a, b);}
    static long lcm(long a, long b) {return a * b / gcf(a, b);}
    static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}
    static long hash(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}
    // array util
    static void reverse(int[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(long[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void reverse(char[] a) {for(int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}
    static void shuffle(int[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(long[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void rsort(int[] a) {shuffle(a); sort(a);}
    static void rsort(long[] a) {shuffle(a); sort(a);}
    static int[] copy(int[] a) {int[] ans = new int[a.length]; for(int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}
    static long[] copy(long[] a) {long[] ans = new long[a.length]; for(int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}
    static char[] copy(char[] a) {char[] ans = new char[a.length]; for(int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}
    // graph util
    static List<List<Integer>> g(int n) {List<List<Integer>> g = new ArrayList<>(); for(int i = 0; i < n; ++i) g.add(new ArrayList<>()); return g;}
    static List<Set<Integer>> sg(int n) {List<Set<Integer>> g = new ArrayList<>(); for(int i = 0; i < n; ++i) g.add(new HashSet<>()); return g;}
    static void c(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).add(v); g.get(v).add(u);}
    static void cto(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).add(v);}
    static void dc(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v); g.get(v).remove(u);}
    static void dcto(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v);}
    // input
    static void r() throws IOException {input = new StringTokenizer(__in.readLine());}
    static int ri() throws IOException {return Integer.parseInt(__in.readLine());}
    static long rl() throws IOException {return Long.parseLong(__in.readLine());}
    static int[] ria(int n) throws IOException {int[] a = new int[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Integer.parseInt(input.nextToken()); return a;}
    static int[] riam1(int n) throws IOException {int[] a = new int[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Integer.parseInt(input.nextToken()) - 1; return a;}
    static long[] rla(int n) throws IOException {long[] a = new long[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Long.parseLong(input.nextToken()); return a;}
    static char[] rcha() throws IOException {return __in.readLine().toCharArray();}
    static String rline() throws IOException {return __in.readLine();}
    static int rni() throws IOException {input = new StringTokenizer(__in.readLine()); return Integer.parseInt(input.nextToken());}
    static int ni() {return Integer.parseInt(input.nextToken());}
    static long rnl() throws IOException {input = new StringTokenizer(__in.readLine()); return Long.parseLong(input.nextToken());}
    static long nl() {return Long.parseLong(input.nextToken());}
    static List<List<Integer>> rg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for(int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}
    static void rg(List<List<Integer>> g, int m) throws IOException {for(int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}
    static List<List<Integer>> rdg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for(int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}
    static void rdg(List<List<Integer>> g, int m) throws IOException {for(int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}
    static List<Set<Integer>> rsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for(int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}
    static void rsg(List<Set<Integer>> g, int m) throws IOException {for(int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}
    static List<Set<Integer>> rdsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for(int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}
    static void rdsg(List<Set<Integer>> g, int m) throws IOException {for(int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}
    // output
    static void pr(int i) {__out.print(i);}
    static void prln(int i) {__out.println(i);}
    static void pr(long l) {__out.print(l);}
    static void prln(long l) {__out.println(l);}
    static void pr(double d) {__out.print(d);}
    static void prln(double d) {__out.println(d);}
    static void pr(char c) {__out.print(c);}
    static void prln(char c) {__out.println(c);}
    static void pr(char[] s) {__out.print(new String(s));}
    static void prln(char[] s) {__out.println(new String(s));}
    static void pr(String s) {__out.print(s);}
    static void prln(String s) {__out.println(s);}
    static void pr(Object o) {__out.print(o);}
    static void prln(Object o) {__out.println(o);}
    static void prln() {__out.println();}
    static void pryes() {__out.println("yes");}
    static void pry() {__out.println("Yes");}
    static void prY() {__out.println("YES");}
    static void prno() {__out.println("no");}
    static void prn() {__out.println("No");}
    static void prN() {__out.println("NO");}
    static void pryesno(boolean b) {__out.println(b ? "yes" : "no");};
    static void pryn(boolean b) {__out.println(b ? "Yes" : "No");}
    static void prYN(boolean b) {__out.println(b ? "YES" : "NO");}
    static void prln(int... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static void prln(long... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for(int i = 0; i < n; __out.print(iter.next()), __out.print(' '), ++i); if(n >= 0) __out.println(iter.next()); else __out.println();}
    static void h() {__out.println("hlfd");}
    static void flush() {__out.flush();}
    static void close() {__out.close();}
}


import java.io.*;
import java.util.StringTokenizer;

/**
 * Created by sbabkin on 9/14/2015.
 */
public class SolverE {

    public static void main(String[] args) throws IOException {
        new SolverE().Run();
    }

    BufferedReader br;
    PrintWriter pw;
    StringTokenizer stok;

    private String nextToken() throws IOException {
        while (stok==null || !stok.hasMoreTokens()){
            stok = new StringTokenizer(br.readLine());
        }
        return stok.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private void Run() throws IOException {
//        br=new BufferedReader(new FileReader("input.txt"));
//        pw=new PrintWriter("output.txt");
        br=new BufferedReader(new InputStreamReader(System.in));
        pw=new PrintWriter(new OutputStreamWriter(System.out));

        solve();
        pw.flush();
        pw.close();
    }

    private void solve() throws IOException {
        long x=nextLong();
        long y=nextLong();
        if (gcd(x,y)>1) {
            pw.println("Impossible");
            return;
        }
        while (x>1 || y>1) {
            if (x>y) {
                long del=x/y;
                if (y==1) {
                    del--;
                }
                pw.print(del+"A");
                x-=y*del;
            } else {
                long del=y/x;
                if (x==1) {
                    del--;
                }
                pw.print(del+"B");
                y-=x*del;
            }
        }
        pw.println();
    }

    private long gcd(long x, long y) {
        while (y>0) {
            x=x%y;
            long buf=x;
            x=y;
            y=buf;
        }
        return x;
    }

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		char[] c = sc.next().toCharArray();
		int n = c.length;

		int cur = 0;

		for (int i = 0; i < n; i++) {
			cur += (c[i] - '0');
		}

		char[] ans = c.clone();

		for (int i = n - 1; i >= 0; i--) {
			char[] curA = c.clone();

			int curC = 0;

			if(c[i] == 0)
				continue;

			curA[i]--;
			for (int j = i + 1; j < n; j++) {
				curA[j] = '9';
			}

			for (int j = 0; j < n; j++) {
				curC += curA[j] - '0';
			}

			if(curC > cur) {
				ans = curA;
				cur = curC;
			}
		}

		if(ans[0] != '0')
			out.print(ans[0]);
		for (int i = 1; i < n; i++)
			out.print(ans[i]);
		out.println();

		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException{	br = new BufferedReader(new FileReader(file));}

		public String next() throws IOException {
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

	}

}


import java.util.*;
import java.lang.Math;
public class tab
{
public static void main(String[] args)
{
int n,pos,l,r;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
pos=sc.nextInt();
l=sc.nextInt();
r=sc.nextInt();
int sum;
int a=(n-r)+(l-1);
if((Math.abs(pos-l)<Math.abs(r-pos))&&a!=0)
{
 if(l!=1)
   {sum=Math.abs(pos-l);
    sum++;
    if(r!=n)
      sum+=(r-l)+1;
   }
 else
   sum=Math.abs(r-pos)+1;
}
else if(a==0)
  sum=0;
else
{
  if(r!=n)
  {  sum=Math.abs(r-pos);
     sum++;
     if(l!=1)
     sum+=(r-l)+1;
  }
  else
   sum=Math.abs(pos-l)+1;
}
System.out.println(sum);
}}


import java.awt.Point;
import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class WinFreeze {
    static class Solver {
        public void solve(MyReader in, PrintWriter out) {
            long org = in.nextLong();
            long n = org;

            List<Long> div = new ArrayList<>();

            out:
            for(long i = 2;i*i <= n;i++){
                while (n%i == 0){
                    div.add(i);
                    n/=i;
                    if(div.size() >= 2)break out;
                }
            }

            if(n!= 1 && n!=org)div.add(n);

//            out.println(div);
            if(div.isEmpty()){
                out.println("1\n0");
            }
            else if(div.size() == 1 || div.get(0)*div.get(1) == org){
                out.println(2);
            }
            else{
                out.println("1");
                out.println(div.get(0)*div.get(1));
            }

        }

    }

    public static void main(String[] args) {
        MyReader mr = new MyReader();
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        new Solver().solve(mr, out);
        out.close();
    }

    //    static int[][] dir = {{0,1}, {1,0},{-1,0}, {0,-1}};
//    static int[][] dir = {{0,1}, {1,0},{-1,0}, {0,-1}, {-1,-1},{-1,1}, {1,1}, {1,-1}};
    static class MyReader {
        BufferedReader br;
        StringTokenizer st;

        MyReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String res = "";
            try {
                res = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return res;
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }

            return arr;
        }

        Integer[] nextIntegerArray(int n) {
            Integer[] arr = new Integer[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }

            return arr;
        }

        Long[] nextLongArray(int n) {
            Long[] arr = new Long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }

            return arr;
        }

        String[] nextStringArray(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }
    }

    static void swap(int[] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

}


import java.io.*;
import java.util.*;

public class Solution {
    private BufferedReader in;
    private StringTokenizer line;
    private PrintWriter out;

    private static final int mm = 1000000007;

    private static int MAX_DEPTH = 38;

    public void solve() throws IOException {
        int q = nextInt();
        A[] a = new A[q + 1];
        a[0] = new A(null);
        int n = 1;
        for (int i = 0; i < q; i++) {
            int qt = nextInt();
            int v = nextInt() - 1;
            if (qt == 1) {
                a[n++] = new A(a[v]);
                a[v].cnt++;
                recalc(a[n - 1], null, null, 0);
            } else {
                double res = 0;
                for (int j = 0; j < MAX_DEPTH - 1; j++) {
                    res += j * (a[v].a[j] - a[v].a[j + 1]);
                }
                out.println(String.format(Locale.ENGLISH, "%.8f", res));
            }
        }
    }

    private static double[] p2 = new double[MAX_DEPTH + 13];

    static {
        p2[0] = 1;
        for (int i = 1; i < p2.length; i++) {
            p2[i] = p2[i - 1] / 2.0;
        }
    }

    private void recalc(A b, A p, double[] prev, int depth) {
        if (b == null) return;
        if (depth == MAX_DEPTH) return;
        double[] bprev = Arrays.copyOf(b.a, MAX_DEPTH);

        double[] bcurr = b.a;
        if (p != null) {
            for (int i = 2; i < MAX_DEPTH; i++) {
                bcurr[i] = 1 - (1 - bcurr[i]) / (2 - prev[i - 1]) * (2 - p.a[i - 1]);
            }
            if (b.cnt > MAX_DEPTH) {
                bcurr[1] = 1;
            } else {
                bcurr[1] = 1 - p2[b.cnt];
            }
        }

        recalc(b.p, b, bprev, depth + 1);
    }

    private static class A {
        private double[] a;
        private A p;
        private int cnt;

        public A(A p) {
            this.p = p;
            this.a = new double[MAX_DEPTH];
            this.a[0] = 1;
            this.cnt = 0;
        }
    }

    public static void main(String[] args) throws IOException {
        new Solution().run(args);
    }

    public void run(String[] args) throws IOException {
        if (args.length > 0 && "DEBUG_MODE".equals(args[0])) {
            in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
        }
        out = new PrintWriter(System.out);
//        out = new PrintWriter("output.txt");

//        int t = nextInt();
        int t = 1;
        for (int i = 0; i < t; i++) {
//            out.print("Case #" + (i + 1) + ": ");
            solve();
        }

        in.close();
        out.flush();
        out.close();
    }

    private int[] nextIntArray(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private long[] nextLongArray(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (line == null || !line.hasMoreTokens()) {
            line = new StringTokenizer(in.readLine());
        }
        return line.nextToken();
    }

    private static class Pii {
        private int key;
        private int value;

        public Pii(int key, int value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pii pii = (Pii) o;

            if (key != pii.key) return false;
            return value == pii.value;

        }

        @Override
        public int hashCode() {
            int result = key;
            result = 31 * result + value;
            return result;
        }
    }

    private static class Pair<K, V> {
        private K key;
        private V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
            return !(value != null ? !value.equals(pair.value) : pair.value != null);

        }

        @Override
        public int hashCode() {
            int result = key != null ? key.hashCode() : 0;
            result = 31 * result + (value != null ? value.hashCode() : 0);
            return result;
        }
    }
}


import java.util.*;
public class XenolithHippodrome {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        HashSet h=new HashSet<>();
        boolean f=true;
        while (n>0){
            int k=n%m;
            if(h.contains(k)){
                f=false;
                break;
            }
            else {
                h.add(k);
                n/=m;
            }
        }
        if(f){
            System.out.println("YES");
        }
        else {
            System.out.println("NO");
        }
    }
}


import java.util.*;
import java.util.function.*;
import java.io.*;

// you can compare with output.txt and expected out
public class RoundEdu132F {
	MyPrintWriter out;
	MyScanner in;

//	final static long FIXED_RANDOM;
//	static {
//		FIXED_RANDOM = System.currentTimeMillis();
//	}
	final static String IMPOSSIBLE = "IMPOSSIBLE";
	final static String POSSIBLE = "POSSIBLE";
	final static String YES = "YES";
	final static String NO = "NO";

    private void initIO(boolean isFileIO) {
        if (System.getProperty("ONLINE_JUDGE") == null && isFileIO) {
        	try{
	            in = new MyScanner(new FileInputStream("input.txt"));
	            out = new MyPrintWriter(new FileOutputStream("output.txt"));
        	}
        	catch(FileNotFoundException e){
        		e.printStackTrace();
        	}
        }
        else{
    		in = new MyScanner(System.in);
    	    out = new MyPrintWriter(new BufferedOutputStream(System.out));
        }
    }

	public static void main(String[] args){
//		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		RoundEdu132F sol = new RoundEdu132F();
		sol.run();
    }

	private void run() {
		boolean isDebug = false;
		boolean isFileIO = true;
		boolean hasMultipleTests = false;

		initIO(isFileIO);

		int t = hasMultipleTests? in.nextInt() : 1;

	    for (int i = 1; i <= t; ++i) {
	    	if(isDebug){
		    	out.printf("Test %d\n", i);
	    	}

	    	getInput();

	    	ans = solve();

	    	printOutput();
	    }

	    in.close();
	    out.close();
	}

	int n, k, f;
	void getInput() {
		n = in.nextInt();
		k = in.nextInt();
		f = in.nextInt();
	}

	void printOutput() {
		out.printlnAns(ans);
	}

	static final long MOD = 998244353;
	int ans;
	int solve(){
		long ans = 0;

		// for each binary string s,
		// consider binary strings t of length n, where s is a prefix of t
		// we can have <= c_s among t

		// it's a full binary tree
		// where each vertex contains # of records in its subtree
		// and all records are at depth n

		// from each leaf, go up again, update each vertex to min(val, val(child1) + val(child2))
		// then the val(root) must be exactly f
		// where root is null string

		// the problem in this counting is we would have to use inclusion-exclusion due to duplicate cases
		// so we choose vertices representing disjoint subtrees
		// whose union can represent the whole tree
		// and whose sum is exactly f

		// for vertices under the subtrees, we can freely choose val
		// so that sum of siblings in each subtree >= val of root of subtree
		// for vertices above the subtrees, we can freely choose val between sum and k

		// so another approach:
		// for each vertex v of depth h
		// find # of ways to make sum exactly x
		// case 1: val(v) = x
		// add up ways(l, y)*ways(r, z) where y+z >= x
		// case 2: val(v) >= x+1
		// add up ways(l, y)*ways(r, z) where y+z = x

		// 2 1 1
		// case 1: c_0 = 1, c_1 = 0
		// 00 01 10 11
		// 1  0  0/1 0/1
		// 0  1  0/1 0/1
		// 1  1  0/1 0/1
		// -> 12

		// case 2: c_0 = 0, c_1 = 1
		// -> 12

		// case 3: c_0 = 1, c_1 = 1
		// 1 0 0 0
		// 0 1 0 0
		// 1 1 0 0
		// 0 0 1 0
		// 0 0 0 1
		// 0 0 1 1
		// -> 6

		// subtree_0 = 1 -> 3
		// c_0 = 1 -> 1 0, 0 1, 1 1

		// subtree_0 = 0 -> 5
		// c_0 = 0 -> 0/1, 0/1 -> 4
		// c_0 = 1 -> 0, 0 -> 1
		// 3*5 + 3*5 = 30

		// subtree_l = 0 -> 1
		// subtree_l = 1 -> 1

		// long[] ways = new long[f+2];
		int len = 1;
		while (len < f+2 + f+2)
	        len <<= 1;
		long[] ways = new long[len];
		long[] suffix = new long[f+2];

		for(int i=0; i<=k && i<=f; i++)
			ways[i] = 1;
		ways[f+1] = Math.max(0, k-f);

//		long[] ways2 = Arrays.copyOf(ways, f+2);

		for(int i=0; i<n; i++) {
			if(i < n-1) {
				square(ways);
				{
					long val = 0;
					for(int j=ways.length-1; j>=f+1; j--)
						val += ways[j];
					val %= MOD;
					suffix[f+1] = val;
				}
				for(int j=f; j>=0; j--){
					long val = suffix[j+1] + ways[j];
					val = val>=MOD? val-MOD: val;
					suffix[j] = val;
				}

				for(int j=0; j <= k && j<=f; j++) {
					long val = suffix[j]; // c_curr = j
					val += ways[j]*(k-j); // j+1 ~ k
					val %= MOD;
					ways[j] = val;
				}
				{
					long val = suffix[f+1]*Math.max(0, k-f);
					val %= MOD;
					ways[f+1] = val;
				}
				for(int j=k+1; j<f+2; j++)
					ways[j] = 0;
				Arrays.fill(ways, f+2, ways.length, 0);

//				long[] mult = multiplyPolynomial(ways2, ways2);
//				{
//					long val = 0;
//					for(int j=mult.length-1; j>=f+1; j--)
//						val += mult[j];
//					val %= MOD;
//					suffix[f+1] = val;
//				}
//				for(int j=f; j>=0; j--){
//					long val = suffix[j+1] + mult[j];
//					val = val>=MOD? val-MOD: val;
//					suffix[j] = val;
//				}
//				if(i < n-1) {
//					for(int j=0; j <= k && j<=f; j++) {
//						long val = suffix[j]; // c_curr = j
//						val += mult[j]*(k-j); // j+1 ~ k
//						val %= MOD;
//						ways2[j] = val;
//					}
//					{
//						long val = suffix[f+1]*Math.max(0, k-f);
//						val %= MOD;
//						ways2[f+1] = val;
//					}
//				}
//				if(!Arrays.equals(Arrays.copyOf(ways, f+2), ways2)) {
//					for(int j=0; j<f+2; j++)
//						if(ways[j] != ways2[j])
//							ways = ways;
//				}
			}
			else {
				for(int j=0; j<=f; j++)
					ans += ways[j]*ways[f-j] % MOD;
				ans %= MOD;
			}
		}

		return (int)ans;
	}

	static long pow(int a, int k, long p) {
		long m = k;
		long ans = 1;

		// curr = k^(2^i)
		long curr = a;

		// k^(2x+1) = (k^x)^2 * k
		while(m > 0) {
			if( (m&1) == 1 ) {
				ans *= curr;
				ans %= p;
			}
			m >>= 1;
			curr *= curr;
			curr %= p;
		}
		return ans;
	}

	// computes a^(p-2)
	static long inverse(int a, long p) {
		return pow(a, (int)(p-2), p);
	}

	// static final long MOD = 998_244_353; // = 1 + 7*17*2^23
	// primitive root is 3, i.e., the order of 3 is MOD-1
	// we have to find the 1<<23-th root
	static final int ROOT = (int) pow(3, 7*17, MOD);
	static final int ROOT_INV = (int) pow(ROOT, (int)MOD - 2, MOD);
	static final int ORDER = 1 << 23;

	static void swap(long[] a, int i, int j) {
		long temp = a[i];
		a[i] = a[j];
		a[j] = temp;
	}
	static void fft(long[] a, boolean isInvertedFFT) {
	    int n = a.length;

	    for (int i = 1, j = 0; i < n; i++) {
	        int bit = n >> 1;
	        for (; (j & bit) > 0; bit >>= 1)
	            j ^= bit;
	        j ^= bit;

	        if (i < j) {
	        	swap(a, i, j);
	        }
	    }

	    for (int len = 2; len <= n; len <<= 1) {
	        long wlen = isInvertedFFT ? ROOT_INV : ROOT;
	        for (int i = len; i < ORDER; i <<= 1)
	            wlen = wlen * wlen % MOD;

	        for (int i = 0; i < n; i += len) {
	        	long w = 1;
	            for (int j = 0; j < len / 2; j++) {
	                long u = a[i+j];
	                long v = a[i+j+len/2] * w % MOD;
	                a[i+j] =  u + v < MOD ? u + v : u + v - MOD;
	                a[i+j+len/2] = u - v >= 0 ? u - v : u - v + MOD;
	                w = w * wlen % MOD;
	            }
	        }
	    }

	    if (isInvertedFFT) {
	        long inv = inverse(n, MOD);
	        for(int i=0; i<a.length; i++)
	        	a[i] = a[i]*inv%MOD;
	    }
	}

	static void square(long[] a) {
	    fft(a, false);
	    for (int i = 0; i < a.length; i++)
	        a[i] = a[i]*a[i] % MOD;
	    fft(a, true);
	}

	static long[] multiplyPolynomial(long[] a, long[] b) {
	    int n = 1;
	    while (n < a.length + b.length)
	        n <<= 1;
		long[] fa = Arrays.copyOf(a, n);
		long[] fb = Arrays.copyOf(b, n);

	    fft(fa, false);
	    fft(fb, false);
	    for (int i = 0; i < n; i++)
	        fa[i] = fa[i]*fb[i] % MOD;
	    fft(fa, true);

	    return fa;
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		// 32768?
		public MyScanner(InputStream is, int bufferSize) {
			br = new BufferedReader(new InputStreamReader(is), bufferSize);
		}

		public MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
			// br = new BufferedReader(new InputStreamReader(System.in));
			// br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
		}

		public void close() {
			try {
				br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}

		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine(){
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[][] nextTreeEdges(int n, int offset){
			int[][] e = new int[n-1][2];
			for(int i=0; i<n-1; i++){
				e[i][0] = nextInt()+offset;
				e[i][1] = nextInt()+offset;
			}
			return e;
		}

		int[][] nextMatrix(int n, int m) {
			return nextMatrix(n, m, 0);
		}

		int[][] nextMatrix(int n, int m, int offset) {
			int[][] mat = new int[n][m];
			for(int i=0; i<n; i++) {
				for(int j=0; j<m; j++) {
					mat[i][j] = nextInt()+offset;
				}
			}
			return mat;
		}

		int[][] nextPairs(int n){
			return nextPairs(n, 0);
		}

		int[][] nextPairs(int n, int offset) {
			int[][] xy = new int[2][n];
			for(int i=0; i<n; i++) {
				xy[0][i] = nextInt() + offset;
				xy[1][i] = nextInt() + offset;
			}
			return xy;
		}

		int[][] nextGraphEdges(){
			return nextGraphEdges(0);
		}

		int[][] nextGraphEdges(int offset) {
			int m = nextInt();
			int[][] e = new int[m][2];
			for(int i=0; i<m; i++){
				e[i][0] = nextInt()+offset;
				e[i][1] = nextInt()+offset;
			}
			return e;
		}

		int[] nextIntArray(int len) {
			return nextIntArray(len, 0);
		}
		int[] nextIntArray(int len, int offset){
	    	int[] a = new int[len];
			for(int j=0; j<len; j++)
	    		a[j] = nextInt()+offset;
	    	return a;
		}

		long[] nextLongArray(int len) {
			return nextLongArray(len, 0);
		}
		long[] nextLongArray(int len, int offset){
	    	long[] a = new long[len];
			for(int j=0; j<len; j++)
	    		a[j] = nextLong()+offset;
	    	return a;
		}
	}

	public static class MyPrintWriter extends PrintWriter{
		public MyPrintWriter(OutputStream os) {
			super(os);
		}

		public void printlnAns(long ans) {
			println(ans);
		}

		public void printlnAns(int ans) {
			println(ans);
		}

		public void printlnAns(boolean ans) {
			if(ans)
				println(YES);
			else
				println(NO);
		}

		public void printAns(long[] arr){
			if(arr != null && arr.length > 0){
				print(arr[0]);
				for(int i=1; i<arr.length; i++){
					print(" ");
					print(arr[i]);
				}
			}
		}
		public void printlnAns(long[] arr){
			printAns(arr);
			println();
		}

		public void printAns(int[] arr){
			if(arr != null && arr.length > 0){
				print(arr[0]);
				for(int i=1; i<arr.length; i++){
					print(" ");
					print(arr[i]);
				}
			}
		}
		public void printlnAns(int[] arr){
			printAns(arr);
			println();
		}

		public <T> void printAns(ArrayList<T> arr){
			if(arr != null && arr.size() > 0){
				print(arr.get(0));
				for(int i=1; i<arr.size(); i++){
					print(" ");
					print(arr.get(i));
				}
			}
		}
		public <T> void printlnAns(ArrayList<T> arr){
			printAns(arr);
			println();
		}

		public void printAns(int[] arr, int add){
			if(arr != null && arr.length > 0){
				print(arr[0]+add);
				for(int i=1; i<arr.length; i++){
					print(" ");
					print(arr[i]+add);
				}
			}
		}
		public void printlnAns(int[] arr, int add){
			printAns(arr, add);
			println();
		}

		public void printAns(ArrayList<Integer> arr, int add) {
			if(arr != null && arr.size() > 0){
				print(arr.get(0)+add);
				for(int i=1; i<arr.size(); i++){
					print(" ");
					print(arr.get(i)+add);
				}
			}
		}

		public void printlnAns(ArrayList<Integer> arr, int add){
			printAns(arr, add);
			println();
		}

		public void printlnAnsSplit(long[] arr, int split){
			if(arr != null){
				for(int i=0; i<arr.length; i+=split){
					print(arr[i]);
					for(int j=i+1; j<i+split; j++){
						print(" ");
						print(arr[j]);
					}
					println();
				}
			}
		}

		public void printlnAnsSplit(int[] arr, int split){
			if(arr != null){
				for(int i=0; i<arr.length; i+=split){
					print(arr[i]);
					for(int j=i+1; j<i+split; j++){
						print(" ");
						print(arr[j]);
					}
					println();
				}
			}
		}

		public <T> void printlnAnsSplit(ArrayList<T> arr, int split){
			if(arr != null && !arr.isEmpty()){
				for(int i=0; i<arr.size(); i+=split){
					print(arr.get(i));
					for(int j=i+1; j<i+split; j++){
						print(" ");
						print(arr.get(j));
					}
					println();
				}
			}
		}
	}

	static private void permutateAndSort(long[] a) {
		int n = a.length;
		Random R = new Random(System.currentTimeMillis());
		for(int i=0; i<n; i++) {
			int t = R.nextInt(n-i);
			long temp = a[n-1-i];
			a[n-1-i] = a[t];
			a[t] = temp;
		}
		Arrays.sort(a);
	}

	static private void permutateAndSort(int[] a) {
		int n = a.length;
		Random R = new Random(System.currentTimeMillis());
		for(int i=0; i<n; i++) {
			int t = R.nextInt(n-i);
			int temp = a[n-1-i];
			a[n-1-i] = a[t];
			a[t] = temp;
		}
		Arrays.sort(a);
	}

	static private int[][] constructChildren(int n, int[] parent, int parentRoot){
		int[][] childrens = new int[n][];

		int[] numChildren = new int[n];
		for(int i=0; i<parent.length; i++) {
			if(parent[i] != parentRoot)
				numChildren[parent[i]]++;
		}

		for(int i=0; i<n; i++) {
			childrens[i] = new int[numChildren[i]];
		}

		int[] idx = new int[n];
		for(int i=0; i<parent.length; i++) {
			if(parent[i] != parentRoot)
				childrens[parent[i]][idx[parent[i]]++] = i;
		}

		return childrens;
	}

	static private int[][][] constructDirectedNeighborhood(int n, int[][] e){
		int[] inDegree = new int[n];
		int[] outDegree = new int[n];
		for(int i=0; i<e.length; i++) {
			int u = e[i][0];
			int v = e[i][1];
			outDegree[u]++;
			inDegree[v]++;
		}

		int[][] inNeighbors = new int[n][];
		int[][] outNeighbors = new int[n][];
		for(int i=0; i<n; i++) {
			inNeighbors[i] = new int[inDegree[i]];
			outNeighbors[i] = new int[outDegree[i]];
		}

		int[] inIdx = new int[n];
		int[] outIdx = new int[n];
		for(int i=0; i<e.length; i++) {
			int u = e[i][0];
			int v = e[i][1];
			outNeighbors[u][outIdx[u]++] = v;
			inNeighbors[v][inIdx[v]++] = u;
		}

		return new int[][][] {inNeighbors, outNeighbors};
	}

	static private int[][] constructNeighborhood(int n, int[][] e) {
		int[] degree = new int[n];
		for(int i=0; i<e.length; i++) {
			int u = e[i][0];
			int v = e[i][1];
			degree[u]++;
			degree[v]++;
		}

		int[][] neighbors = new int[n][];
		for(int i=0; i<n; i++)
			neighbors[i] = new int[degree[i]];

		int[] idx = new int[n];
		for(int i=0; i<e.length; i++) {
			int u = e[i][0];
			int v = e[i][1];
			neighbors[u][idx[u]++] = v;
			neighbors[v][idx[v]++] = u;
		}

		return neighbors;
	}

	static private void drawGraph(int[][] e) {
		makeDotUndirected(e);
		try {
			final Process process = new ProcessBuilder("dot", "-Tpng", "graph.dot")
					.redirectOutput(new File("graph.png"))
					.start();
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}

	}

	static private void makeDotUndirected(int[][] e) {
		MyPrintWriter out2 = null;
		 try {
			out2 = new MyPrintWriter(new FileOutputStream("graph.dot"));
		} catch (FileNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		out2.println("strict graph {");
		for(int i=0; i<e.length; i++){
			out2.println(e[i][0] + "--" + e[i][1] + ";");
		}
		out2.println("}");
		out2.close();
	}

	static private void makeDotDirected(int[][] e) {
		MyPrintWriter out2 = null;
		 try {
			out2 = new MyPrintWriter(new FileOutputStream("graph.dot"));
		} catch (FileNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		out2.println("strict digraph {");
		for(int i=0; i<e.length; i++){
			out2.println(e[i][0] + "->" + e[i][1] + ";");
		}
		out2.println("}");
		out2.close();
	}

}


import java.io.*;
import java.util.*;

public class C {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    final int MOD = 1000000007;

    int fact[];
    int inv[];

    int c(int n, int k) {
        return (int)((long)fact[n] * inv[k] % MOD * inv[n - k] % MOD);
    }

    int binPow(int a, int b) {
        int res = 1;
        while (b != 0) {
            if ((b & 1) == 1)
                res = (int)((long)res * a % MOD);
            a = (int)((long)a * a % MOD);
            b >>= 1;
        }
        return res;
    }

    void solve() throws IOException {
        int n = nextInt();

        fact = new int[2 * n];
        inv = new int[2 * n];

        fact[0] = 1;
        for (int i = 1; i < 2 * n; i++)
            fact[i] = (int)((long)fact[i - 1] * i % MOD);

        for (int i = 0; i < 2 * n; i++)
            inv[i] = binPow(fact[i], MOD - 2);

        //int res = n;

        int res = 0;
        for (int i = 1; i <= n; i++) {
            res += c(2 * n - i - 1, n - 1);
            if (res >= MOD)
                res -= MOD;
        }

        res += res;
        if (res >= MOD)
            res -= MOD;

        res -= n;
        if (res < 0)
            res += MOD;

        out.print(res);

    }

    void inp() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new C().inp();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }

    String nextString() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken("\n");
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}


import java.util.*;
import java.io.*;
//267630EY
public class Main236B2
{
  static PrintWriter out=new PrintWriter(System.out);

  public static void main(String[] args) throws IOException
  {
    Scanner sc=new Scanner(System.in);

    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();

    int[] div=new int[a*b*c+1];
    for(int i=1;i<=a*b*c;i++)
    {
      for(int j=i;j<=a*b*c;j+=i)
      {
        div[j]++;
      }
    }
    long ans=0;
    long f=1073741824;
    for(int i=1;i<=a;i++)
    {
      for(int j=1;j<=b;j++)
      {
        for(int k=1;k<=c;k++)
        {
          ans=(ans+div[i*j*k])%f;
        }
      }
    }
    out.println(ans);
    out.flush();

  }

  static class Scanner
  {
    BufferedReader br;
    StringTokenizer tk=new StringTokenizer("");
    public Scanner(InputStream is)
        {
      br=new BufferedReader(new InputStreamReader(is));
    }
        public int nextInt() throws IOException
        {
          if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
          tk=new StringTokenizer(br.readLine());
          return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
              return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
          if(tk.hasMoreTokens())
            return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
          tk=new StringTokenizer("");
          return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
              return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
              return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
          long a[]=new long[n];
            for(int i=0;i<n;i++)
              a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
          int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
          long a[]=new long[n+1];
          for(int i=1;i<=n;i++)
                a[i]=nextLong();
          return a;
        }
  }
}


import java.io.*;
import java.util.StringTokenizer;

public class Main{
public static void main(String[] args) throws IOException{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String x = buffer.readLine();
int n=Integer.parseInt(x);
if(n==0)
{System.out.println("0"); System.exit(0);}
if (n<10)
{System.out.println("1"); System.exit(0);}
int count=0;
while(n>9){

int max=0;
for(int i=0; i<x.length(); i++)
{String a=""+x.charAt(i);
int temp=Integer.parseInt(a);
if (temp>max)
max=temp;
}
n=n-max;
x=""+n;
count++;
}
System.out.println(count+1);
}}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
        int a1 = sc.nextInt(), b1 = sc.nextInt(), c1 = sc.nextInt();
        System.out.println((a1 != a && b1 != b && c1 != c) ? "NO" : "YES");
    }
}


import java.util.*;
import java.io.*;

public class Olimp {
    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        int a=in.nextInt();
        int b=in.nextInt();
        int c=in.nextInt();
        int d=in.nextInt();
        int max=Math.max(a*d, b*c);
        int min=Math.min(a*d, b*c);
        min=max-min;
        int g=gcd(max, min);
        System.out.println(min/g+"/"+max/g);

    }
    public static int gcd(int a, int b){
        if(b==0) return a;
        return gcd(b, a%b);
    }
}


import java.util.PriorityQueue;
import java.util.Scanner;

public class d {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);

		int n = stdin.nextInt();
		int k = stdin.nextInt();

		PriorityQueue<Integer>[] arr = new PriorityQueue[200_001];
		for (int i = 0; i < 200_001; i ++) arr[i] = new PriorityQueue<>();

		for (int i = 0; i < n; i ++) {
			int in = stdin.nextInt();
			arr[in].add(0);
			int count = 0;
			while (in >= 1) {
				in /= 2;
				arr[in].add(++count);
			}
		}

//		for (int i = 1; i < 3; i ++) for (int j = 0; j < arr[i].size(); j ++) System.out.println(arr[i].poll());

		int min = 1_000_000_000;

		for (int i = 0; i < 200_001; i++) {
			int taken = 0, sum = 0;
			while (!arr[i].isEmpty() && taken < k) {
				sum += arr[i].poll();
				taken ++;
				if (taken == k) min = Math.min(min, sum);
			}
		}

		System.out.println(min);
	}
}


import java.util.Scanner;

public class RemoveAdjacent {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int length = in.nextInt();
    String s = in.next();

    if (length == 1) {
      System.out.println(0);
      return;
    }

    int output = 0;
    // Assumes s has length at least 2
    for (int i = 0; i < length; i++) {
      for (int k = 122; k > 97; k--) {   // ascii range for "b" through "z", note "a" can never be removed so it is excluded
        boolean nextIteration = false;
        for (int j = 0; j < s.length(); j++) {
          if (s.length() == 1) {
            nextIteration = false;
            break;
          }
          if (s.charAt(j) == k) {
            if (j == 0 && s.charAt(j + 1) == k - 1) {
              s = remove(s, j);
              output++;
              nextIteration = true;
              break;
            }
            else if (j == s.length() - 1 && s.charAt(j - 1) == k - 1) {
              s = remove(s, j);
              output++;
              nextIteration = true;
              break;
            }
            else if (j != 0 && j != s.length() - 1 && (s.charAt(j + 1) == k - 1 || s.charAt(j - 1) == k - 1)) {
              s = remove(s, j);
              output++;
              nextIteration = true;
              break;
            }
          }
        }

        if (nextIteration) break;
      }
    }

    System.out.println(output);
  }

  public static String remove(String s, int index) {
    // System.out.println("before:" + s + ", after: " + s.substring(0, index) + s.substring(index + 1));
    return s.substring(0, index) + s.substring(index + 1);
  }
}