/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,n,i,j,min,max,k,p=0,x,o,y,a1,a2,k1,k2;
		long d;
		String s="",st;
		for(i=0;i<t;i++)
		{
		     min=max=0;
		    a1=in.nextInt();
		    a2=in.nextInt();
		    k1=in.nextInt();
		    k2=in.nextInt();
		    n=in.nextInt();
		    if(k2<k1)
		    {
		         p=a2;k=n;j=a1;
		         while(p>0 && k>=k2)
		         {
		              k-=k2;
		              max++;
		              p--;
		         }
		         while(k>=k1 && j>0)
		         {
		              k=k-k1;
		              j--;
		              max++;
		         }
		    }
		    else
		    {
		         p=a1;k=n;j=a2;
		         while(p>0 && k>=k1)
		         {
		              k-=k1;
		              max++;
		              p--;
		         }
		         while(k>=k2 && j>0)
		         {
		              k=k-k2;
		              j--;
		              max++;
		         }
		    }
	         k=n-(k2-1)*a2-(k1-1)*a1;
	         min=Math.max(0,k);
	         System.out.println(min+" "+max);
		}
	}
}


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;

public class Main {

	private static final int MAXN = 5000;
	private static final String NO = "NO";
	private static final String YES = "YES";
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	private static final long MOD = 1000000007L;
	private static final int MAX = Integer.MAX_VALUE / 4;

	void solve() {
		int H = ni() % 12;
		int M = ni();
		int S = ni();
		int T1 = ni();
		int T2 = ni();
		double a[] = new double[3];
		a[0] = S * 360.0 / 60;
		a[1] = (M + S / 60.0) * 360 / 60;
		a[2] = (H + (M + S /60.0) /60) * 360.0 / 12;
//		tr(a);
		Arrays.sort(a);
//		tr(a);
		out.print(get(a, T1) == get(a, T2) ? YES : NO);
	}

	private int get(double[] a, int t) {
		double b = t*360.0/12;
//		tr(b);
		if (b<=a[1] && b>=a[0])
			return 0;
		if (b<=a[2] && b>=a[1])
			return 1;
		return 2;
	}

	long power(long a, long b) {
		long x = 1, y = a;
		while (b > 0) {
			if (b % 2 != 0) {
				x = (x * y) % MOD;
			}
			y = (y * y) % MOD;
			b /= 2;
		}
		return x % MOD;
	}

	private long gcd(long a, long b) {
		while (a != 0) {
			long tmp = b % a;
			b = a;
			a = tmp;
		}
		return b;
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

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

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	private boolean vis[];

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n) {
			if (!(isSpaceChar(b)))
				buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private Integer[] na2(int n) {
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int[][] na(int n, int m) {
		int[][] a = new int[n][];
		for (int i = 0; i < n; i++)
			a[i] = na(m);
		return a;
	}

	private Integer[][] na2(int n, int m) {
		Integer[][] a = new Integer[n][];
		for (int i = 0; i < n; i++)
			a[i] = na2(m);
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long[] nl(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


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

public class Main
{
	static final long mod=(int)1e9+7;
	public static void main(String[] args) throws Exception
	{
		FastReader in=new FastReader();
		PrintWriter pw=new PrintWriter(System.out);
		int n=in.nextInt();
		long m=in.nextInt();
		int k=in.nextInt();
		long[][] dp=new long[n+1][k+1];
		long ans=0;
		for(int i=1;i<=n;i++)
		{
			dp[i][0]=m;

			for(int j=1;j<Math.min(i,k+1);j++)
			{
				dp[i][j]=dp[i-1][j]+dp[i-1][j-1]*(m-1);
				dp[i][j]%=998244353;
			}
		}
		pw.println(dp[n][k]);
		pw.flush();
	}
}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

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

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

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

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


import	java.util.*;
public	class	Main{
	public	static	void	main(String[]args){
		Scanner	cin=new	Scanner(System.in);
		long	s=0,n=cin.nextLong(),m,x=2,y,z,a,b,c;
		if(0==n%6)	for(n/=3;x*x*x<=n;++x)	if(1>n%x)
			for(z=2-x,y=Math.max(x,(int)Math.ceil((z+Math.sqrt(z*z+((m=n/x)<<2)))/2));y*y<=m;++y)
				if(1>m%y&&1>(1&(x^(z=m/y)^y)))
				{a=x+y-z;s+=(c=(y<<1)-a)==a?1:(b=(x<<1)-a)==a||b==c?3:6;}
		System.out.print(s);
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alex
 */
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);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskD {
        long MOD = 1000 * 1000 * 1000 + 7;
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int A = in.readInt();
            int B = in.readInt();
            long n = in.readLong();
            int x = in.readInt();
            int[][] pow = new int[][] {{A, B}, {0, 1}};
            pow = pow(pow, n);
            int[][] init = new int[][] {{x, 0}, {1, 0}};
            out.printLine(mult(pow, init)[0][0]);
        }
        private int[][] mult(int[][] a, int[][] b) {
            int[][] res = new int[2][2];
            for (int firstrow = 0; firstrow < 2; firstrow++) {
                for (int secondcol = 0; secondcol < 2; secondcol++) {
                    int sum = 0;
                    for (int i = 0; i < 2; i++) {
                        sum += ((long) a[firstrow][i] * b[i][secondcol]) % MOD;
                        if (sum >= MOD) sum -= MOD;
                    }
                    res[firstrow][secondcol] = sum;
                }
            }
            return res;
        }
        private int[][] pow(int[][] mat, long pow) {
            if (pow == 0) return new int[][] {{1, 0}, {0, 1}};
            if (pow == 1) return mat;
            int[][] half = pow(mat, pow / 2);
            int[][] full = mult(half, half);
            if (pow % 2 == 1) {
                full = mult(full, mat);
            }
            return full;
        }
    }
    static class OutputWriter {
        private final PrintWriter writer;
        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }
        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }
        public void close() {
            writer.close();
        }
        public void printLine(int i) {
            writer.println(i);
        }
    }
    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 readInt() {
            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 long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long 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.util.*;
public class math {
    public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    System.out.println(2-n*n);
    }
}


import java.util.*;

import java.io.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	long mod = (long) 1e9 + 7;
	int mod2 = 998244353;

	public void solve() throws Exception {
		long x = sc.nextLong();
		long k =sc.nextLong();
		//out.println(calculate(x));
		if(x==0) {
			out.println(0);
			return;
		}
		out.println(((((((calculate(k+1)%mod)*(x%mod))%mod)+mod)%mod - (calculate(k))%mod + 1l)%mod+mod)%mod);

	}

	public long calculate(long pow) {
		if(pow==1) return 2l;
		if(pow==0) return 1l;
		long temp = calculate(pow/2);
		if(pow%2==1)
		{
			return ((((temp%mod)*(temp%mod)*2l)%mod)+mod)%mod;
		}
		else
		{
			return ((((temp%mod)*(temp%mod))%mod)+mod)%mod;
		}
	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

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

	static long ncr(int n, int r, long p) {
		if (r > n)
			return 0l;
		if (r > n - r)
			r = n - r;

		long C[] = new long[r + 1];

		C[0] = 1;

		for (int i = 1; i <= n; i++) {

			for (int j = Math.min(i, r); j > 0; j--)
				C[j] = (C[j] + C[j - 1]) % p;
		}
		return C[r] % p;
	}

	public long power(long x, long y, long p) {
		long res = 1;
		// out.println(x+" "+y);
		x = x % p;
		if (x == 0)
			return 0;

		while (y > 0) {
			if ((y & 1) == 1)
				res = (res * x) % p;
			y = y >> 1;
			x = (x * x) % p;
		}
		return res;
	}

	static Throwable uncaught;

	BufferedReader in;
	FastScanner sc;
	PrintWriter out;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable uncaught) {
			Solution.uncaught = uncaught;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", (1 << 26));
		thread.start();
		thread.join();
		if (Solution.uncaught != null) {
			throw Solution.uncaught;
		}
	}

}

class FastScanner {

	BufferedReader in;
	StringTokenizer st;

	public FastScanner(BufferedReader in) {
		this.in = in;
	}

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

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

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

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

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

}


// Let f(x) = # of sequences a_i such that gcd() = 1, sum(a_i)=x. We want f(y - x). This is a hard AF function to calculate: easiest recurrence would be sum(f_i) where i<t, gcd(t,i)=1,
// but that's not fast enough at all.

// Trick from editorial: Relate a function to an easier function with a relationship IN EITHER DIRECTION. Here, let g(t) = # of sequences w/o gcd()=1 condition.
// Then, we realize that a_i can onyl have so many gcd's, so g(t)=sum_(d|t) f(t/d), f(t)=g(t)-sum_(d|t, d not t) f(t).

// Notice the repeats in f(t). That means we can DP it. Let's code!

import java.util.*;
public class Unusual {
	private static final int N = 1000000007;
	public static long pow(int n) {
		if (n == 0) return 1;
		long x = pow(n / 2);
		x = (x * x) % N;
		if (n % 2 == 1) x = (x * 2) % N;
		return x;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int x = in.nextInt(), y = in.nextInt(), t = y / x, i;
		if (y % x != 0) {
			System.out.println(0);
			System.exit(0);
		}
		ArrayList<Integer> divisors = new ArrayList<Integer>();
		for (i = 1; i * i < t; i++) {
			if (t % i == 0) {
				divisors.add(i); divisors.add(t / i);
			}
		}
		if (i * i == t) divisors.add(i);
		int[] d = new int[divisors.size()];
		for (i = 0; i < d.length; i++) {
			d[i] = divisors.get(i);
		}
		Arrays.sort(d);
		long[] f = new long[divisors.size()];
		f[0] = 1;
		for (i = 1; i < d.length; i++) {
			f[i] = pow(d[i] - 1);
			for (int j = 0; j < i; j++) {
				if (d[i] % d[j] == 0) f[i] = (f[i] - f[j] + N) % N;
			}
		}
//		System.out.println(Arrays.toString(d));
//		System.out.println(Arrays.toString(f));
		System.out.println(f[d.length - 1]);
	}
}


import java.util.Scanner;

public class E {
    public static boolean solve(long x, long y, long c, long d) {
        if (x == 0 && y == 0)
            return c == 0 && d == 0;
        if (x == 0)
            return c % y == 0 && d % y == 0;
        if (y == 0)
            return c % x == 0 && d % x == 0;
        if ((c * x + d * y) % (x * x + y * y) != 0)
            return false;
        long a = (c * x + d * y) / (x * x + y * y);
        return (d - a * y) % x == 0;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long ax = in.nextInt();
        long ay = in.nextInt();
        long bx = in.nextInt();
        long by = in.nextInt();
        long cx = in.nextInt();
        long cy = in.nextInt();
        if (solve(cx, cy, bx - ax, by - ay) || solve(cx, cy, bx - ay, by + ax)
                || solve(cx, cy, bx + ax, by + ay)
                || solve(cx, cy, bx + ay, by - ax))
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}


import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

import java.io.*;
import java.lang.reflect.*;
import java.util.*;

public class D {

	final static boolean autoflush = false;

	final static int MOD = (int) 1e9 + 7;
	final static double eps = 1e-9;
	final static int INF = (int) 1e9;

	Integer [] A;
	int N; int [] Q; int [][] R;

	public D () {
		N = sc.nextInt();
		A = sc.nextInts();

		if (N == 1)
			exit(1);

		next: for (int i : rep(1, N)) {
			for (int j : rep(i))
				for (int k : rep(i))
					if (A[j] + A[k] == A[i])
						continue next;
			exit(-1);
		}

		Map<Integer, Integer> M = new TreeMap<Integer, Integer>();
		for (int i : rep(N))
			M.put(A[i], i);

		Q = new int [N];
		R = new int [N][N];

		for (int i : rep(N))
			for (int j : rep(i))
				if (M.containsKey(A[i] - A[j])) {
					int k = M.get(A[i] - A[j]);
					Q[i] |= (1 << j);
					R[i][j] = k;
				}

		H = new int [1 << (N-1)]; fill(H, -1);

		int res = solve(1, 1);
		assert res <= N;
		exit(res);
	}

	int [] H;

	int solve(int X, int J) {
		int B = (X & Q[J]);
		if (B == 0)
			return H[X] = INF;

		for (int i = 0; i < J; ++i) {
			int U = (1 << i), V = (1 << R[J][i]);
			if ((B&U) != 0 && (B&V) != 0)
				break;
			if (i == J-1)
				return H[X] = INF;
		}

		if (J == N-1)
			return H[X] = Integer.bitCount(X);

		int Y = (X | (1 << J)), res = INF;
		for (int j = 0; j < J; ++j) {
			int W = (1 << j);
			if ((Y & W) != 0) {
				int V = Y & (~W), R = H[V] == -1 ? solve(V, J+1) : H[V];
				res = min(res, R);
			}
		}
		int R = H[Y] == -1 ? solve(Y, J+1) : H[Y];
		res = min(res, R);
		return H[X] = res;
	}

	////////////////////////////////////////////////////////////////////////////////////

	static int [] rep(int N) { return rep(0, N); }
	static int [] rep(int S, int T) { int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	static int [] req(int S, int T) { return rep(S, T+1); }

	////////////////////////////////////////////////////////////////////////////////////

	/* Dear hacker, don't bother reading below this line, unless you want to help me debug my I/O routines :-) */

	final static MyScanner sc = new MyScanner();

	static class MyScanner {
		public String next() {
			newLine();
			return line[index++];
		}

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

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

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

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

		public String nextLine() {
			line = null;
			return readLine();
		}

		public String [] nextStrings() {
			line = null;
			return readLine().split(" ");
		}

		public char [] nextChars() {
			return next ().toCharArray ();
		}

		public Integer [] nextInts() {
			String [] L = nextStrings();
			Integer [] res = new Integer [L.length];
			for (int i : rep(L.length))
				res[i] = Integer.parseInt(L[i]);
			return res;
		}

		public Long [] nextLongs() {
			String [] L = nextStrings();
			Long [] res = new Long [L.length];
			for (int i : rep(L.length))
				res[i] = Long.parseLong(L[i]);
			return res;
		}

		public Double [] nextDoubles() {
			String [] L = nextStrings();
			Double [] res = new Double [L.length];
			for (int i : rep(L.length))
				res[i] = Double.parseDouble(L[i]);
			return res;
		}

		public String [] next (int N) {
			String [] res = new String [N];
			for (int i : rep(N))
				res[i] = sc.next();
			return res;
		}

		public Integer [] nextInt (int N) {
			Integer [] res = new Integer [N];
			for (int i : rep(N))
				res[i] = sc.nextInt();
			return res;
		}

		public Long [] nextLong (int N) {
			Long [] res = new Long [N];
			for (int i : rep(N))
				res[i] = sc.nextLong();
			return res;
		}

		public Double [] nextDouble (int N) {
			Double [] res = new Double [N];
			for (int i : rep(N))
				res[i] = sc.nextDouble();
			return res;
		}

		public String [][] nextStrings (int N) {
			String [][] res = new String [N][];
			for (int i : rep(N))
				res[i] = sc.nextStrings();
			return res;
		}

		public Integer [][] nextInts (int N) {
			Integer [][] res = new Integer [N][];
			for (int i : rep(N))
				res[i] = sc.nextInts();
			return res;
		}

		public Long [][] nextLongs (int N) {
			Long [][] res = new Long [N][];
			for (int i : rep(N))
				res[i] = sc.nextLongs();
			return res;
		}

		public Double [][] nextDoubles (int N) {
			Double [][] res = new Double [N][];
			for (int i : rep(N))
				res[i] = sc.nextDoubles();
			return res;
		}

		//////////////////////////////////////////////

		private boolean eol() {
			return index == line.length;
		}

		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error (e);
			}
		}
		private final BufferedReader r;

		MyScanner () {
			this(new BufferedReader(new InputStreamReader(System.in)));
		}

		MyScanner (BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}

		private String [] line;
		private int index;

		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}

	static void print (Object o, Object... a) {
		printDelim(" ", o, a);
	}

	static void cprint (Object o, Object... a) {
		printDelim("", o, a);
	}

	static void printDelim (String delim, Object o, Object... a) {
		pw.println(build(delim, o, a));
	}

	static void exit (Object o, Object... a) {
		print(o, a);
		exit();
	}

	static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}

	static void NO() {
		throw new Error("NO!");
	}

	////////////////////////////////////////////////////////////////////////////////////

	static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.toString().trim();
	}

	static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = Array.getLength(o);
			for (int i : rep(L))
				append(b, Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>) {
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		} else
			b.append(delim).append(o);
	}

	////////////////////////////////////////////////////////////////////////////////////

	static void statics() {
		abs(0);
		valueOf(0);
		asList(new Object [0]);
		reverseOrder();
	}

	public static void main (String[] args) {
		new D();
		exit();
	}

	static void start() {
		t = millis();
	}

	static PrintWriter pw = new PrintWriter(System.out, autoflush);

	static long t;

	static long millis() {
		return System.currentTimeMillis();
	}
}


/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class benn {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int a[]=new int[n];
		for(int i=0;i<n;i++)
		a[i]=sc.nextInt();
		ArrayList<Integer> ar=new ArrayList<>();
		int s=0;
		for(int i=0;i<n;i++){
		     s+=a[i];
		    if(s<=m)
		    {
		    	//sum+=t[i];
		        System.out.print(0+" ");
		    }
		    else
		    {
		    	//System.out.println(sum+" "+a);
		        Collections.sort(ar);
		        int x=0,y=0;
		        for(int j=ar.size()-1;j>=0;j--)
		        {
		            x+=ar.get(j);
		            if(s-x<=m)
		            {
		            	y++;
		                break;
		            }
		            else
		            y++;
		        }
		        System.out.print(y+" ");

		    }
		    ar.add(a[i]);
		}
	}
}


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class P633A {
  InputStream is;
  PrintWriter out;
  String INPUT = "6 11 6";

  void solve() {
    int a = ni();
    int b = ni();
    int c = ni();
    int tmp = 0;
    while (tmp < c) {
      if ((c - tmp) % b == 0) {
        System.out.println("Yes");
        return;
      }
      tmp += a;
    }
    tmp = 0;
    while (tmp < c) {
      if ((c - tmp) % a == 0) {
        System.out.println("Yes");
        return;
      }
      tmp += b;
    }
    System.out.println("No");
  }

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

  void run() throws Exception {
    is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
    out = new PrintWriter(System.out);

    long s = System.currentTimeMillis();
    solve();
    out.flush();
    tr(System.currentTimeMillis() - s + "ms");
  }

  private byte[] inbuf = new byte[1024];
  private int lenbuf = 0, ptrbuf = 0;

  private int readByte() {
    if (lenbuf == -1)
      throw new InputMismatchException();
    if (ptrbuf >= lenbuf) {
      ptrbuf = 0;
      try {
        lenbuf = is.read(inbuf);
      } catch (IOException e) {
        throw new InputMismatchException();
      }
      if (lenbuf <= 0)
        return -1;
    }
    return inbuf[ptrbuf++];
  }

  private boolean isSpaceChar(int c) {
    return !(c >= 33 && c <= 126);
  }

  private int skip() {
    int b;
    while ((b = readByte()) != -1 && isSpaceChar(b))
      ;
    return b;
  }

  private double nd() {
    return Double.parseDouble(ns());
  }

  private char nc() {
    return (char) skip();
  }

  private String ns() {
    int b = skip();
    StringBuilder sb = new StringBuilder();
    while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  private char[] ns(int n) {
    char[] buf = new char[n];
    int b = skip(), p = 0;
    while (p < n && !(isSpaceChar(b))) {
      buf[p++] = (char) b;
      b = readByte();
    }
    return n == p ? buf : Arrays.copyOf(buf, p);
  }

  private char[][] nm(int n, int m) {
    char[][] map = new char[n][];
    for (int i = 0; i < n; i++)
      map[i] = ns(m);
    return map;
  }

  private int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private int ni() {
    int num = 0, b;
    boolean minus = false;
    while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
      ;
    if (b == '-') {
      minus = true;
      b = readByte();
    }

    while (true) {
      if (b >= '0' && b <= '9') {
        num = num * 10 + (b - '0');
      } else {
        return minus ? -num : num;
      }
      b = readByte();
    }
  }

  private long nl() {
    long num = 0;
    int b;
    boolean minus = false;
    while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
      ;
    if (b == '-') {
      minus = true;
      b = readByte();
    }

    while (true) {
      if (b >= '0' && b <= '9') {
        num = num * 10 + (b - '0');
      } else {
        return minus ? -num : num;
      }
      b = readByte();
    }
  }

  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

  private void tr(Object... o) {
    if (!oj)
      System.out.println(Arrays.deepToString(o));
  }
}


/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
    static Reader scan;
    static PrintWriter pw;
    static long MOD = 1_000_000_007;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null,null,"BaZ",1<<25)
        {
            public void run()
            {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new Reader();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        long nCr[][] = new long[101][101];
        for(int i=0;i<=100;++i) {
            nCr[i][0] = 1;
        }
        for(int i=1;i<=100;++i) {
            for(int j=1;j<=100;++j) {
                nCr[i][j] = (nCr[i-1][j] + nCr[i-1][j-1])%MOD;
            }
        }
        int freq[] = new int[101];
        int n = ni();
        int arr[] = new int[n];
        int sum = 0;
        for(int i=0;i<n;++i) {
            arr[i] = ni();
            sum+=arr[i];
            ++freq[arr[i]];
        }
        long ways0[][] = new long[n+1][sum+1];
        long ways1[][] = new long[n+1][sum+1];
        ways0[0][0] = 1;
        for(int i=0;i<n;++i) {
            ways1[0][0] = 1;
            for(int nele=1;nele<=(i+1);nele++) {
                for(int s=0;s<=sum;++s) {
                    if(s<arr[i]) {
                        ways1[nele][s] = ways0[nele][s];
                    }
                    else {
                        ways1[nele][s] = (ways0[nele][s] + ways0[nele-1][s-arr[i]])%MOD;
                    }
                }
            }
            for(int nele=0;nele<=(i+1);nele++) {
                for(int s=0;s<=sum;++s) {
                    ways0[nele][s] = ways1[nele][s];
                }
            }
        }
        int ans = 0;
        int cnt_distinct = 0;
        for(int i=1;i<=100;++i) {
            if(freq[i]>0) {
                cnt_distinct++;
            }
            for(int j=1;j<=freq[i];++j) {
                if(ways0[j][i*j]==nCr[freq[i]][j]) {
                    ans = max(ans, j);
                }
            }
        }
        if(cnt_distinct<=2) {
            pl(n);
        }
        else {
            pl(ans);
        }
        pw.flush();
        pw.close();
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vadim Semenov
 */
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);
        TaskF solver = new TaskF();
        solver.solve(1, in, out);
        out.close();
    }

    static final class TaskF {
        public void solve(int __, InputReader in, PrintWriter out) {
            String s = in.next();
            String t = in.next();
            int[][] result = solve(s.toCharArray(), t.toCharArray());
            out.println(result.length);
            for (int[] pair : result) {
                out.print(pair[0]);
                out.print(' ');
                out.println(pair[1]);
            }
        }

        private int[][] solve(char[] s, char[] t) {
            int[][] result = solveInternal(s, t);
            int[][] anotherResult = solveInternal(t, s);
            if (anotherResult.length < result.length) {
                result = anotherResult;
                for (int[] pair : result) {
                    ArrayUtils.swap(pair, 0, 1);
                }
            }
            return result;
        }

        private int[][] solveInternal(char[] s, char[] t) {
            List<Integer> sChangings = getChangings(s, 0, s.length, s, 0, 0, 'a');
            List<Integer> tChangings = getChangings(t, 0, t.length, t, 0, 0, 'b');
            int[][] result = solveGreedy(s, 0, s.length, s, 0, 0, t, 0, t.length, t, 0, 0, 0, Integer.MAX_VALUE);
            assert result != null;
            int balance = (sChangings.size() - tChangings.size()) / 2;
            for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < 3; ++j) {
                    int sp = (balance > 0 ? balance : 0) + i;
                    int tp = (balance < 0 ? -balance : 0) + j;
                    if ((sp != 0 && sp >= sChangings.size()) || (tp != 0 && tp >= tChangings.size())) continue;
                    int sSep = sp < sChangings.size() ? sChangings.get(sp) : 0;
                    int tSep = tp < tChangings.size() ? tChangings.get(tp) : 0;
                    int[][] current = solveGreedy(t, 0, tSep, s, sSep, s.length, s, 0, sSep, t, tSep, t.length, 1, result.length);
                    if (current != null) {
                        result = current;
                        current[0][0] = sSep;
                        current[0][1] = tSep;
                    }
                }
            }
            return result;
        }

        private int[][] solveGreedy(char[] s1, int s1from, int s1to,
                                    char[] s2, int s2from, int s2to,
                                    char[] t1, int t1from, int t1to,
                                    char[] t2, int t2from, int t2to,
                                    int offset, int limit) {
            List<Integer> ss = getChangings(s1, s1from, s1to, s2, s2from, s2to, 'a');
            List<Integer> tt = getChangings(t1, t1from, t1to, t2, t2from, t2to, 'b');
            int length = Math.max(ss.size(), tt.size());
            if (offset + length >= limit) {
                return null;
            }
            int[][] result = new int[offset + length][2];
            for (int i = 0; i < length; ++i) {
                result[offset + i][0] = pop(ss);
                result[offset + i][1] = pop(tt);
                List<Integer> tmp = ss;
                ss = tt;
                tt = tmp;
            }
            return result;
        }

        private List<Integer> getChangings(char[] s1, int s1from, int s1to, char[] s2, int s2from, int s2to, char target) {
            List<Integer> changings = new ArrayList<>();
            for (int i = s2to; i-- > s2from; ) {
                char current = s2[i];
                if (current != target) {
                    changings.add(s1to - s1from + i - s2from + 1);
                    target = current;
                }
            }
            for (int i = s1to; i-- > s1from; ) {
                char current = s1[i];
                if (current != target) {
                    changings.add(i - s1from + 1);
                    target = current;
                }
            }
            Collections.reverse(changings);
            return changings;
        }

        private static int pop(List<Integer> stack) {
            return stack.isEmpty() ? 0 : stack.remove(stack.size() - 1);
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }

    static class ArrayUtils {
        private ArrayUtils() {
        }

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

    }
}


import java.util.Scanner;

public class D {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] mas = {0,1,0,18,0,1800,0,670320,0,734832000,0,890786230,0,695720788,0,150347555};
		int n = sc.nextInt();
		if (n%2 == 0) {
			System.out.println(0);
		}else{
			System.out.println(mas[n]);
		}
	}
}


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

public class Main {
	static long[] factor;
	static int mod = 1000000007;

	public static void main(String[] args) throws IOException {
		InputReader scan = new InputReader();
		int a = scan.nextInt(), b = scan.nextInt(), k = scan.nextInt();
		generateFactor(k);
		long sum = 0;
		for (int i = 0; i <= k; i++) {
			if (isGood(a * i + b * (k - i), a, b))
				sum += (factor[k] * (BigInteger.valueOf(factor[i] * factor[k - i] % mod)
						.modInverse(BigInteger.valueOf(mod)).longValue()) % mod);
			sum %= mod;
		}
		System.out.println(sum);
	}

	static boolean isGood(int n, int a, int b) {
		while (n % 10 == a || n % 10 == b) {
			n /= 10;
		}
		return n == 0;
	}

	static void generateFactor(int n) {
		factor = new long[n + 10];
		factor[0] = 1;
		for (int i = 1; i < n + 10; i++) {
			factor[i] = (factor[i - 1] * i) % mod;
		}
	}

	static class InputReader {

		InputStream is = System.in;
		byte[] inbuf = new byte[1 << 23];
		int lenbuf = 0, ptrbuf = 0;

		public InputReader() throws IOException {
			lenbuf = is.read(inbuf);
		}

		public int readByte() {

			if (ptrbuf >= lenbuf) {
				return -1;
			}

			return inbuf[ptrbuf++];
		}

		public boolean hasNext() {
			int t = skip();

			if (t == -1) {
				return false;
			}
			ptrbuf--;
			return true;
		}

		public StringBuilder printIntArr(int[] ar, int n) {
			StringBuilder res = new StringBuilder();
			for (int i = 0; i < n; i++) {
				res.append(ar[i] + " ");
			}
			res.append("\n");
			return res;
		}

		public boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		public int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

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

		public char nextChar() {
			return (char) skip();
		}

		public String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (b != '\n' && b != '\r') {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		public char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++) {
				map[i] = ns(m);
			}
			return map;
		}

		public int[][] nmInt(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					map[i][j] = nextInt();
				}
			}
			return map;
		}

		public long[][] nmLong(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					map[i][j] = nextLong();
				}
			}
			return map;
		}

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

		public int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		public long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

	}
}


import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new Template().run();
        // new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    long[] fact;
    long[] revfact;
    int mod = (int) 1e9 + 7;

    long binpow(long x, int p, int mod) {
        if (p == 0) {
            return 1 % mod;
        }
        if (p % 2 == 0) {
            long half = binpow(x, p / 2, mod);
            return half * half % mod;
        } else {
            return x * binpow(x, p - 1, mod) % mod;
        }
    }

    long C(int n, int k) {
        if (k > n) return 0;
        long answer = fact[n];
        answer = answer * revfact[n - k] % mod;
        answer = answer * revfact[k] % mod;
        return answer;
    }

    long ways(int columns, int count, int minHeight) {
        if (columns == 0) {
            if (count == 0) return 1;
            return 0;
        }
        if (count / minHeight < columns) return 0;
        if (columns == 1) return 1;
        int ost = count - columns * minHeight;
        //return binpow(ost + 1, columns - 1, mod);
        int n = ost;
        int m = columns;
        return C(n + m - 1, m - 1);

       // return C(ost + 1, columns - 1);

//        return binpow(columns, ost, mod);
    }

    void solve() throws IOException {
        int MAX = 2 * 100000 + 100;
        fact = new long[MAX];
        revfact = new long[MAX];
        fact[0] = revfact[0] = 1;
        for (int i = 1; i < MAX; i++) {
            fact[i] = fact[i - 1] * i % mod;
            revfact[i] = binpow(fact[i], mod - 2, mod);
        }
        int f = readInt();
        int w = readInt();
        int h = readInt();
        if (w == 0) {
            out.println(1);
            return;
        }

        long correct = 0;
        long all = 0;

        for (int wineColumns = 1; wineColumns <= w; wineColumns++) {
            long foodCount = (ways(wineColumns - 1, f, 1) + ways(wineColumns + 1, f, 1) + ways(wineColumns, f, 1) * 2) % mod;
            all += ways(wineColumns, w, 1) * foodCount % mod;
            all %= mod;
            correct += ways(wineColumns, w, h + 1) * foodCount % mod;
            correct %= mod;
        }
        long answer = correct * binpow(all, mod - 2, mod) % mod;
        //long etalon = new NaiveSolver().solve(f, w, h);
        //if (answer != etalon) throw new RuntimeException("answer not equal etalon");
        out.println(answer);
    }

    class NaiveSolver {

        long solve(int f, int w, int h) {
            brut(f, w, h, true, true, "");
            brut(f, w, h, true, false, "");
            return correct * binpow(all, mod - 2, mod) % mod;
        }

        long correct;
        long all;

        void brut(int f, int w, int h, boolean nowAllOk, boolean nowWine, String represent) {
            if (f == 0 && w == 0) {
                all++;
                if (nowAllOk) correct++;
                System.err.println(represent);
                return;
            }
            if (nowWine) {
                if (w == 0) return;
            } else {
                if (h == 0) return;
            }
            if (nowWine) {
                for (int i = 1; i <= w; i++) {
                    brut(f, w - i, h, nowAllOk & (i > h), !nowWine, represent + str('w', i));
                }
            } else {
                for (int i = 1; i <= f; i++) {
                    brut(f - i, w, h, nowAllOk, !nowWine, represent + str('f', i));
                }
            }
        }
    }

    String str(char x, int cnt) {
        String res = "";
        while (cnt-- > 0) {
            res += x;
        }
        return res;
    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStreamWriter;
import java.util.NoSuchElementException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.List;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Egor Kulikov (egor@egork.net)
 */
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);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt();
            int[] x = new int[n];
            int[] y = new int[n];
            int[] r = new int[n];
            in.readIntArrays(x, y, r);
            Circle[] circles = new Circle[n];
            for (int i = 0; i < n; i++) {
                circles[i] = new Circle(new Point(x[i], y[i]), r[i]);
            }
            List<Point> points = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < i; j++) {
                    Point[] intersect = circles[i].intersect(circles[j]);
                    if (intersect != null) {
                        points.addAll(Arrays.asList(intersect));
                    }
                }
            }
            boolean[] bad = new boolean[points.size()];
            for (int i = 0; i < points.size(); i++) {
                for (int j = 0; j < i; j++) {
                    if (points.get(i).equals(points.get(j))) {
                        bad[i] = true;
                        break;
                    }
                }
            }
            int nVertices = ArrayUtils.count(bad, false);
            int nEdges = 0;
            IndependentSetSystem setSystem = new RecursiveIndependentSetSystem(points.size());
            for (int i = 0; i < n; i++) {
                int current = 0;
                IntList onThis = new IntArrayList();
                for (int j = 0; j < points.size(); j++) {
                    if (!bad[j] && Math.abs(circles[i].center.distance(points.get(j)) - r[i]) < GeometryUtils.epsilon) {
                        current++;
                        onThis.add(j);
                    }
                }
                for (int j = 1; j < onThis.size(); j++) {
                    setSystem.join(onThis.get(j), onThis.get(0));
                }
                nEdges += Math.max(current, 1);
            }
            int nComponents = setSystem.getSetCount() - ArrayUtils.count(bad, true);
            out.printLine(1 + nEdges - nVertices + nComponents);
        }

    }

    static class Line {
        public final double a;
        public final double b;
        public final double c;

        public Line(Point p, double angle) {
            a = Math.sin(angle);
            b = -Math.cos(angle);
            c = -p.x * a - p.y * b;
        }

        public Line(double a, double b, double c) {
            double h = GeometryUtils.fastHypot(a, b);
            this.a = a / h;
            this.b = b / h;
            this.c = c / h;
        }

        public Point intersect(Line other) {
            if (parallel(other)) {
                return null;
            }
            double determinant = b * other.a - a * other.b;
            double x = (c * other.b - b * other.c) / determinant;
            double y = (a * other.c - c * other.a) / determinant;
            return new Point(x, y);
        }

        public boolean parallel(Line other) {
            return Math.abs(a * other.b - b * other.a) < GeometryUtils.epsilon;
        }

        public Line perpendicular(Point point) {
            return new Line(-b, a, b * point.x - a * point.y);
        }

        public double value(Point point) {
            return a * point.x + b * point.y + c;
        }

        public Point[] intersect(Circle circle) {
            double distance = distance(circle.center);
            if (distance > circle.radius + GeometryUtils.epsilon) {
                return new Point[0];
            }
            Point intersection = intersect(perpendicular(circle.center));
            if (Math.abs(distance - circle.radius) < GeometryUtils.epsilon) {
                return new Point[]{intersection};
            }
            double shift = Math.sqrt(circle.radius * circle.radius - distance * distance);
            return new Point[]{new Point(intersection.x + shift * b, intersection.y - shift * a),
                    new Point(intersection.x - shift * b, intersection.y + shift * a)};
        }

        public double distance(Point center) {
            return Math.abs(value(center));
        }

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

            Line line = (Line) o;

            if (!parallel(line)) {
                return false;
            }
            if (Math.abs(a * line.c - c * line.a) > GeometryUtils.epsilon ||
                    Math.abs(b * line.c - c * line.b) > GeometryUtils.epsilon) {
                return false;
            }

            return true;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

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

        public void printLine(int i) {
            writer.println(i);
        }

    }

    static class Circle {
        public final Point center;
        public final double radius;

        public Circle(Point center, double radius) {
            this.center = center;
            this.radius = radius;
        }

        public Point[] intersect(Circle other) {
            double distance = center.distance(other.center);
            if (distance < GeometryUtils.epsilon) {
                return null;
            }
            Line line = new Line(2 * (other.center.x - center.x), 2 * (other.center.y - center.y), other.radius * other
                    .radius - radius * radius + center.x * center.x - other.center.x * other.center.x +
                    center.y * center.y - other.center.y * other.center.y);
            return line.intersect(this);
        }

    }

    static class IntArrayList extends IntAbstractStream implements IntList {
        private int size;
        private int[] data;

        public IntArrayList() {
            this(3);
        }

        public IntArrayList(int capacity) {
            data = new int[capacity];
        }

        public IntArrayList(IntCollection c) {
            this(c.size());
            addAll(c);
        }

        public IntArrayList(IntStream c) {
            this();
            if (c instanceof IntCollection) {
                ensureCapacity(((IntCollection) c).size());
            }
            addAll(c);
        }

        public IntArrayList(IntArrayList c) {
            size = c.size();
            data = c.data.clone();
        }

        public IntArrayList(int[] arr) {
            size = arr.length;
            data = arr.clone();
        }

        public int size() {
            return size;
        }

        public int get(int at) {
            if (at >= size) {
                throw new IndexOutOfBoundsException("at = " + at + ", size = " + size);
            }
            return data[at];
        }

        private void ensureCapacity(int capacity) {
            if (data.length >= capacity) {
                return;
            }
            capacity = Math.max(2 * data.length, capacity);
            data = Arrays.copyOf(data, capacity);
        }

        public void addAt(int index, int value) {
            ensureCapacity(size + 1);
            if (index > size || index < 0) {
                throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);
            }
            if (index != size) {
                System.arraycopy(data, index, data, index + 1, size - index);
            }
            data[index] = value;
            size++;
        }

        public void removeAt(int index) {
            if (index >= size || index < 0) {
                throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);
            }
            if (index != size - 1) {
                System.arraycopy(data, index + 1, data, index, size - index - 1);
            }
            size--;
        }

    }

    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 void readIntArrays(int[]... arrays) {
            for (int i = 0; i < arrays[0].length; i++) {
                for (int j = 0; j < arrays.length; j++) {
                    arrays[j][i] = readInt();
                }
            }
        }

        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 readInt() {
            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);

        }

    }

    static interface IntList extends IntReversableCollection {
        public abstract int get(int index);

        public abstract void addAt(int index, int value);

        public abstract void removeAt(int index);

        default public IntIterator intIterator() {
            return new IntIterator() {
                private int at;
                private boolean removed;

                public int value() {
                    if (removed) {
                        throw new IllegalStateException();
                    }
                    return get(at);
                }

                public boolean advance() {
                    at++;
                    removed = false;
                    return isValid();
                }

                public boolean isValid() {
                    return !removed && at < size();
                }

                public void remove() {
                    removeAt(at);
                    at--;
                    removed = true;
                }
            };
        }

        default public void add(int value) {
            addAt(size(), value);
        }

    }

    static class GeometryUtils {
        public static double epsilon = 1e-8;

        public static double fastHypot(double x, double y) {
            return Math.sqrt(x * x + y * y);
        }

    }

    static class ArrayUtils {
        public static int count(boolean[] array, boolean value) {
            int result = 0;
            for (boolean i : array) {
                if (i == value) {
                    result++;
                }
            }
            return result;
        }

    }

    static interface IntIterator {
        public int value() throws NoSuchElementException;

        public boolean advance();

        public boolean isValid();

    }

    static class RecursiveIndependentSetSystem implements IndependentSetSystem {
        private final int[] color;
        private final int[] rank;
        private int setCount;
        private IndependentSetSystem.Listener listener;

        public RecursiveIndependentSetSystem(int size) {
            color = new int[size];
            rank = new int[size];
            for (int i = 0; i < size; i++) {
                color[i] = i;
            }
            setCount = size;
        }

        public RecursiveIndependentSetSystem(RecursiveIndependentSetSystem other) {
            color = other.color.clone();
            rank = other.rank.clone();
            setCount = other.setCount;
        }

        public boolean join(int first, int second) {
            first = get(first);
            second = get(second);
            if (first == second) {
                return false;
            }
            if (rank[first] < rank[second]) {
                int temp = first;
                first = second;
                second = temp;
            } else if (rank[first] == rank[second]) {
                rank[first]++;
            }
            setCount--;
            color[second] = first;
            if (listener != null) {
                listener.joined(second, first);
            }
            return true;
        }

        public int get(int index) {
            int start = index;
            while (color[index] != index) {
                index = color[index];
            }
            while (start != index) {
                int next = color[start];
                color[start] = index;
                start = next;
            }
            return index;
        }

        public int getSetCount() {
            return setCount;
        }

    }

    static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {
        public IntIterator intIterator();

        default public Iterator<Integer> iterator() {
            return new Iterator<Integer>() {
                private IntIterator it = intIterator();

                public boolean hasNext() {
                    return it.isValid();
                }

                public Integer next() {
                    int result = it.value();
                    it.advance();
                    return result;
                }
            };
        }

        default public int compareTo(IntStream c) {
            IntIterator it = intIterator();
            IntIterator jt = c.intIterator();
            while (it.isValid() && jt.isValid()) {
                int i = it.value();
                int j = jt.value();
                if (i < j) {
                    return -1;
                } else if (i > j) {
                    return 1;
                }
                it.advance();
                jt.advance();
            }
            if (it.isValid()) {
                return 1;
            }
            if (jt.isValid()) {
                return -1;
            }
            return 0;
        }

    }

    static abstract class IntAbstractStream implements IntStream {

        public String toString() {
            StringBuilder builder = new StringBuilder();
            boolean first = true;
            for (IntIterator it = intIterator(); it.isValid(); it.advance()) {
                if (first) {
                    first = false;
                } else {
                    builder.append(' ');
                }
                builder.append(it.value());
            }
            return builder.toString();
        }

        public boolean equals(Object o) {
            if (!(o instanceof IntStream)) {
                return false;
            }
            IntStream c = (IntStream) o;
            IntIterator it = intIterator();
            IntIterator jt = c.intIterator();
            while (it.isValid() && jt.isValid()) {
                if (it.value() != jt.value()) {
                    return false;
                }
                it.advance();
                jt.advance();
            }
            return !it.isValid() && !jt.isValid();
        }

        public int hashCode() {
            int result = 0;
            for (IntIterator it = intIterator(); it.isValid(); it.advance()) {
                result *= 31;
                result += it.value();
            }
            return result;
        }

    }

    static interface IndependentSetSystem {
        public boolean join(int first, int second);

        public int getSetCount();

        public static interface Listener {
            public void joined(int joinedRoot, int root);

        }

    }

    static interface IntCollection extends IntStream {
        public int size();

        default public void add(int value) {
            throw new UnsupportedOperationException();
        }

        default public IntCollection addAll(IntStream values) {
            for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {
                add(it.value());
            }
            return this;
        }

    }

    static interface IntReversableCollection extends IntCollection {
    }

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

        public String toString() {
            return "(" + x + ", " + y + ")";
        }

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

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

            Point point = (Point) o;

            return Math.abs(x - point.x) <= GeometryUtils.epsilon && Math.abs(y - point.y) <= GeometryUtils.epsilon;
        }

        public int hashCode() {
            int result;
            long temp;
            temp = x != +0.0d ? Double.doubleToLongBits(x) : 0L;
            result = (int) (temp ^ (temp >>> 32));
            temp = y != +0.0d ? Double.doubleToLongBits(y) : 0L;
            result = 31 * result + (int) (temp ^ (temp >>> 32));
            return result;
        }

        public double distance(Point other) {
            return GeometryUtils.fastHypot(x - other.x, y - other.y);
        }

    }
}


import java.util.*;
public class C_Bear_And_Company_3 {

    static int cv, ck , cs;
    static int[][] freq;
    static ArrayList<Integer>[] pos;
    static int[][][][] dp;

    public static void main(String[] agrs) {
    	Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        char[] c = in.next().toCharArray();
        cv = 0;
        ck = 0;
        cs = 0;
        freq = new int[n + 1][3];
        pos = new ArrayList[3];
        for (int i = 0; i < 3; i++) pos[i] = new ArrayList<>();
        int idx = 0;
        for (char x : c) {
            System.arraycopy(freq[idx], 0, freq[idx + 1], 0, 3);
            idx++;
            if (x == 'V') {
                freq[idx][0]++;
                cv++;
                pos[0].add(idx);
            } else if (x == 'K') {
                freq[idx][1]++;
                ck++;
                pos[1].add(idx);
            } else {
                freq[idx][2]++;
                cs++;
                pos[2].add(idx);
            }
        }
        dp = new int[cv + 1][ck + 1][cs + 1][3];
        for (int[][][] x : dp) for (int[][] y : x) for (int[] z : y) Arrays.fill(z, -1);
        System.out.println(dfs(0, 0, 0, 2));
    }

    static int dfs(int tv, int tk, int ts, int last) {
        if (tv == cv && tk == ck && ts == cs) {
            return 0;
        }
        if (dp[tv][tk][ts][last] != -1) return dp[tv][tk][ts][last];
        int ret = 1 << 29;
        if (tv < cv) {
            int p = pos[0].get(tv);
            int move = Math.max(freq[p][0] - tv, 0) + Math.max(freq[p][1] - tk, 0) + Math.max(freq[p][2] - ts, 0) - 1;
            ret = Math.min(ret, dfs(tv + 1, tk, ts, 0) + move);
        }
        if (tk < ck && last != 0) {
            int p = pos[1].get(tk);
            int move = Math.max(freq[p][0] - tv, 0) + Math.max(freq[p][1] - tk, 0) + Math.max(freq[p][2] - ts, 0) - 1;
            ret = Math.min(ret, dfs(tv, tk + 1, ts, 1) + move);
        }
        if (ts < cs) {
            int p = pos[2].get(ts);
            int move = Math.max(freq[p][0] - tv, 0) + Math.max(freq[p][1] - tk, 0) + Math.max(freq[p][2] - ts, 0) - 1;
            ret = Math.min(ret, dfs(tv, tk, ts + 1, 2) + move);
        }
        return dp[tv][tk][ts][last] = ret;
    }

}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner cv=new Scanner(System.in);
        long a=cv.nextInt();
        long b=cv.nextInt();
        long c=cv.nextInt();
        long k=0;
        if(a>b){
            k+=(b+c)*2;
            k++;
        }else if(b>a){
            k+=(a+c)*2;
            k++;
        }else {
            k+=(a+c)*2;
        }
        System.out.println(k);
    }
}


import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author jtim
 */
public class taskC {

    public static void main(String[] args) {
        new taskC().main();
    }
    Scanner s = new Scanner(System.in);
    long min = Long.MAX_VALUE, max = Long.MIN_VALUE, n = 0;

    void check(long a, long b, long c) {
        long m = (a+1)*(b+2)*(c+2);
        long now = m - n;
        min = Math.min(min, now);
        max = Math.max(max, now);
    }

    void main() {
        n = s.nextInt();

        for (long x = 1; x * x <= n; x++) {
            if (n % x == 0) {

                long rem = n / x;

                for (long y = 1; y * y <= rem; y++) {
                    if (rem % y == 0) {

                        long z = rem / y;

                        check(x, y, z);
                        check(x, z, y);
                        check(y, x, z);
                        check(y, z, x);
                        check(z, x, y);
                        check(z, y, x);

                    }
                }

            }
        }

        System.out.println(min + " " + max);
    }
}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    boolean dp[]=new boolean[101];
	    dp[3]=dp[6]=dp[7]=true;
	    for(int i=8;i<101;i++){
	        dp[i]=dp[i-3]|dp[i-7];
	    }
	    while(n-->0){
	        int x=sc.nextInt();
	        if(dp[x])System.out.println("YES");
	        else System.out.println("NO");
	    }
	}
}


import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author sheep
 */
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);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    private static final long MAX_VALUE = 10000000000000L;
    private int n, m;
    private int[] a, b;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        n = in.nextInt();
        m = in.nextInt();
        a = new int[n];
        b = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < n; ++i) {

            b[i] = in.nextInt();
        }

        long[][] dp = new long[81][81];
        ArrayUtils.fill(dp, MAX_VALUE);
        for (int i = 0; i <= 80; ++i) {
            dp[i][i] = 0;
        }
        for (int i = 0; i < n; ++i) {
            long[][] next = new long[81][81];
            ArrayUtils.fill(next, MAX_VALUE);
            for (int j = 0; j <= 80; ++j) {
                for (int k = 0; k <= 80; ++k) {
                    if (k > 0) {
                        next[j][k - 1] = Math.min(next[j][k - 1], dp[j][k] + b[i]);
                    }
                    if (k + 1 <= 80) {
                        next[j][k + 1] = Math.min(next[j][k + 1], dp[j][k] + a[i]);
                    }
                }
            }
            dp = next;
        }

        long[][] result = new long[81][81];
        ArrayUtils.fill(result, MAX_VALUE);
        for (int i = 0; i <= 80; ++i) {
            result[i][i] = 0;
        }

        for (; m > 0; m >>= 1) {
            if (m % 2 == 1) result = mul(result, dp);
            dp = mul(dp, dp);
        }

        out.println(result[0][0]);
    }

    private long[][] mul(long[][] a, long[][] b) {
        long[][] c = new long[81][81];
        ArrayUtils.fill(c, MAX_VALUE);
        for (int k = 0; k <= 80; ++k) {
            for (int i = 0; i <= 80; ++i) {
                for (int j = 0; j <= 80; ++j) {
                    c[i][j] = Math.min(c[i][j], a[i][k] + b[k][j]);
                }
            }
        }
        return c;
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

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

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (Exception e) {
                throw new UnknownError();
            }
        }
        return tokenizer.nextToken();
    }

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

    }

class ArrayUtils {

    public static void fill(long[][] array, long value) {
        for (int i = 0; i < array.length; ++i) {
            Arrays.fill(array[i], value);
        }
    }

    }


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

public class F946{

    long[] fibpow;
    char[] chs;
    long mod = 1000000007L;
    long modpow = mod-1L;
    long[][][] memo;

    long pow(long m, long n){
        long res = 1;
        while(n > 0){
            if(n % 2 == 1)res = (res*m)%mod;
            m = (m*m)%mod;
            n = n/2;
        }
        return res;
    }

    private void solve() throws Exception {
        int n = nextInt();
        int x = nextInt();
        chs = nextToken().toCharArray();
        memo = new long[n][n][x+1];
        for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) Arrays.fill(memo[i][j], -1);
        fibpow = new long[x+1];
        if(x > 0) fibpow[1] = 1L;
        for(int i = 2; i <= x; i++) fibpow[i] = (fibpow[i-1]+ fibpow[i-2])%modpow;
        for(int i = 0; i <= x; i++) fibpow[i] = pow(2, fibpow[i]);
        out.println(doit(0,n-1,x));
    }

    long doit(int i, int j, int x) {
        if (x < 2 && i == j && chs[i]-'0' == x) return 1L;
        else if (x < 2 && i == j && chs[i]-'0' != x) return 0L;
        else if(x < 2 && i < j) return 0L;
        else if(memo[i][j][x] < 0){
            long res = 0L;
            res = (res + ((i==0?fibpow[x]:(1L)) * doit(i,j, x-2))%mod)%mod;
            for(int t = i; t < j; t++) res = (res + (doit(i,t,x-1) * doit(t+1,j, x-2))%mod)%mod;
            res = (res + (doit(i,j,x-1) * (j==chs.length-1? fibpow[x-1]:(1L)))%mod)%mod;
            memo[i][j][x] = res;
        }
        return memo[i][j][x];
    }

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

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer tokenizer;

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

    private float nextFloat() throws IOException {
        return Float.parseFloat(nextToken());
    }

    private String nextLine() throws IOException {
        return new String(in.readLine());
    }

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

}


import java.util.*;
import java.io.*;
public class Main {
    static BufferedReader reader
		= new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder out = new StringBuilder();

    public static void main(String[] args){
        int[] inp = nextIntArray();
        double r, h;
        r = inp[0]; h = inp[1];
        double a = (h + r/2) / r;
        double b =  ( ( (2 - Math.sqrt(3)) * r / 2 ) + h) / r;
        a = 2 * Math.floor(0.0000001 + a);
        b = 1 + 2 * Math.floor(0.0000001 + b);
        out.append((int) Math.max(a, b));

        System.out.println(out);
    }

    // the followings are methods to take care of inputs.
    static int nextInt(){
        return Integer.parseInt(nextLine());
    }
    static long nextLong(){
        return Long.parseLong(nextLine());
    }
    static int[] nextIntArray(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length]; for (int i = 0; i < ary.length; i++){
            ary[i] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static int[] nextIntArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArray(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length];
        for (int i = 0; i < inp.length; i++){
            ary[i] = Long.parseLong(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Long.parseLong(inp[i]);
        }
        return ary;
    }
	static String nextLine(){
		try {
			return reader.readLine().trim();
		} catch (Exception e){}
		return null;
	}
}


  import java.awt.Checkbox;
import java.awt.Point;
import java.io.*;
                    import java.math.*;
                    import java.util.*;
import java.util.Map.Entry;

import javax.print.attribute.SetOfIntegerSyntax;
import javax.swing.plaf.FontUIResource;

                    public class CODE2{
                      private static InputStream stream;
                        private static byte[] buf = new byte[1024];
                        private static int curChar;
                        private static int numChars;
                        private static SpaceCharFilter filter;
                        private static PrintWriter pw;
                        private static long count = 0,mod=1000000007;
                    //    private static TreeSet<Integer> ts=new TreeSet[200000];
public final static int INF = (int) 1E9;

public static void main(String args[]) {
    InputReader(System.in);
    pw = new PrintWriter(System.out);
    new Thread(null ,new Runnable(){
       public void run(){
           try{
               solve();

               pw.close();
           } catch(Exception e){
               e.printStackTrace();
           }
       }
   },"1",1<<26).start();
   }
    static StringBuilder sb;
    public static void test(){
         sb=new StringBuilder();
        int t=nextInt();
        while(t-->0){

            solve();

        }
        pw.println(sb);
    }
    public static long pow(long n, long p,long mod) {
        if(p==0)
            return 1;
        if(p==1)
            return n%mod;
        if(p%2==0){
            long temp=pow(n, p/2,mod);
        return (temp*temp)%mod;
        }else{
                 long temp=pow(n,p/2,mod);
                 temp=(temp*temp)%mod;
                 return(temp*n)%mod;

        }
    }
    public static long pow(long n, long p) {
        if(p==0)
            return 1;
        if(p==1)
            return n;
        if(p%2==0){
            long temp=pow(n, p/2);
        return (temp*temp);
        }else{
                 long temp=pow(n,p/2);
                 temp=(temp*temp);
                 return(temp*n);

        }
    }
    public static void Merge(long a[],int p,int r){
        if(p<r){
            int q = (p+r)/2;
            Merge(a,p,q);
            Merge(a,q+1,r);
            Merge_Array(a,p,q,r);
        }
    }
    public static void Merge_Array(long a[],int p,int q,int r){
       long b[] = new long[q-p+1];
        long c[] = new long[r-q];
        for(int i=0;i<b.length;i++)
            b[i] = a[p+i];
        for(int i=0;i<c.length;i++)
            c[i] = a[q+i+1];
        int i = 0,j = 0;
        for(int k=p;k<=r;k++){
            if(i==b.length){
                a[k] = c[j];
                j++;
            }
            else if(j==c.length){
                a[k] = b[i];
                i++;
            }
            else if(b[i]<c[j]){
                a[k] = b[i];
                i++;
            }
            else{
                a[k] = c[j];
                j++;
            }
        }
    }

    public static long gcd(long x, long y) {
        if (x == 0)
            return y;
        else
            return gcd( y % x,x);
    }

    public static boolean isPrime(int n) {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;

        if (n % 2 == 0 || n % 3 == 0)
            return false;

        for (int i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;

        return true;
    }

        static LinkedList<Integer> adj[];
        static boolean Visited[];
        static HashSet<Integer> exc;
        static long oddsum[]=new long[1000001];
        static long co=0,ans=0;

        private static void buildgraph(int n){
            adj=new LinkedList[n+1];
            Visited=new boolean[n+1];
            levl=new int[n+1];

            for(int i=0;i<=n;i++){
                adj[i]=new LinkedList<Integer>();

            }

        }

        static int[] levl;
        static int[] eat;
        static int n,m;
        static int price[];
        //ind frog crab

        public static void solve(){

        	int n=nextInt();
        	int x=nextInt();
        	int a[]=nextIntArray(n);
        	int freq[]=new int[x];
        	int cnt=0;
        	for(int i=0;i<n;i++){
        		if(a[i]<x){
        			freq[a[i]]++;
        		}
        		if(a[i]==x)
        			cnt++;
        	}
        	for(int i=0;i<x;i++){
        		if(freq[i]==0){
        			cnt++;
        		}
        	}
        	pw.println(cnt);
    }

        static int col[];
    public static boolean isVowel(char c){
        if(c=='a' || c=='e'||c=='i' || c=='o' || c=='u')
            return true;
        return false;
    }
static int no_vert=0;

  private static void dfs(int start){
      Visited[start]=true;
     no_vert++;

      for(int i:adj[start]){
          if(!Visited[i])
              {
              col[i]=col[start]^1;
              dfs(i);

              }
      }

  }

    public static String reverseString(String s) {
        StringBuilder sb = new StringBuilder(s);
        sb.reverse();
        return (sb.toString());
    }

  /*
   private static void BFS(int sou){
        Queue<Integer> q=new LinkedList<Integer>();
        q.add(sou);
        Visited[sou]=true;
        levl[sou]=0;
        while(!q.isEmpty()){
            int top=q.poll();

            for(int i:adj[top]){
                //pw.println(i+" "+top);
            if(!Visited[i])
            {

                q.add(i);
                levl[i]=levl[top]+1;
            }

            Visited[i]=true;

            }
        }
    }*/

                  static int indeg[];
               /* private static void kahn(int n){

                    PriorityQueue<Integer> q=new PriorityQueue<Integer>();
                    for(int i=1;i<=n;i++){
                        if(indeg[i]==0){
                            q.add(i);
                        }
                    }
                    while(!q.isEmpty()){
                        int top=q.poll();
                        st.push(top);
                        for(Node i:adj[top]){
                            indeg[i.to]--;
                            if(indeg[i.to]==0){
                                q.add(i.to);
                            }
                        }
                    }
                }

                    static int state=1;
                    static long no_exc=0,no_vert=0;
                  static Stack<Integer> st;
                  static HashSet<Integer> inset;
                 /*   private static void topo(int curr){

                        Visited[curr]=true;
                        inset.add(curr);
                        for(int x:adj[curr]){
                            if(adj[x].contains(curr) || inset.contains(x)){
                                state=0;
                                return;
                            }
                            if(state==0)
                                return;

                        }
                        st.push(curr);

                        inset.remove(curr);
                    }*/
                    static HashSet<Integer> hs;

                     static boolean prime[];
                    static int spf[];
                    public static void sieve(int n){
                        prime=new boolean[n+1];
                        spf=new int[n+1];

                        Arrays.fill(spf, 1);
                        Arrays.fill(prime, true);
                    prime[1]=false;
                        spf[2]=2;

                    for(int i=4;i<=n;i+=2){
                        spf[i]=2;
                    }
                    for(int i=3;i<=n;i+=2){
                        if(prime[i]){
                            spf[i]=i;
                            for(int j=2*i;j<=n;j+=i){

                                prime[j]=false;
                            if(spf[j]==1){
                                spf[j]=i;
                            }
                            }
                        }
                    }

                    }

                    // To Get Input
// Some Buffer Methods

                     public static void sort(long a[]){
                         Merge(a, 0, a.length-1);
                     }
                    public static void InputReader(InputStream stream1) {
                        stream = stream1;
                    }

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

                    private static boolean isEndOfLine(int c) {
                        return c == '\n' || c == '\r' || c == -1;
                    }

                    private static 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++];
                    }

                    private static 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;
                    }

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

                    private static String nextToken() {
                        int c = read();
                        while (isSpaceChar(c))
                            c = read();
                        StringBuilder res = new StringBuilder();
                        do {
                            res.appendCodePoint(c);
                            c = read();
                        } while (!isSpaceChar(c));
                        return res.toString();
                    }

                    private static String nextLine() {
                        int c = read();
                        while (isSpaceChar(c))
                            c = read();
                        StringBuilder res = new StringBuilder();
                        do {
                            res.appendCodePoint(c);
                            c = read();
                        } while (!isEndOfLine(c));
                        return res.toString();
                    }

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

                    private static long[][] next2dArray(int n, int m) {
                        long[][] arr = new long[n][m];
                        for (int i = 0; i < n; i++) {
                            for (int j = 0; j < m; j++) {
                                arr[i][j] = nextLong();
                            }
                        }
                        return arr;
                    }
                    private static char[][] nextCharArray(int n,int m){
                        char [][]c=new char[n][m];
                        for(int i=0;i<n;i++){
                            String s=nextLine();
                            for(int j=0;j<s.length();j++){
                                c[i][j]=s.charAt(j);
                            }
                        }
                        return c;
                    }

                    private static long[] nextLongArray(int n) {
                        long[] arr = new long[n];
                        for (int i = 0; i < n; i++) {
                            arr[i] = nextLong();
                        }
                        return arr;
                    }

                    private static void pArray(int[] arr) {
                        for (int i = 0; i < arr.length; i++) {
                            pw.print(arr[i] + " ");
                        }
                        pw.println();
                        return;
                    }

                    private static void pArray(long[] arr) {
                        for (int i = 0; i < arr.length; i++) {
                            pw.print(arr[i] + " ");
                        }
                        pw.println();
                        return;
                    }

                    private static void pArray(boolean[] arr) {
                        for (int i = 0; i < arr.length; i++) {
                            pw.print(arr[i] + " ");
                        }
                        pw.println();
                        return;
                    }

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

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

}